summaryrefslogtreecommitdiffstats
path: root/doc/radosgw/s3/bucketops.rst
blob: 378eb5f044a262d99305ae5f1b7f29f9f5bf9eb1 (plain)
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
===================
 Bucket Operations
===================

PUT Bucket
----------
Creates a new bucket. To create a bucket, you must have a user ID and a valid AWS Access Key ID to authenticate requests. You may not
create buckets as an anonymous user.

Constraints
~~~~~~~~~~~
In general, bucket names should follow domain name constraints.

- Bucket names must be unique.
- Bucket names cannot be formatted as IP address.
- Bucket names can be between 3 and 63 characters long.
- Bucket names must not contain uppercase characters or underscores.
- Bucket names must start with a lowercase letter or number.
- Bucket names must be a series of one or more labels. Adjacent labels are separated by a single period (.). Bucket names can contain lowercase letters, numbers, and hyphens. Each label must start and end with a lowercase letter or a number.

.. note:: The above constraints are relaxed if the option 'rgw_relaxed_s3_bucket_names' is set to true except that the bucket names must still be unique, cannot be formatted as IP address and can contain letters, numbers, periods, dashes and underscores for up to 255 characters long.

Syntax
~~~~~~

::

    PUT /{bucket} HTTP/1.1
    Host: cname.domain.com
    x-amz-acl: public-read-write

    Authorization: AWS {access-key}:{hash-of-header-and-secret}

Parameters
~~~~~~~~~~


+---------------+----------------------+-----------------------------------------------------------------------------+------------+
| Name          | Description          | Valid Values                                                                | Required   |
+===============+======================+=============================================================================+============+
| ``x-amz-acl`` | Canned ACLs.         | ``private``, ``public-read``, ``public-read-write``, ``authenticated-read`` | No         |
+---------------+----------------------+-----------------------------------------------------------------------------+------------+
| ``x-amz-bucket-object-lock-enabled`` | Enable object lock on bucket. | ``true``, ``false``                         | No         |
+--------------------------------------+-------------------------------+---------------------------------------------+------------+

Request Entities
~~~~~~~~~~~~~~~~

+-------------------------------+-----------+----------------------------------------------------------------+
| Name                          | Type      | Description                                                    |
+===============================+===========+================================================================+
| ``CreateBucketConfiguration`` | Container | A container for the bucket configuration.                      |
+-------------------------------+-----------+----------------------------------------------------------------+
| ``LocationConstraint``        | String    | A zonegroup api name, with optional :ref:`s3_bucket_placement` |
+-------------------------------+-----------+----------------------------------------------------------------+


HTTP Response
~~~~~~~~~~~~~

If the bucket name is unique, within constraints and unused, the operation will succeed.
If a bucket with the same name already exists and the user is the bucket owner, the operation will succeed.
If the bucket name is already in use, the operation will fail.

+---------------+-----------------------+----------------------------------------------------------+
| HTTP Status   | Status Code           | Description                                              |
+===============+=======================+==========================================================+
| ``409``       | BucketAlreadyExists   | Bucket already exists under different user's ownership.  |
+---------------+-----------------------+----------------------------------------------------------+

DELETE Bucket
-------------

Deletes a bucket. You can reuse bucket names following a successful bucket removal.

Syntax
~~~~~~

::

    DELETE /{bucket} HTTP/1.1
    Host: cname.domain.com

    Authorization: AWS {access-key}:{hash-of-header-and-secret}

HTTP Response
~~~~~~~~~~~~~

+---------------+---------------+------------------+
| HTTP Status   | Status Code   | Description      |
+===============+===============+==================+
| ``204``       | No Content    | Bucket removed.  |
+---------------+---------------+------------------+

GET Bucket
----------
Returns a list of bucket objects.

Syntax
~~~~~~

::

    GET /{bucket}?max-keys=25 HTTP/1.1
    Host: cname.domain.com

Parameters
~~~~~~~~~~

