Convert headers to botocore keyword arguments.
(self, headers: dict[str, Any])
| 236 | ) |
| 237 | |
| 238 | def _headers_to_botocore_kwargs(self, headers: dict[str, Any]) -> dict[str, Any]: |
| 239 | """Convert headers to botocore keyword arguments.""" |
| 240 | # This is required while we need to support both boto and botocore. |
| 241 | mapping = CaseInsensitiveDict( |
| 242 | { |
| 243 | "Content-Type": "ContentType", |
| 244 | "Cache-Control": "CacheControl", |
| 245 | "Content-Disposition": "ContentDisposition", |
| 246 | "Content-Encoding": "ContentEncoding", |
| 247 | "Content-Language": "ContentLanguage", |
| 248 | "Content-Length": "ContentLength", |
| 249 | "Content-MD5": "ContentMD5", |
| 250 | "Expires": "Expires", |
| 251 | "X-Amz-Grant-Full-Control": "GrantFullControl", |
| 252 | "X-Amz-Grant-Read": "GrantRead", |
| 253 | "X-Amz-Grant-Read-ACP": "GrantReadACP", |
| 254 | "X-Amz-Grant-Write-ACP": "GrantWriteACP", |
| 255 | "X-Amz-Object-Lock-Legal-Hold": "ObjectLockLegalHoldStatus", |
| 256 | "X-Amz-Object-Lock-Mode": "ObjectLockMode", |
| 257 | "X-Amz-Object-Lock-Retain-Until-Date": "ObjectLockRetainUntilDate", |
| 258 | "X-Amz-Request-Payer": "RequestPayer", |
| 259 | "X-Amz-Server-Side-Encryption": "ServerSideEncryption", |
| 260 | "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": "SSEKMSKeyId", |
| 261 | "X-Amz-Server-Side-Encryption-Context": "SSEKMSEncryptionContext", |
| 262 | "X-Amz-Server-Side-Encryption-Customer-Algorithm": "SSECustomerAlgorithm", |
| 263 | "X-Amz-Server-Side-Encryption-Customer-Key": "SSECustomerKey", |
| 264 | "X-Amz-Server-Side-Encryption-Customer-Key-Md5": "SSECustomerKeyMD5", |
| 265 | "X-Amz-Storage-Class": "StorageClass", |
| 266 | "X-Amz-Tagging": "Tagging", |
| 267 | "X-Amz-Website-Redirect-Location": "WebsiteRedirectLocation", |
| 268 | } |
| 269 | ) |
| 270 | extra: dict[str, Any] = {} |
| 271 | for key, value in headers.items(): |
| 272 | try: |
| 273 | kwarg = mapping[key] |
| 274 | except KeyError: |
| 275 | raise TypeError( |
| 276 | f'Header "{key}" is not supported by botocore' |
| 277 | ) from None |
| 278 | extra[kwarg] = value |
| 279 | return extra |
| 280 | |
| 281 | |
| 282 | class GCSFilesStore: |
no test coverage detected