aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/botocore/patches/03-extended-listings.patch
blob: 640767046bbb0c970c846126c244726231202d43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
commit cc02b99f18408f40978b56abfd8e5e9b2c2492d7 (HEAD -> s3tests-v1ext, arcadia/users/vitaliff/s3tests-v1ext)
author: vitaliff
date: 2021-10-27T00:34:16+03:00

    Add ListObjectsV1Ext into boto3 and add a test for it

--- contrib/python/botocore/botocore/data/s3/2006-03-01/service-2.json	(73e85ed9c4be248886f10db6b7d83f27d446916c)
+++ contrib/python/botocore/botocore/data/s3/2006-03-01/service-2.json	(cc02b99f18408f40978b56abfd8e5e9b2c2492d7)
@@ -716,6 +716,19 @@
       ],
       "documentation":"<p>Returns some or all (up to 1,000) of the objects in a bucket with each request. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. A <code>200 OK</code> response can contain valid or invalid XML. Make sure to design your application to parse the contents of the response and handle it appropriately. Objects are returned sorted in an ascending order of the respective key names in the list. For more information about listing objects, see <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/userguide/ListingKeysUsingAPIs.html\">Listing object keys programmatically</a> </p> <p>To use this operation, you must have READ access to the bucket.</p> <p>To use this action in an AWS Identity and Access Management (IAM) policy, you must have permissions to perform the <code>s3:ListBucket</code> action. The bucket owner has this permission by default and can grant this permission to others. For more information about permissions, see <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources\">Permissions Related to Bucket Subresource Operations</a> and <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html\">Managing Access Permissions to Your Amazon S3 Resources</a>.</p> <important> <p>This section describes the latest revision of this action. We recommend that you use this revised API for application development. For backward compatibility, Amazon S3 continues to support the prior version of this API, <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html\">ListObjects</a>.</p> </important> <p>To get a list of your buckets, see <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html\">ListBuckets</a>.</p> <p>The following operations are related to <code>ListObjectsV2</code>:</p> <ul> <li> <p> <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html\">GetObject</a> </p> </li> <li> <p> <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html\">PutObject</a> </p> </li> <li> <p> <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html\">CreateBucket</a> </p> </li> </ul>"
     },
+    "ListObjectsV1Ext":{
+      "name":"ListObjectsV1Ext",
+      "http":{
+        "method":"GET",
+        "requestUri":"/{Bucket}?list-type=ext-v1"
+      },
+      "input":{"shape":"ListObjectsV2Request"},
+      "output":{"shape":"ListObjectsV1ExtOutput"},
+      "errors":[
+        {"shape":"NoSuchBucket"}
+      ],
+      "documentation":"<p>Yandex S3-specific extended listing method. Same as V2, but includes user metadata for each object. The rest of the parameters are exactly the same as in ListObjectsV2.</p>"
+    },
     "ListParts":{
       "name":"ListParts",
       "http":{
@@ -5990,6 +6003,59 @@
         }
       }
     },