+---------------------+-----------+-------------------------------------------------------------------------------------------------+
| Name                | Type      | Description                                                                                     |
+=====================+===========+=================================================================================================+
| ``prefix``          | String    | Only returns objects that contain the specified prefix.                                         |
+---------------------+-----------+-------------------------------------------------------------------------------------------------+
| ``delimiter``       | String    | The delimiter between the prefix and the rest of the object name.                               |
+---------------------+-----------+-------------------------------------------------------------------------------------------------+
| ``marker``          | String    | A beginning index for the list of objects returned.                                             |
+---------------------+-----------+-------------------------------------------------------------------------------------------------+
| ``max-keys``        | Integer   | The maximum number of keys to return. Default is 1000.                                          |
+---------------------+-----------+-------------------------------------------------------------------------------------------------+
| ``allow-unordered`` | Boolean   | Non-standard extension. Allows results to be returned unordered. Cannot be used with delimiter. |
+---------------------+-----------+-------------------------------------------------------------------------------------------------+

HTTP Response
~~~~~~~~~~~~~

+---------------+---------------+--------------------+
| HTTP Status   | Status Code   | Description        |
+===============+===============+====================+
| ``200``       | OK            | Buckets retrieved  |
+---------------+---------------+--------------------+

Bucket Response Entities
~~~~~~~~~~~~~~~~~~~~~~~~
``GET /{bucket}`` returns a container for buckets with the following fields.

+------------------------+-----------+----------------------------------------------------------------------------------+
| Name                   | Type      | Description                                                                      |
+========================+===========+==================================================================================+
| ``ListBucketResult``   | Entity    | The container for the list of objects.                                           |
+------------------------+-----------+----------------------------------------------------------------------------------+
| ``Name``               | String    | The name of the bucket whose contents will be returned.                          |
+------------------------+-----------+----------------------------------------------------------------------------------+
| ``Prefix``             | String    | A prefix for the object keys.                                                    |
+------------------------+-----------+----------------------------------------------------------------------------------+
| ``Marker``             | String    | A beginning index for the list of objects returned.                              |
+------------------------+-----------+----------------------------------------------------------------------------------+
| ``MaxKeys``            | Integer   | The maximum number of keys returned.                                             |
+------------------------+-----------+----------------------------------------------------------------------------------+
| ``Delimiter``          | String    | If set, objects with the same prefix will appear in the ``CommonPrefixes`` list. |
+------------------------+-----------+----------------------------------------------------------------------------------+
| ``IsTruncated``        | Boolean   | If ``true``, only a subset of the bucket's contents were returned.               |
+------------------------+-----------+----------------------------------------------------------------------------------+
| ``CommonPrefixes``     | Container | If multiple objects contain the same prefix, they will appear in this list.      |
+------------------------+-----------+----------------------------------------------------------------------------------+

Object Response Entities
~~~~~~~~~~~~~~~~~~~~~~~~
The ``ListBucketResult`` contains objects, where each object is within a ``Contents`` container.

+------------------------+-----------+------------------------------------------+
| Name                   | Type      | Description                              |
+========================+===========+==========================================+
| ``Contents``           | Object    | A container for the object.              |
+------------------------+-----------+------------------------------------------+
| ``Key``                | String    | The object's key.                        |
+------------------------+-----------+------------------------------------------+
| ``LastModified``       | Date      | The object's last-modified date/time.    |
+------------------------+-----------+------------------------------------------+
| ``ETag``               | String    | An MD-5 hash of the object. (entity tag) |
+------------------------+-----------+------------------------------------------+
| ``Size``               | Integer   | The object's size.                       |
+------------------------+-----------+------------------------------------------+
| ``StorageClass``       | String    | Should always return ``STANDARD``.       |
+------------------------+-----------+------------------------------------------+
| ``Type``               | String    | ``Appendable`` or ``Normal``.            |
+------------------------+-----------+------------------------------------------+

