Skip to main content
REST API reference

Create the S3 bucket lifecycle rule configuration

POST /protocols/s3/services/{svm.uuid}/buckets/{s3_bucket.uuid}/rules

Introduced In: 9.13

Creates the S3 bucket lifecycle rule configuration.

Required properties

  • name - Lifecycle Management rule to be created.

  • actions - Lifecycle Management actions associated with the rule.

  • enabled - Lifecycle Management rule is enabled or not.

  • object_filter.prefix - Lifecycle Management rule filter prefix.

  • object_filter.tags - Lifecycle Management rule filter tags.

  • object_filter.size_greater_than - Lifecycle Management rule filter minimum object size.

  • object_filter.size_less_than - Lifecycle Management rule filter maximum object size.

  • object_age_days - Number of days since creation after which objects can be deleted.

  • object_expiry_date - Specific date from when objects can expire.

  • expired_object_delete_marker - Cleanup object delete markers.

  • new_non_current_versions - Number of latest non-current versions to be retained.

  • non_current_days - Number of days after which non-current versions can be deleted.

  • after_initiation_days - Number of days of initiation after which uploads can be aborted.

  • vserver object-store-server bucket lifecycle-management-rule create

Parameters

Name Type In Required Description

s3_bucket.uuid

string

path

True

Unique identifier of a bucket.

return_timeout

integer

query

False

The number of seconds to allow the call to execute before returning. When doing a POST, PATCH, or DELETE operation on a single record, the default is 0 seconds. This means that if an asynchronous operation is started, the server immediately returns HTTP code 202 (Accepted) along with a link to the job. If a non-zero value is specified for POST, PATCH, or DELETE operations, ONTAP waits that length of time to see if the job completes so it can return something other than 202.

  • Default value: 1

  • Max value: 120

  • Min value: 0

return_records

boolean

query

False

The default is false. If set to true, the records are returned.

  • Default value:

svm.uuid

string

path

True

UUID of the SVM to which this object belongs.

  • Introduced in: 9.14

Request Body

Name Type Description

abort_incomplete_multipart_upload

abort_incomplete_multipart_upload

Specifies a way to perform abort_incomplete_multipart_upload action on filtered objects within a bucket. It cannot be specified with tags.

bucket_name

string

Specifies the name of the bucket. Bucket name is a string that can only contain the following combination of ASCII-range alphanumeric characters 0-9, a-z, ".", and "-".

enabled

boolean

Specifies whether or not the associated rule is enabled.

expiration

expiration

Specifies a way to perform expiration action on filtered objects within a bucket.

name

string

Bucket lifecycle management rule identifier. The length of the name can range from 0 to 256 characters.

non_current_version_expiration

non_current_version_expiration

Specifies a way to perform non_current_version_expiration action on filtered objects within a bucket.

object_filter

object_filter

Specifies a way to filter objects within a bucket.

svm

svm

Specifies the name of the SVM where this bucket exists.

uuid

string

Specifies the unique identifier of the bucket.

Example request
{
  "bucket_name": "bucket1",
  "expiration": {
    "object_age_days": 100,
    "object_expiry_date": "2039-09-22 20:00:00 -0400"
  },
  "name": "string",
  "object_filter": {
    "prefix": "/logs",
    "size_greater_than": 10240,
    "size_less_than": 10485760,
    "tags": [
      "project1=projA",
      "project2=projB"
    ]
  },
  "svm": {
    "name": "svm1",
    "uuid": "02c9e252-41be-11e9-81d5-00a0986138f7"
  },
  "uuid": "414b29a1-3b26-11e9-bd58-0050568ea055"
}

Response

Status: 202, Accepted
Name Type Description

job

job_link

Example response
{
  "job": {
    "uuid": "string"
  }
}

Headers

Name Description Type

Location

Useful for tracking the resource location

string

Response

Status: 201, Created

Error

Status: Default

ONTAP Error Response Codes

Error code Message

92405861

"The specified SVM UUID or bucket UUID does not exist.";

92406111

"Lifecycle Management rule "rule1" for bucket "testbuck1" in SVM "vs0" is invalid because of the number of tags specified. The maximum number of tags supported is four.";

92406113

"Lifecycle Management rule for bucket in Vserver is invalid because there is a mismatch in one of the filter-field. Filters must be the same for a particular rule identifier.";

92406114

"The Expiration action requires specifying either object_expiry_date, object_age_days or expired_object_delete_marker.";

92406115

"The NonCurrentVersionExpiration action requires either new_non_current_versions or non_current_days.";

92406116

"The AbortIncompleteMultipartUpload action requires after_initiation_days.";

92406117

"The "Expiration" action cannot have both an expiry date and an age.";

92406118

"Using Lifecycle Management rules requires an effective cluster version of 9.13.1 .";

92406120

"The "AbortIncompleteMultipartUpload" action cannot be specified with tags.";

92406121

""expired_object_delete_marker" cannot be specified with "tags"."

92406122

""expired_object_delete_marker" cannot be specified with "object_age_days" or "object_expiry_date".";

92406123

"Expiration is supported on object store volumes only, bucket "testbuck-nas" on SVM "vs0" is not an object store volume.";

92406126

"Lifecycle Management rule "rule1" for bucket "testbuck1" in SVM "vs0" is invalid because specified tags contain one or more invalid characters. Valid characters for a tag are 0-9, A-Z, a-z, "+", "-", "=", ".", "_", ":", "/", "@", and " ". Each "=" character present in a tag key or value must be prefixed with the "" escape character.";

92406127

"Lifecycle Management rule "{rule}" for bucket "{bucket}" in SVM "{SVM}" is invalid because specified tag "key" length is greater than the maximum allowed length: 128.";

92406128