+    "ListObjectsV1ExtOutput":{
+      "type":"structure",
+      "members":{
+        "IsTruncated":{
+          "shape":"IsTruncated",
+          "documentation":"<p>Set to false if all of the results were returned. Set to true if more keys are available to return. If the number of results exceeds that specified by MaxKeys, all of the results might not be returned.</p>"
+        },
+        "Contents":{
+          "shape":"ObjectListV1Ext",
+          "documentation":"<p>Metadata about each object returned.</p>"
+        },
+        "Name":{
+          "shape":"BucketName",
+          "documentation":"<p>The bucket name.</p> <p>When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the AWS SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html\">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p> <p>When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.<i>outpostID</i>.s3-outposts.<i>Region</i>.amazonaws.com. When using this action using S3 on Outposts through the AWS SDKs, you provide the Outposts bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see <a href=\"https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html\">Using S3 on Outposts</a> in the <i>Amazon S3 User Guide</i>.</p>"
+        },
+        "Prefix":{
+          "shape":"Prefix",
+          "documentation":"<p> Keys that begin with the indicated prefix.</p>"
+        },
+        "Delimiter":{
+          "shape":"Delimiter",
+          "documentation":"<p>Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere in the response. Each rolled-up result counts as only one return against the <code>MaxKeys</code> value.</p>"
+        },
+        "MaxKeys":{
+          "shape":"MaxKeys",
+          "documentation":"<p>Sets the maximum number of keys returned in the response. By default the action returns up to 1,000 key names. The response might contain fewer keys but will never contain more.</p>"
+        },
+        "CommonPrefixes":{
+          "shape":"CommonPrefixList",
+          "documentation":"<p>All of the keys (up to 1,000) rolled up into a common prefix count as a single return when calculating the number of returns.</p> <p>A response can contain <code>CommonPrefixes</code> only if you specify a delimiter.</p> <p> <code>CommonPrefixes</code> contains all (if there are any) keys between <code>Prefix</code> and the next occurrence of the string specified by a delimiter.</p> <p> <code>CommonPrefixes</code> lists keys that act like subdirectories in the directory specified by <code>Prefix</code>.</p> <p>For example, if the prefix is <code>notes/</code> and the delimiter is a slash (<code>/</code>) as in <code>notes/summer/july</code>, the common prefix is <code>notes/summer/</code>. All of the keys that roll up into a common prefix count as a single return when calculating the number of returns. </p>"
+        },
+        "EncodingType":{
+          "shape":"EncodingType",
+          "documentation":"<p>Encoding type used by Amazon S3 to encode object key names in the XML response.</p> <p>If you specify the encoding-type request parameter, Amazon S3 includes this element in the response, and returns encoded key name values in the following response elements:</p> <p> <code>Delimiter, Prefix, Key,</code> and <code>StartAfter</code>.</p>"
+        },
+        "KeyCount":{
+          "shape":"KeyCount",
+          "documentation":"<p>KeyCount is the number of keys returned with this request. KeyCount will always be less than or equals to MaxKeys field. Say you ask for 50 keys, your result will include less than equals 50 keys </p>"
+        },
+        "ContinuationToken":{
+          "shape":"Token",
+          "documentation":"<p> If ContinuationToken was sent with the request, it is included in the response.</p>"
+        },
+        "NextContinuationToken":{
+          "shape":"NextToken",
+          "documentation":"<p> <code>NextContinuationToken</code> is sent when <code>isTruncated</code> is true, which means there are more keys in the bucket that can be listed. The next list requests to Amazon S3 can be continued with this <code>NextContinuationToken</code>. <code>NextContinuationToken</code> is obfuscated and is not a real key</p>"
+        },
+        "StartAfter":{
+          "shape":"StartAfter",
+          "documentation":"<p>If StartAfter was sent with the request, it is included in the response.</p>"
+        }
+      }
+    },
     "ListPartsOutput":{
       "type":"structure",
       "members":{
@@ -6158,6 +6224,12 @@
       "key":{"shape":"MetadataKey"},
       "value":{"shape":"MetadataValue"}
     },
+    "MetadataMap":{
+      "type":"map",
+      "flattened":true,
+      "key":{"shape":"MetadataKey","locationName":"Name"},
+      "value":{"shape":"MetadataValue","locationName":"Value"}
+    },
     "MetadataDirective":{
       "type":"string",
       "enum":[
@@ -6434,6 +6506,40 @@
       },
       "documentation":"<p>An object consists of data and its descriptive metadata.</p>"
     },
+    "ObjectV1Ext":{
+      "type":"structure",
+      "members":{
+        "Key":{
+          "shape":"ObjectKey",
+          "documentation":"<p>The name that you assign to an object. You use the object key to retrieve the object.</p>"
+        },
+        "LastModified":{
+          "shape":"LastModified",
+          "documentation":"<p>Creation date of the object.</p>"
+        },
+        "ETag":{
+          "shape":"ETag",
+          "documentation":"<p>The entity tag is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described below:</p> <ul> <li> <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the AWS Management Console, and are encrypted by SSE-S3 or plaintext, have ETags that are an MD5 digest of their object data.</p> </li> <li> <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the AWS Management Console, and are encrypted by SSE-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.</p> </li> <li> <p>If an object is created by either the Multipart Upload or Part Copy operation, the ETag is not an MD5 digest, regardless of the method of encryption.</p> </li> </ul>"
+        },
+        "Size":{
+          "shape":"Size",
+          "documentation":"<p>Size in bytes of the object</p>"
+        },
+        "StorageClass":{
+          "shape":"ObjectStorageClass",
+          "documentation":"<p>The class of storage used to store the object.</p>"
+        },
+        "Owner":{
+          "shape":"Owner",
+          "documentation":"<p>The owner of the object</p>"
+        },
+        "Metadata":{
+          "shape":"MetadataMap",
+          "documentation":"<p>User metadata of the object</p>"
+        }
+      },
+      "documentation":"<p>An object consists of data and its descriptive metadata.</p>"
+    },
     "ObjectAlreadyInActiveTierError":{
       "type":"structure",
       "members":{
@@ -6482,6 +6588,11 @@
       "member":{"shape":"Object"},
       "flattened":true
     },
+    "ObjectListV1Ext":{
+      "type":"list",
+      "member":{"shape":"ObjectV1Ext"},
+      "flattened":true
+    },
     "ObjectLockConfiguration":{
       "type":"structure",
       "members":{
--- contrib/python/botocore/botocore/handlers.py	(73e85ed9c4be248886f10db6b7d83f27d446916c)
+++ contrib/python/botocore/botocore/handlers.py	(cc02b99f18408f40978b56abfd8e5e9b2c2492d7)
@@ -737,6 +737,27 @@ def decode_list_object_v2(parsed, context, **kwargs):
     )
 
 
+def decode_list_object_v1ext(parsed, context, **kwargs):
+    # From the documentation: If you specify encoding-type request parameter,
+    # Amazon S3 includes this element in the response, and returns encoded key
+    # name values in the following response elements:
+    # Delimiter, Prefix, ContinuationToken, Key, and StartAfter.
+    _decode_list_object(
+        top_level_keys=['Delimiter', 'Prefix', 'StartAfter'],
+        nested_keys=[('Contents', 'Key'), ('CommonPrefixes', 'Prefix')],
+        parsed=parsed,
+        context=context
+    )
+    # lowercase metadata keys
+    if 'Contents' in parsed:
+        for o in parsed['Contents']:
+            if 'Metadata' in o:
+                lcmeta = {}
+                for k in o['Metadata']:
+                    lcmeta[k.lower()] = o['Metadata'][k]
+                o['Metadata'] = lcmeta
+
+
 def decode_list_object_versions(parsed, context, **kwargs):
     # From the documentation: If you specify encoding-type request parameter,
     # Amazon S3 includes this element in the response, and returns encoded key
@@ -1017,6 +1038,7 @@ BUILTIN_HANDLERS = [
     ('before-parameter-build.glacier', inject_account_id),
     ('after-call.s3.ListObjects', decode_list_object),
     ('after-call.s3.ListObjectsV2', decode_list_object_v2),
+    ('after-call.s3.ListObjectsV1Ext', decode_list_object_v1ext),
     ('after-call.s3.ListObjectVersions', decode_list_object_versions),
 
     # Cloudsearchdomain search operation will be sent by HTTP POST