Get Bucket Location
-------------------
Retrieves the bucket's region. The user needs to be the bucket owner
to call this. A bucket can be constrained to a region by providing
``LocationConstraint`` during a PUT request.

Syntax
~~~~~~
Add the ``location`` subresource to bucket resource as shown below

::

   GET /{bucket}?location HTTP/1.1
   Host: cname.domain.com

   Authorization: AWS {access-key}:{hash-of-header-and-secret}

Response Entities
~~~~~~~~~~~~~~~~~~~~~~~~

+------------------------+-----------+------------------------------------------+
| Name                   | Type      | Description                              |
+========================+===========+==========================================+
| ``LocationConstraint`` | String    | The region where bucket resides, empty   |
|                        |           | string for default region                |
+------------------------+-----------+------------------------------------------+



Get Bucket ACL
--------------
Retrieves the bucket access control list. The user needs to be the bucket
owner or to have been granted ``READ_ACP`` permission on the bucket.

Syntax
~~~~~~
Add the ``acl`` subresource to the bucket request as shown below.

::

    GET /{bucket}?acl HTTP/1.1
    Host: cname.domain.com

    Authorization: AWS {access-key}:{hash-of-header-and-secret}

Response Entities
~~~~~~~~~~~~~~~~~

+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| Name                      | Type        | Description                                                                                  |
+===========================+=============+==============================================================================================+
| ``AccessControlPolicy``   | Container   | A container for the response.                                                                |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``AccessControlList``     | Container   | A container for the ACL information.                                                         |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``Owner``                 | Container   | A container for the bucket owner's ``ID`` and ``DisplayName``.                               |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``ID``                    | String      | The bucket owner's ID.                                                                       |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``DisplayName``           | String      | The bucket owner's display name.                                                             |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``Grant``                 | Container   | A container for ``Grantee`` and ``Permission``.                                              |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``Grantee``               | Container   | A container for the ``DisplayName`` and ``ID`` of the user receiving a grant of permission.  |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``Permission``            | String      | The permission given to the ``Grantee`` bucket.                                              |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+

PUT Bucket ACL
--------------
Sets an access control to an existing bucket. The user needs to be the bucket
owner or to have been granted ``WRITE_ACP`` permission on the bucket.

Syntax
~~~~~~
Add the ``acl`` subresource to the bucket request as shown below.

::

    PUT /{bucket}?acl HTTP/1.1

Request Entities
~~~~~~~~~~~~~~~~

+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| Name                      | Type        | Description                                                                                  |
+===========================+=============+==============================================================================================+
| ``AccessControlPolicy``   | Container   | A container for the request.                                                                 |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``AccessControlList``     | Container   | A container for the ACL information.                                                         |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``Owner``                 | Container   | A container for the bucket owner's ``ID`` and ``DisplayName``.                               |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``ID``                    | String      | The bucket owner's ID.                                                                       |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``DisplayName``           | String      | The bucket owner's display name.                                                             |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``Grant``                 | Container   | A container for ``Grantee`` and ``Permission``.                                              |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``Grantee``               | Container   | A container for the ``DisplayName`` and ``ID`` of the user receiving a grant of permission.  |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+
| ``Permission``            | String      | The permission given to the ``Grantee`` bucket.                                              |
+---------------------------+-------------+----------------------------------------------------------------------------------------------+

List Bucket Multipart Uploads
-----------------------------

``GET /?uploads`` returns a list of the current in-progress multipart uploads--i.e., the application initiates a multipart upload, but
the service hasn't completed all the uploads yet.

Syntax
~~~~~~

::

    GET /{bucket}?uploads HTTP/1.1

Parameters
~~~~~~~~~~

You may specify parameters for ``GET /{bucket}?uploads``, but none of them are required.