"Lifecycle Management rule "rule1" for bucket "testbuck1" in SVM "vs0" has tags with duplicate keys. Verify that each tag has a unique key and then try the operation again.";

92406129

"Lifecycle Management rule "rule1" for bucket "testbuck1" in SVM "vs0" has a prefix that is too long. The maximum length of the prefix is 1024 characters.";

92406130

"Lifecycle Management rule "rule1" for bucket "testbuck1" in SVM "vs0" is invalid because the minimum object size of 10485760 is larger than or equal to the maximum object size of 10240.";

92406131

"Lifecycle Management rule "testcheck2" for bucket "testbuck1" in SVM "vs0" cannot be created because "non_current_days" must be specified along with "new_non_current_versions".";

92406132

"Lifecycle Management rule "{rule}" for bucket "{bucket}" in SVM "{SVM}" requires "object_age_days" to be greater than zero.";

92406132

"Lifecycle Management rule "{rule}" for bucket "{bucket}" in SVM "{SVM}" requires "new_non_current_versions" to be greater than zero.";

92406132

"Lifecycle Management rule "{rule}" for bucket "{bucket}" in SVM "{SVM}" requires "after_initiation_days" to be greater than zero.";

92406133

"Lifecycle Management rule for bucket in Vserver is invalid. The object_expiry_date must be later than January 1, 1970.";

92406134

"Cannot exceed the max limit of 1000 Lifecycle Management rules per bucket.";

92406135

"MetroCluster is configured on cluster. Object Expiration is not supported in a MetroCluster configuration.";

92406136

"Lifecycle Management rule "rule1" for bucket "buck1" in SVM "vs0" is invalid. The "object_expiry_date" must be at midnight GMT.";

92406139

"Lifecycle Management rule for bucket in Vserver with action is a stale entry. Contact technical support for assistance.";

92406141

"Lifecycle Management rule "rule1" for bucket "buck1" in SVM "vs0" with action "Expiration" cannot have "expired_object_delete_marker" disabled. To disable "expired_object_delete_marker", run the "vserver object-store-server bucket lifecycle-management-rule delete" command.";

92406143

"As part of Bucket Lifecycle, cannot create fabriclink relationship on bucket "{bucket name}" in SVM "{SVM name}". Reason : {error}.";

92406144

"The "AbortIncompleteMultipartUpload" action cannot be specified with object size.";

92406150

""expired_object_delete_marker" cannot be specified with "size_less_than".";

92406148

"Lifecycle Management rule "rule1" for bucket "buck1" in SVM "vs0" cannot have "new_non_current_versions" more than 100.";

92406149

"Lifecycle Management rule "rule1" for bucket "buck1" in SVM "vs0" requires an action to be specified. Retry the operation after adding an action.";

Definitions

See Definitions

href

Name Type Description

href

string

abort_incomplete_multipart_upload

Specifies a way to perform abort_incomplete_multipart_upload action on filtered objects within a bucket. It cannot be specified with tags.

Name Type Description

after_initiation_days

integer

Number of days of initiation after which uploads can be aborted.

expiration

Specifies a way to perform expiration action on filtered objects within a bucket.

Name Type Description

expired_object_delete_marker

boolean

Cleanup object delete markers.

object_age_days

integer

Number of days since creation after which objects can be deleted. This cannot be used along with object_expiry_date.

object_expiry_date

string

Specific date from when objects can expire. This cannot be used with object_age_days.

non_current_version_expiration

Specifies a way to perform non_current_version_expiration action on filtered objects within a bucket.

Name Type Description

new_non_current_versions

integer

Number of latest non-current versions to be retained.

non_current_days

integer

Number of days after which non-current versions can be deleted.

object_filter

Specifies a way to filter objects within a bucket.

Name Type Description

prefix

string

A prefix that is matched against object-names within a bucket.

size_greater_than

integer

Size of the object greater than specified for which the corresponding lifecycle rule is to be applied.

size_less_than

integer

Size of the object smaller than specified for which the corresponding lifecycle rule is to be applied.

tags

array[string]

An array of key-value paired tags of the form or <tag=value>.

svm

Specifies the name of the SVM where this bucket exists.

Name Type Description

name

string

The name of the SVM. This field cannot be specified in a PATCH method.

uuid

string

The unique identifier of the SVM. This field cannot be specified in a PATCH method.

s3_bucket_lifecycle_rule

Information about the lifecycle management rule of a bucket.

Name Type Description

abort_incomplete_multipart_upload

abort_incomplete_multipart_upload

Specifies a way to perform abort_incomplete_multipart_upload action on filtered objects within a bucket. It cannot be specified with tags.

bucket_name

string

Specifies the name of the bucket. Bucket name is a string that can only contain the following combination of ASCII-range alphanumeric characters 0-9, a-z, ".", and "-".

enabled

boolean

Specifies whether or not the associated rule is enabled.

expiration

expiration

Specifies a way to perform expiration action on filtered objects within a bucket.

name

string

Bucket lifecycle management rule identifier. The length of the name can range from 0 to 256 characters.

non_current_version_expiration

non_current_version_expiration

Specifies a way to perform non_current_version_expiration action on filtered objects within a bucket.

object_filter

object_filter

Specifies a way to filter objects within a bucket.

svm

svm

Specifies the name of the SVM where this bucket exists.

uuid

string

Specifies the unique identifier of the bucket.

Name Type Description

uuid

string

The UUID of the asynchronous job that is triggered by a POST, PATCH, or DELETE operation.

error_arguments

Name Type Description

code

string

Argument code

message

string

Message argument

returned_error

Name Type Description

arguments

array[error_arguments]

Message arguments

code

string

Error code

message

string

Error message

target

string

The target parameter that caused the error.