putLifecycleConfiguration method

Future<LifecycleConfigurationDescription> putLifecycleConfiguration({
  1. required String fileSystemId,
  2. required List<LifecyclePolicy> lifecyclePolicies,
})

Use this action to manage storage for your file system. A LifecycleConfiguration consists of one or more LifecyclePolicy objects that define the following:

  • TransitionToIA – When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage.
  • TransitionToArchive – When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.

    File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.

  • TransitionToPrimaryStorageClass – Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.
For more information, see Managing file system storage.

Each Amazon EFS file system supports one lifecycle configuration, which applies to all files in the file system. If a LifecycleConfiguration object already exists for the specified file system, a PutLifecycleConfiguration call modifies the existing configuration. A PutLifecycleConfiguration call with an empty LifecyclePolicies array in the request body deletes any existing LifecycleConfiguration. In the request, specify the following:

  • The ID for the file system for which you are enabling, disabling, or modifying lifecycle management.
  • A LifecyclePolicies array of LifecyclePolicy objects that define when to move files to IA storage, to Archive storage, and back to primary storage.
This operation requires permissions for the elasticfilesystem:PutLifecycleConfiguration operation.

To apply a LifecycleConfiguration object to an encrypted file system, you need the same Key Management Service permissions as when you created the encrypted file system.

May throw BadRequest. May throw FileSystemNotFound. May throw IncorrectFileSystemLifeCycleState. May throw InternalServerError.

Parameter fileSystemId : The ID of the file system for which you are creating the LifecycleConfiguration object (String).

Parameter lifecyclePolicies : An array of LifecyclePolicy objects that define the file system's LifecycleConfiguration object. A LifecycleConfiguration object informs lifecycle management of the following:

  • TransitionToIA – When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage.
  • TransitionToArchive – When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.

    File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.

  • TransitionToPrimaryStorageClass – Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.

Implementation

Future<LifecycleConfigurationDescription> putLifecycleConfiguration({
  required String fileSystemId,
  required List<LifecyclePolicy> lifecyclePolicies,
}) async {
  final $payload = <String, dynamic>{
    'LifecyclePolicies': lifecyclePolicies,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/2015-02-01/file-systems/${Uri.encodeComponent(fileSystemId)}/lifecycle-configuration',
    exceptionFnMap: _exceptionFns,
  );
  return LifecycleConfigurationDescription.fromJson(response);
}