+------------------------+-----------+--------------------------------------------------------------------------------------+
| Name                   | Type      | Description                                                                          |
+========================+===========+======================================================================================+
| ``prefix``             | String    | Returns in-progress uploads whose keys contains the specified prefix.                |
+------------------------+-----------+--------------------------------------------------------------------------------------+
| ``delimiter``          | String    | The delimiter between the prefix and the rest of the object name.                    |
+------------------------+-----------+--------------------------------------------------------------------------------------+
| ``key-marker``         | String    | The beginning marker for the list of uploads.                                        |
+------------------------+-----------+--------------------------------------------------------------------------------------+
| ``max-keys``           | Integer   | The maximum number of in-progress uploads. The default is 1000.                      |
+------------------------+-----------+--------------------------------------------------------------------------------------+
| ``max-uploads``        | Integer   | The maximum number of multipart uploads. The range from 1-1000. The default is 1000. |
+------------------------+-----------+--------------------------------------------------------------------------------------+
| ``upload-id-marker``   | String    | Ignored if ``key-marker`` is not specified. Specifies the ``ID`` of first            |
|                        |           | upload to list in lexicographical order at or following the ``ID``.                  |
+------------------------+-----------+--------------------------------------------------------------------------------------+


Response Entities
~~~~~~~~~~~~~~~~~

+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| Name                                    | Type        | Description                                                                                              |
+=========================================+=============+==========================================================================================================+
| ``ListMultipartUploadsResult``          | Container   | A container for the results.                                                                             |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``ListMultipartUploadsResult.Prefix``   | String      | The prefix specified by the ``prefix`` request parameter (if any).                                       |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``Bucket``                              | String      | The bucket that will receive the bucket contents.                                                        |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``KeyMarker``                           | String      | The key marker specified by the ``key-marker`` request parameter (if any).                               |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``UploadIdMarker``                      | String      | The marker specified by the ``upload-id-marker`` request parameter (if any).                             |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``NextKeyMarker``                       | String      | The key marker to use in a subsequent request if ``IsTruncated`` is ``true``.                            |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``NextUploadIdMarker``                  | String      | The upload ID marker to use in a subsequent request if ``IsTruncated`` is ``true``.                      |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``MaxUploads``                          | Integer     | The max uploads specified by the ``max-uploads`` request parameter.                                      |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``Delimiter``                           | String      | If set, objects with the same prefix will appear in the ``CommonPrefixes`` list.                         |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``IsTruncated``                         | Boolean     | If ``true``, only a subset of the bucket's upload contents were returned.                                |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``Upload``                              | Container   | A container for ``Key``, ``UploadId``, ``InitiatorOwner``, ``StorageClass``, and ``Initiated`` elements. |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``Key``                                 | String      | The key of the object once the multipart upload is complete.                                             |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``UploadId``                            | String      | The ``ID`` that identifies the multipart upload.                                                         |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``Initiator``                           | Container   | Contains the ``ID`` and ``DisplayName`` of the user who initiated the upload.                            |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``DisplayName``                         | String      | The initiator's display name.                                                                            |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``ID``                                  | String      | The initiator's ID.                                                                                      |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``Owner``                               | Container   | A container for the ``ID`` and ``DisplayName`` of the user who owns the uploaded object.                 |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``StorageClass``                        | String      | The method used to store the resulting object. ``STANDARD`` or ``REDUCED_REDUNDANCY``                    |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``Initiated``                           | Date        | The date and time the user initiated the upload.                                                         |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``CommonPrefixes``                      | Container   | If multiple objects contain the same prefix, they will appear in this list.                              |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+
| ``CommonPrefixes.Prefix``               | String      | The substring of the key after the prefix as defined by the ``prefix`` request parameter.                |
+-----------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+

ENABLE/SUSPEND BUCKET VERSIONING
--------------------------------

``PUT /?versioning`` This subresource set the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.

You can set the versioning state with one of the following values:

- Enabled : Enables versioning for the objects in the bucket, All objects added to the bucket receive a unique version ID.
- Suspended : Disables versioning for the objects in the bucket, All objects added to the bucket receive the version ID null.

