|
| 1 | +// Code generated by smithy-swift-codegen. DO NOT EDIT! |
| 2 | +// swiftlint:disable identifier_name cyclomatic_complexity function_body_length |
| 3 | + |
| 4 | +import AWSClientRuntime |
| 5 | +import ClientRuntime |
| 6 | +import AWSDynamoDB |
| 7 | + |
| 8 | +public struct Key: CodingKey { |
| 9 | + public let stringValue: String |
| 10 | + public init(stringValue: String) { |
| 11 | + self.stringValue = stringValue |
| 12 | + self.intValue = nil |
| 13 | + } |
| 14 | + |
| 15 | + public init(_ stringValue: String) { |
| 16 | + self.stringValue = stringValue |
| 17 | + self.intValue = nil |
| 18 | + } |
| 19 | + |
| 20 | + public let intValue: Int? |
| 21 | + public init?(intValue: Int) { |
| 22 | + return nil |
| 23 | + } |
| 24 | +} |
| 25 | + |
| 26 | +extension DynamoDBClientTypes.AttributeValue: Swift.Codable { |
| 27 | + enum CodingKeys: Swift.String, Swift.CodingKey { |
| 28 | + case b = "B" |
| 29 | + case bool = "BOOL" |
| 30 | + case bs = "BS" |
| 31 | + case l = "L" |
| 32 | + case m = "M" |
| 33 | + case n = "N" |
| 34 | + case ns = "NS" |
| 35 | + case null = "NULL" |
| 36 | + case s = "S" |
| 37 | + case ss = "SS" |
| 38 | + case sdkUnknown |
| 39 | + } |
| 40 | + |
| 41 | + public func encode(to encoder: Swift.Encoder) throws { |
| 42 | + var container = encoder.container(keyedBy: CodingKeys.self) |
| 43 | + switch self { |
| 44 | + case let .b(b): |
| 45 | + try container.encode(b.base64EncodedString(), forKey: .b) |
| 46 | + case let .bool(bool): |
| 47 | + try container.encode(bool, forKey: .bool) |
| 48 | + case let .bs(bs): |
| 49 | + var bsContainer = container.nestedUnkeyedContainer(forKey: .bs) |
| 50 | + for binaryattributevalue0 in bs { |
| 51 | + try bsContainer.encode(binaryattributevalue0.base64EncodedString()) |
| 52 | + } |
| 53 | + case let .l(l): |
| 54 | + var lContainer = container.nestedUnkeyedContainer(forKey: .l) |
| 55 | + for attributevalue0 in l { |
| 56 | + try lContainer.encode(attributevalue0) |
| 57 | + } |
| 58 | + case let .m(m): |
| 59 | + var mContainer = container.nestedContainer(keyedBy: Key.self, forKey: .m) |
| 60 | + for (dictKey0, mapAttributeValue0) in m { |
| 61 | + try mContainer.encode(mapAttributeValue0, forKey: Key(stringValue: dictKey0)) |
| 62 | + } |
| 63 | + case let .n(n): |
| 64 | + try container.encode(n, forKey: .n) |
| 65 | + case let .ns(ns): |
| 66 | + var nsContainer = container.nestedUnkeyedContainer(forKey: .ns) |
| 67 | + for numberattributevalue0 in ns { |
| 68 | + try nsContainer.encode(numberattributevalue0) |
| 69 | + } |
| 70 | + case let .null(null): |
| 71 | + try container.encode(null, forKey: .null) |
| 72 | + case let .s(s): |
| 73 | + try container.encode(s, forKey: .s) |
| 74 | + case let .ss(ss): |
| 75 | + var ssContainer = container.nestedUnkeyedContainer(forKey: .ss) |
| 76 | + for stringattributevalue0 in ss { |
| 77 | + try ssContainer.encode(stringattributevalue0) |
| 78 | + } |
| 79 | + case let .sdkUnknown(sdkUnknown): |
| 80 | + try container.encode(sdkUnknown, forKey: .sdkUnknown) |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + public init(from decoder: Swift.Decoder) throws { |
| 85 | + let values = try decoder.container(keyedBy: CodingKeys.self) |
| 86 | + let sDecoded = try values.decodeIfPresent(Swift.String.self, forKey: .s) |
| 87 | + if let s = sDecoded { |
| 88 | + self = .s(s) |
| 89 | + return |
| 90 | + } |
| 91 | + let nDecoded = try values.decodeIfPresent(Swift.String.self, forKey: .n) |
| 92 | + if let n = nDecoded { |
| 93 | + self = .n(n) |
| 94 | + return |
| 95 | + } |
| 96 | + let bDecoded = try values.decodeIfPresent(ClientRuntime.Data.self, forKey: .b) |
| 97 | + if let b = bDecoded { |
| 98 | + self = .b(b) |
| 99 | + return |
| 100 | + } |
| 101 | + let ssContainer = try values.decodeIfPresent([Swift.String?].self, forKey: .ss) |
| 102 | + var ssDecoded0:[Swift.String]? = nil |
| 103 | + if let ssContainer = ssContainer { |
| 104 | + ssDecoded0 = [Swift.String]() |
| 105 | + for string0 in ssContainer { |
| 106 | + if let string0 = string0 { |
| 107 | + ssDecoded0?.append(string0) |
| 108 | + } |
| 109 | + } |
| 110 | + } |
| 111 | + if let ss = ssDecoded0 { |
| 112 | + self = .ss(ss) |
| 113 | + return |
| 114 | + } |
| 115 | + let nsContainer = try values.decodeIfPresent([Swift.String?].self, forKey: .ns) |
| 116 | + var nsDecoded0:[Swift.String]? = nil |
| 117 | + if let nsContainer = nsContainer { |
| 118 | + nsDecoded0 = [Swift.String]() |
| 119 | + for string0 in nsContainer { |
| 120 | + if let string0 = string0 { |
| 121 | + nsDecoded0?.append(string0) |
| 122 | + } |
| 123 | + } |
| 124 | + } |
| 125 | + if let ns = nsDecoded0 { |
| 126 | + self = .ns(ns) |
| 127 | + return |
| 128 | + } |
| 129 | + let bsContainer = try values.decodeIfPresent([ClientRuntime.Data?].self, forKey: .bs) |
| 130 | + var bsDecoded0:[ClientRuntime.Data]? = nil |
| 131 | + if let bsContainer = bsContainer { |
| 132 | + bsDecoded0 = [ClientRuntime.Data]() |
| 133 | + for blob0 in bsContainer { |
| 134 | + if let blob0 = blob0 { |
| 135 | + bsDecoded0?.append(blob0) |
| 136 | + } |
| 137 | + } |
| 138 | + } |
| 139 | + if let bs = bsDecoded0 { |
| 140 | + self = .bs(bs) |
| 141 | + return |
| 142 | + } |
| 143 | + let mContainer = try values.decodeIfPresent([Swift.String: DynamoDBClientTypes.AttributeValue?].self, forKey: .m) |
| 144 | + var mDecoded0: [Swift.String:DynamoDBClientTypes.AttributeValue]? = nil |
| 145 | + if let mContainer = mContainer { |
| 146 | + mDecoded0 = [Swift.String:DynamoDBClientTypes.AttributeValue]() |
| 147 | + for (key0, attributevalue0) in mContainer { |
| 148 | + if let attributevalue0 = attributevalue0 { |
| 149 | + mDecoded0?[key0] = attributevalue0 |
| 150 | + } |
| 151 | + } |
| 152 | + } |
| 153 | + if let m = mDecoded0 { |
| 154 | + self = .m(m) |
| 155 | + return |
| 156 | + } |
| 157 | + let lContainer = try values.decodeIfPresent([DynamoDBClientTypes.AttributeValue?].self, forKey: .l) |
| 158 | + var lDecoded0:[DynamoDBClientTypes.AttributeValue]? = nil |
| 159 | + if let lContainer = lContainer { |
| 160 | + lDecoded0 = [DynamoDBClientTypes.AttributeValue]() |
| 161 | + for union0 in lContainer { |
| 162 | + if let union0 = union0 { |
| 163 | + lDecoded0?.append(union0) |
| 164 | + } |
| 165 | + } |
| 166 | + } |
| 167 | + if let l = lDecoded0 { |
| 168 | + self = .l(l) |
| 169 | + return |
| 170 | + } |
| 171 | + let nullDecoded = try values.decodeIfPresent(Swift.Bool.self, forKey: .null) |
| 172 | + if let null = nullDecoded { |
| 173 | + self = .null(null) |
| 174 | + return |
| 175 | + } |
| 176 | + let boolDecoded = try values.decodeIfPresent(Swift.Bool.self, forKey: .bool) |
| 177 | + if let bool = boolDecoded { |
| 178 | + self = .bool(bool) |
| 179 | + return |
| 180 | + } |
| 181 | + self = .sdkUnknown("") |
| 182 | + } |
| 183 | +} |
0 commit comments