|
| 1 | +$version: "1.0" |
| 2 | + |
| 3 | +metadata suppressions = [{ |
| 4 | + id: "HttpMethodSemantics", |
| 5 | + namespace: "com.amazonaws.glacier", |
| 6 | +}] |
| 7 | + |
| 8 | +namespace com.amazonaws.glacier |
| 9 | + |
| 10 | +use aws.api#service |
| 11 | +use aws.auth#sigv4 |
| 12 | +use aws.protocols#restJson1 |
| 13 | +use smithy.test#httpRequestTests |
| 14 | + |
| 15 | +@service( |
| 16 | + sdkId: "Glacier", |
| 17 | + arnNamespace: "glacier", |
| 18 | + cloudFormationName: "Glacier", |
| 19 | + cloudTrailEventSource: "glacier.amazonaws.com", |
| 20 | + endpointPrefix: "glacier", |
| 21 | +) |
| 22 | +@sigv4( |
| 23 | + name: "glacier", |
| 24 | +) |
| 25 | +@restJson1 |
| 26 | +@title("Amazon Glacier") |
| 27 | +@xmlNamespace( |
| 28 | + uri: "http://glacier.amazonaws.com/doc/2012-06-01/", |
| 29 | +) |
| 30 | +service Glacier { |
| 31 | + version: "2012-06-01", |
| 32 | + operations: [ |
| 33 | + UploadArchive, |
| 34 | + UploadMultipartPart, |
| 35 | + ], |
| 36 | +} |
| 37 | + |
| 38 | +@httpRequestTests([ |
| 39 | + { |
| 40 | + id: "GlacierVersionHeader", |
| 41 | + documentation: "Glacier requires that a version header be set on all requests.", |
| 42 | + protocol: restJson1, |
| 43 | + method: "POST", |
| 44 | + uri: "/foo/vaults/bar/archives", |
| 45 | + headers: { |
| 46 | + "X-Amz-Glacier-Version": "2012-06-01", |
| 47 | + }, |
| 48 | + body: "", |
| 49 | + params: { |
| 50 | + accountId: "foo", |
| 51 | + vaultName: "bar", |
| 52 | + }, |
| 53 | + }, |
| 54 | + { |
| 55 | + id: "GlacierChecksums", |
| 56 | + documentation: "Glacier requires checksum headers that are cumbersome to provide.", |
| 57 | + protocol: restJson1, |
| 58 | + method: "POST", |
| 59 | + uri: "/foo/vaults/bar/archives", |
| 60 | + headers: { |
| 61 | + "X-Amz-Glacier-Version": "2012-06-01", |
| 62 | + "X-Amz-Content-Sha256": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", |
| 63 | + "X-Amz-Sha256-Tree-Hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", |
| 64 | + }, |
| 65 | + body: "hello world", |
| 66 | + params: { |
| 67 | + accountId: "foo", |
| 68 | + vaultName: "bar", |
| 69 | + }, |
| 70 | + appliesTo: "client", |
| 71 | + }, |
| 72 | + { |
| 73 | + id: "GlacierAccountId", |
| 74 | + documentation: """ |
| 75 | + Glacier requires that the account id be set, but you can just use a |
| 76 | + hyphen (-) to indicate the current account. This should be default |
| 77 | + behavior if the customer provides a null or empty string.""", |
| 78 | + protocol: restJson1, |
| 79 | + method: "POST", |
| 80 | + uri: "/-/vaults/bar/archives", |
| 81 | + headers: { |
| 82 | + "X-Amz-Glacier-Version": "2012-06-01", |
| 83 | + }, |
| 84 | + body: "", |
| 85 | + params: { |
| 86 | + accountId: "", |
| 87 | + vaultName: "bar", |
| 88 | + }, |
| 89 | + appliesTo: "client", |
| 90 | + } |
| 91 | +]) |
| 92 | +@http( |
| 93 | + method: "POST", |
| 94 | + uri: "/{accountId}/vaults/{vaultName}/archives", |
| 95 | + code: 201, |
| 96 | +) |
| 97 | +operation UploadArchive { |
| 98 | + input: UploadArchiveInput, |
| 99 | + output: ArchiveCreationOutput, |
| 100 | + errors: [ |
| 101 | + InvalidParameterValueException, |
| 102 | + MissingParameterValueException, |
| 103 | + RequestTimeoutException, |
| 104 | + ResourceNotFoundException, |
| 105 | + ServiceUnavailableException, |
| 106 | + ], |
| 107 | +} |
| 108 | + |
| 109 | +@httpRequestTests([ |
| 110 | + { |
| 111 | + id: "GlacierMultipartChecksums", |
| 112 | + documentation: "Glacier requires checksum headers that are cumbersome to provide.", |
| 113 | + protocol: restJson1, |
| 114 | + method: "POST", |
| 115 | + uri: "/foo/vaults/bar/multipart-uploads/baz", |
| 116 | + headers: { |
| 117 | + "X-Amz-Glacier-Version": "2012-06-01", |
| 118 | + "X-Amz-Content-Sha256": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", |
| 119 | + "X-Amz-Sha256-Tree-Hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", |
| 120 | + }, |
| 121 | + body: "hello world", |
| 122 | + params: { |
| 123 | + accountId: "foo", |
| 124 | + vaultName: "bar", |
| 125 | + uploadId: "baz", |
| 126 | + }, |
| 127 | + appliesTo: "client", |
| 128 | + } |
| 129 | +]) |
| 130 | +@http( |
| 131 | + method: "PUT", |
| 132 | + uri: "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}", |
| 133 | + code: 204, |
| 134 | +) |
| 135 | +operation UploadMultipartPart { |
| 136 | + input: UploadMultipartPartInput, |
| 137 | + output: UploadMultipartPartOutput, |
| 138 | + errors: [ |
| 139 | + InvalidParameterValueException, |
| 140 | + MissingParameterValueException, |
| 141 | + RequestTimeoutException, |
| 142 | + ResourceNotFoundException, |
| 143 | + ServiceUnavailableException, |
| 144 | + ], |
| 145 | +} |
| 146 | + |
| 147 | +structure ArchiveCreationOutput { |
| 148 | + @httpHeader("Location") |
| 149 | + location: string, |
| 150 | + @httpHeader("x-amz-sha256-tree-hash") |
| 151 | + checksum: string, |
| 152 | + @httpHeader("x-amz-archive-id") |
| 153 | + archiveId: string, |
| 154 | +} |
| 155 | + |
| 156 | +@error("client") |
| 157 | +@httpError(400) |
| 158 | +structure InvalidParameterValueException { |
| 159 | + type: string, |
| 160 | + code: string, |
| 161 | + message: string, |
| 162 | +} |
| 163 | + |
| 164 | +@error("client") |
| 165 | +@httpError(400) |
| 166 | +structure MissingParameterValueException { |
| 167 | + type: string, |
| 168 | + code: string, |
| 169 | + message: string, |
| 170 | +} |
| 171 | + |
| 172 | +@error("client") |
| 173 | +@httpError(408) |
| 174 | +structure RequestTimeoutException { |
| 175 | + type: string, |
| 176 | + code: string, |
| 177 | + message: string, |
| 178 | +} |
| 179 | + |
| 180 | +@error("client") |
| 181 | +@httpError(404) |
| 182 | +structure ResourceNotFoundException { |
| 183 | + type: string, |
| 184 | + code: string, |
| 185 | + message: string, |
| 186 | +} |
| 187 | + |
| 188 | +@error("server") |
| 189 | +@httpError(500) |
| 190 | +structure ServiceUnavailableException { |
| 191 | + type: string, |
| 192 | + code: string, |
| 193 | + message: string, |
| 194 | +} |
| 195 | + |
| 196 | +structure UploadArchiveInput { |
| 197 | + @httpLabel |
| 198 | + @required |
| 199 | + vaultName: string, |
| 200 | + @httpLabel |
| 201 | + @required |
| 202 | + accountId: string, |
| 203 | + @httpHeader("x-amz-archive-description") |
| 204 | + archiveDescription: string, |
| 205 | + @httpHeader("x-amz-sha256-tree-hash") |
| 206 | + checksum: string, |
| 207 | + @httpPayload |
| 208 | + body: Stream, |
| 209 | +} |
| 210 | + |
| 211 | +structure UploadMultipartPartInput { |
| 212 | + @httpLabel |
| 213 | + @required |
| 214 | + accountId: string, |
| 215 | + @httpLabel |
| 216 | + @required |
| 217 | + vaultName: string, |
| 218 | + @httpLabel |
| 219 | + @required |
| 220 | + uploadId: string, |
| 221 | + @httpHeader("x-amz-sha256-tree-hash") |
| 222 | + checksum: string, |
| 223 | + @httpHeader("Content-Range") |
| 224 | + range: string, |
| 225 | + @httpPayload |
| 226 | + body: Stream, |
| 227 | +} |
| 228 | + |
| 229 | +structure UploadMultipartPartOutput { |
| 230 | + @httpHeader("x-amz-sha256-tree-hash") |
| 231 | + checksum: string, |
| 232 | +} |
| 233 | + |
| 234 | +@streaming |
| 235 | +blob Stream |
| 236 | + |
| 237 | +string string |
0 commit comments