If the versioning state has never been set on a bucket, it has no versioning state; a GET versioning request does not return a versioning state value.

Syntax
~~~~~~

::

    PUT  /{bucket}?versioning  HTTP/1.1

REQUEST ENTITIES
~~~~~~~~~~~~~~~~

+-----------------------------+-----------+---------------------------------------------------------------------------+
| Name                        | Type      | Description                                                               |
+=============================+===========+===========================================================================+
| ``VersioningConfiguration`` | Container | A container for the request.                                              |
+-----------------------------+-----------+---------------------------------------------------------------------------+
| ``Status``                  | String    | Sets the versioning state of the bucket.  Valid Values: Suspended/Enabled |
+-----------------------------+-----------+---------------------------------------------------------------------------+

PUT BUCKET OBJECT LOCK
--------------------------------

Places an Object Lock configuration on the specified bucket. The rule specified in the Object Lock configuration will be
applied by default to every new object placed in the specified bucket.

Syntax
~~~~~~

::

    PUT /{bucket}?object-lock HTTP/1.1

Request Entities
~~~~~~~~~~~~~~~~

+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| Name                        | Type        | Description                                                                            | Required |
+=============================+=============+========================================================================================+==========+
| ``ObjectLockConfiguration`` | Container   | A container for the request.                                                           |   Yes    |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``ObjectLockEnabled``       | String      | Indicates whether this bucket has an Object Lock configuration enabled.                |   Yes    |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``Rule``                    | Container   | The Object Lock rule in place for the specified bucket.                                |   No     |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``DefaultRetention``        | Container   | The default retention period applied to new objects placed in the specified bucket.    |   No     |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``Mode``                    | String      | The default Object Lock retention mode. Valid Values:  GOVERNANCE/COMPLIANCE           |   Yes    |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``Days``                    | Integer     | The number of days specified for the default retention period.                         |   No     |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``Years``                   | Integer     | The number of years specified for the default retention period.                        |   No     |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+

HTTP Response
~~~~~~~~~~~~~

If the bucket object lock is not enabled when creating the bucket, the operation will fail.

+---------------+-----------------------+----------------------------------------------------------+
| HTTP Status   | Status Code           | Description                                              |
+===============+=======================+==========================================================+
| ``400``       | MalformedXML          | The XML is not well-formed                               |
+---------------+-----------------------+----------------------------------------------------------+
| ``409``       | InvalidBucketState    | The bucket object lock is not enabled                    |
+---------------+-----------------------+----------------------------------------------------------+

GET BUCKET OBJECT LOCK
--------------------------------

Gets the Object Lock configuration for a bucket. The rule specified in the Object Lock configuration will be applied by
default to every new object placed in the specified bucket.

Syntax
~~~~~~

::

    GET /{bucket}?object-lock HTTP/1.1


Response Entities
~~~~~~~~~~~~~~~~~

+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| Name                        | Type        | Description                                                                            | Required |
+=============================+=============+========================================================================================+==========+
| ``ObjectLockConfiguration`` | Container   | A container for the request.                                                           |   Yes    |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``ObjectLockEnabled``       | String      | Indicates whether this bucket has an Object Lock configuration enabled.                |   Yes    |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``Rule``                    | Container   | The Object Lock rule in place for the specified bucket.                                |   No     |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``DefaultRetention``        | Container   | The default retention period applied to new objects placed in the specified bucket.    |   No     |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``Mode``                    | String      | The default Object Lock retention mode. Valid Values:  GOVERNANCE/COMPLIANCE           |   Yes    |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``Days``                    | Integer     | The number of days specified for the default retention period.                         |   No     |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+
| ``Years``                   | Integer     | The number of years specified for the default retention period.                        |   No     |
+-----------------------------+-------------+----------------------------------------------------------------------------------------+----------+

Create Notification
-------------------

Create a publisher for a specific bucket into a topic.

Syntax
~~~~~~

