Skip to content

Commit

Permalink
Delete duplicate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins committed Jan 16, 2024
1 parent 5bae0ee commit 4f2b458
Show file tree
Hide file tree
Showing 20 changed files with 788 additions and 593 deletions.
19 changes: 13 additions & 6 deletions Sources/Core/AWSClientRuntime/Protocols/Ec2Query/Ec2Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
// SPDX-License-Identifier: Apache-2.0
//

public struct Ec2Error: Decodable {
public let code: String
public let message: String
import SmithyReadWrite
import SmithyXML

enum CodingKeys: String, CodingKey {
case code = "Code"
case message = "Message"
public struct Ec2Error {
public var code: String?
public var message: String?

static var readingClosure: ReadingClosure<Ec2Error, Reader> {
return { reader in
var value = Ec2Error()
value.code = try reader["Code"].readIfPresent()
value.message = try reader["Message"].readIfPresent()
return value
}
}
}
15 changes: 11 additions & 4 deletions Sources/Core/AWSClientRuntime/Protocols/Ec2Query/Ec2Errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
// SPDX-License-Identifier: Apache-2.0
//

public struct Ec2Errors: Decodable {
public let error: Ec2Error
import SmithyReadWrite
import SmithyXML

enum CodingKeys: String, CodingKey {
case error = "Error"
public struct Ec2Errors {
public var error: Ec2Error?

static var readingClosure: ReadingClosure<Ec2Errors, Reader> {
return { reader in
var value = Ec2Errors()
value.error = try reader["Error"].readIfPresent(readingClosure: Ec2Error.readingClosure)
return value
}
}
}
26 changes: 15 additions & 11 deletions Sources/Core/AWSClientRuntime/Protocols/Ec2Query/Ec2Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
// SPDX-License-Identifier: Apache-2.0
//

public struct Ec2Response: Decodable {
public let errors: Ec2Errors
public let requestId: String
import SmithyReadWrite
import SmithyXML
@testable import ClientRuntime

public struct Ec2Response {
public var errors: Ec2Errors?
public var requestId: String?

enum CodingKeys: String, CodingKey {
case errors = "Errors"
case requestId = "RequestId"
case requestID = "RequestID"
}

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.errors = try container.decode(Ec2Errors.self, forKey: .errors)

// Attempt to decode the requestId with the key "RequestID"
// if that is not present, then fallback to the key "RequestId"
self.requestId = try container.decodeIfPresent(String.self, forKey: .requestID)
?? container.decode(String.self, forKey: .requestId)
public static var httpBinding: HTTPResponseOutputBinding<Ec2Response, Reader> {
return { httpResponse, responseReader in

Check warning on line 23 in Sources/Core/AWSClientRuntime/Protocols/Ec2Query/Ec2Response.swift

View workflow job for this annotation

GitHub Actions / swiftlint

Unused parameter in a closure should be replaced with _ (unused_closure_parameter)
let reader = responseReader
var value = Ec2Response()
value.errors = try reader["Errors"].readIfPresent(readingClosure: Ec2Errors.readingClosure)
value.requestId = try reader["RequestId"].readIfPresent() ?? reader["RequestID"].readIfPresent()
return value
}
}
}
Loading

0 comments on commit 4f2b458

Please sign in to comment.