Creates a lifecycle policy.

Usage notes

  • You can create lifecycle policies only for General-purpose NAS file systems.
  • You can create up to 20 lifecycle policies in one region within an Alibaba Cloud account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateLifecyclePolicy

The operation that you want to perform.

Set the value to CreateLifecyclePolicy.

FileSystemId String Yes 31a8e4****

The ID of the file system.

LifecyclePolicyName String Yes lifecyclepolicy_01

The name of the lifecycle policy.

The name must be 3 to 64 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.

Path String No /pathway/to/folder

The absolute path of the directory that is associated with the lifecycle policy.

If you specify this parameter, you can associate the lifecycle policy with only one directory. The path must start with a forward slash (/) and must be a path that exists in the mount target.

Note We recommend that you specify the Paths.N parameter so that you can associate the lifecycle policy with multiple directories.
LifecycleRuleName String Yes DEFAULT_ATIME_14

The management rule that is associated with the lifecycle policy.

Valid values:

  • DEFAULT_ATIME_14: Files that are not accessed in the last 14 days are dumped to the IA storage medium.
  • DEFAULT_ATIME_30: Files that are not accessed in the last 30 days are dumped to the IA storage medium.
  • DEFAULT_ATIME_60: Files that are not accessed in the last 60 days are dumped to the IA storage medium.
  • DEFAULT_ATIME_90: Files that are not accessed in the last 90 days are dumped to the IA storage medium.
StorageType String Yes InfrequentAccess

The storage type of the data that is dumped to the IA storage medium.

Default value: InfrequentAccess (IA).

Paths.N String No "/path1", "/path2""

The absolute path of the directory that is associated with the lifecycle policy.

If you specify this parameter, you can associate the lifecycle policy with multiple directories. Each path must start with a forward slash (/) and must be a path that exists in the mount target. Valid values of N: 1 to 10.

Response parameters

Parameter Type Example Description
RequestId String BC7C825C-5F65-4B56-BEF6-98C56C7C****

The request ID.

Success Boolean true

Indicates whether the request was successful.

Valid values:

  • true
  • false

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateLifecyclePolicy
&FileSystemId=31a8e4****
&LifecyclePolicyName=lifecyclepolicy_01
&LifecycleRuleName=DEFAULT_ATIME_14
&StorageType=InfrequentAccess
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<RequestId>BC7C825C-5F65-4B56-BEF6-98C56C7C****</RequestId>
<Success>true</Success>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "BC7C825C-5F65-4B56-BEF6-98C56C7C****",
  "Success" : true
}

Error codes

HTTP status code Error code Error message Description
400 OperationDenied.FileSystemNotSupportedForLifecycle The file system does not support lifecycle. The specified file system does not support lifecycle management.
400 OperationDenied.EncryptedFileSystemNotSupportedForLifecycle The encrypted file system does not support lifecycle. An encrypted file system does not support lifecycle management.
400 OperationDenied.LifecyclePolicyCountLimitExceeded The maximum number of LifecyclePolicies is exceeded. The upper limit for lifecycle policies is reached.
400 InvalidLifecyclePolicy.AlreadyExist The specified LifecyclePolicy already exists. The specified lifecycle policy already exists.
400 InvalidParameter.PathsNumberExceed The maximum number of Path.N for this operation is 10. One lifecycle policy cannot be associated with more than 10 paths.
400 InvalidFilesystemType.NotSupport The API operation does not support the file system type. The operation does not support the specified type of file system.
400 InvalidParameter.PathOrPaths Either Path or Paths.N must be specified. Only one of the Path and Paths.N parameters can be specified.
403 OperationDenied.NotSupportPaths.N Your request does not meet the gray condition. The Paths.N parameter is not supported. The request does not meet the canary release policy and the Paths.N parameter is not supported.
404 InvalidFileSystem.NotFound The specified file system does not exist. The specified file system does not exist.
404 InvalidParameter.PathNotExist The specified path does not exist. The specified path does not exist.

For a list of error codes, see Service error codes.