::

    PUT /<bucket name>?notification HTTP/1.1


Request Entities
~~~~~~~~~~~~~~~~

Parameters are XML encoded in the body of the request, in the following format:

::

   <NotificationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
       <TopicConfiguration>
           <Id></Id>
           <Topic></Topic>
           <Event></Event>
           <Filter>
               <S3Key>
                   <FilterRule>
                       <Name></Name>
                       <Value></Value>
                   </FilterRule>
        	    </S3Key>
                <S3Metadata>
                    <FilterRule>
                        <Name></Name>
                        <Value></Value>
                    </FilterRule>
                </S3Metadata>
                <S3Tags>
                    <FilterRule>
                        <Name></Name>
                        <Value></Value>
                    </FilterRule>
                </S3Tags>
            </Filter>
       </TopicConfiguration>
   </NotificationConfiguration>

+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| Name                          | Type      | Description                                                                          | Required |
+===============================+===========+======================================================================================+==========+
| ``NotificationConfiguration`` | Container | Holding list of ``TopicConfiguration`` entities                                      | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``TopicConfiguration``        | Container | Holding ``Id``, ``Topic`` and list of ``Event`` entities                             | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``Id``                        | String    | Name of the notification                                                             | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``Topic``                     | String    | Topic ARN. Topic must be created beforehand                                          | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``Event``                     | String    | List of supported events see: `S3 Notification Compatibility`_.  Multiple ``Event``  | No       |
|                               |           | entities can be used. If omitted, all events are handled                             |          |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``Filter``                    | Container | Holding ``S3Key``, ``S3Metadata`` and ``S3Tags`` entities                            | No       |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``S3Key``                     | Container | Holding a list of ``FilterRule`` entities, for filtering based on object key.        | No       |
|                               |           | At most, 3 entities may be in the list, with ``Name`` be ``prefix``, ``suffix`` or   |          |
|                               |           | ``regex``. All filter rules in the list must match for the filter to match.          |          |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``S3Metadata``                | Container | Holding a list of ``FilterRule`` entities, for filtering based on object metadata.   | No       |
|                               |           | All filter rules in the list must match the metadata defined on the object. However, |          |
|                               |           | the object still match if it has other metadata entries not listed in the filter.    |          |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``S3Tags``                    | Container | Holding a list of ``FilterRule`` entities, for filtering based on object tags.       | No       |
|                               |           | All filter rules in the list must match the tags defined on the object. However,     |          |
|                               |           | the object still match it it has other tags not listed in the filter.                |          |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``S3Key.FilterRule``          | Container | Holding ``Name`` and ``Value`` entities. ``Name`` would  be: ``prefix``, ``suffix``  | Yes      |
|                               |           | or ``regex``. The ``Value`` would hold the key prefix, key suffix or a regular       |          |
|                               |           | expression for matching the key, accordingly.                                        |          |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``S3Metadata.FilterRule``     | Container | Holding ``Name`` and ``Value`` entities. ``Name`` would be the name of the metadata  | Yes      |
|                               |           | attribute (e.g. ``x-amz-meta-xxx``). The ``Value`` would be the expected value for   |          | 
|                               |           | this attribute.                                                                      |          |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``S3Tags.FilterRule``         | Container | Holding ``Name`` and ``Value`` entities. ``Name`` would be the tag key,              |  Yes     |
|                               |           | and ``Value`` would be the tag value.                                                |          | 
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+


HTTP Response
~~~~~~~~~~~~~

+---------------+-----------------------+----------------------------------------------------------+
| HTTP Status   | Status Code           | Description                                              |
+===============+=======================+==========================================================+
| ``400``       | MalformedXML          | The XML is not well-formed                               |
+---------------+-----------------------+----------------------------------------------------------+
| ``400``       | InvalidArgument       | Missing Id; Missing/Invalid Topic ARN; Invalid Event     |
+---------------+-----------------------+----------------------------------------------------------+
| ``404``       | NoSuchBucket          | The bucket does not exist                                |
+---------------+-----------------------+----------------------------------------------------------+
| ``404``       | NoSuchKey             | The topic does not exist                                 |
+---------------+-----------------------+----------------------------------------------------------+


Delete Notification
-------------------

Delete a specific, or all, notifications from a bucket.

.. note:: 

    - Notification deletion is an extension to the S3 notification API
    - When the bucket is deleted, any notification defined on it is also deleted 
    - Deleting an unknown notification (e.g. double delete) is not considered an error

Syntax
~~~~~~

::

    DELETE /bucket?notification[=<notification-id>] HTTP/1.1


Parameters
~~~~~~~~~~

+------------------------+-----------+----------------------------------------------------------------------------------------+
| Name                   | Type      | Description                                                                            |
+========================+===========+========================================================================================+
| ``notification-id``    | String    | Name of the notification. If not provided, all notifications on the bucket are deleted |
+------------------------+-----------+----------------------------------------------------------------------------------------+

HTTP Response
~~~~~~~~~~~~~

+---------------+-----------------------+----------------------------------------------------------+
| HTTP Status   | Status Code           | Description                                              |
+===============+=======================+==========================================================+
| ``404``       | NoSuchBucket          | The bucket does not exist                                |
+---------------+-----------------------+----------------------------------------------------------+

Get/List Notification
---------------------

Get a specific notification, or list all notifications configured on a bucket.

Syntax
~~~~~~

::

    GET /bucket?notification[=<notification-id>] HTTP/1.1 


Parameters
~~~~~~~~~~

+------------------------+-----------+----------------------------------------------------------------------------------------+
| Name                   | Type      | Description                                                                            |
+========================+===========+========================================================================================+
| ``notification-id``    | String    | Name of the notification. If not provided, all notifications on the bucket are listed  |
+------------------------+-----------+----------------------------------------------------------------------------------------+

Response Entities
~~~~~~~~~~~~~~~~~

Response is XML encoded in the body of the request, in the following format:

::

   <NotificationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
       <TopicConfiguration>
           <Id></Id>
           <Topic></Topic>
           <Event></Event>
           <Filter>
               <S3Key>
                   <FilterRule>
                       <Name></Name>
                       <Value></Value>
                   </FilterRule>
        	    </S3Key>
                <S3Metadata>
                    <FilterRule>
                        <Name></Name>
                        <Value></Value>
                    </FilterRule>
                </S3Metadata>
                <S3Tags>
                    <FilterRule>
                        <Name></Name>
                        <Value></Value>
                    </FilterRule>
                </S3Tags>
            </Filter>
       </TopicConfiguration>
   </NotificationConfiguration>

+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| Name                          | Type      | Description                                                                          | Required |
+===============================+===========+======================================================================================+==========+
| ``NotificationConfiguration`` | Container | Holding list of ``TopicConfiguration`` entities                                      | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``TopicConfiguration``        | Container | Holding ``Id``, ``Topic`` and list of ``Event`` entities                             | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``Id``                        | String    | Name of the notification                                                             | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``Topic``                     | String    | Topic ARN                                                                            | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``Event``                     | String    | Handled event. Multiple ``Event`` entities may exist                                 | Yes      |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+
| ``Filter``                    | Container | Holding the filters configured for this notification                                 | No       |
+-------------------------------+-----------+--------------------------------------------------------------------------------------+----------+

HTTP Response
~~~~~~~~~~~~~

+---------------+-----------------------+----------------------------------------------------------+
| HTTP Status   | Status Code           | Description                                              |
+===============+=======================+==========================================================+
| ``404``       | NoSuchBucket          | The bucket does not exist                                |
+---------------+-----------------------+----------------------------------------------------------+
| ``404``       | NoSuchKey             | The notification does not exist (if provided)            |
+---------------+-----------------------+----------------------------------------------------------+

.. _S3 Notification Compatibility: ../../s3-notification-compatibility