updateLifecyclePolicy method

Future<void> updateLifecyclePolicy({
  1. required String policyId,
  2. String? description,
  3. String? executionRoleArn,
  4. PolicyDetails? policyDetails,
  5. SettablePolicyStateValues? state,
})

Updates the specified lifecycle policy.

May throw ResourceNotFoundException. May throw InvalidRequestException. May throw InternalServerException. May throw LimitExceededException.

Parameter policyId : The identifier of the lifecycle policy.

Parameter description : A description of the lifecycle policy.

Parameter executionRoleArn : The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.

Parameter policyDetails : The configuration of the lifecycle policy. You cannot update the policy type or the resource type.

Parameter state : The desired activation state of the lifecycle policy after creation.

Implementation

Future<void> updateLifecyclePolicy({
  required String policyId,
  String? description,
  String? executionRoleArn,
  PolicyDetails? policyDetails,
  SettablePolicyStateValues? state,
}) async {
  ArgumentError.checkNotNull(policyId, 'policyId');
  _s.validateStringLength(
    'policyId',
    policyId,
    0,
    64,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    500,
  );
  _s.validateStringLength(
    'executionRoleArn',
    executionRoleArn,
    0,
    2048,
  );
  final $payload = <String, dynamic>{
    if (description != null) 'Description': description,
    if (executionRoleArn != null) 'ExecutionRoleArn': executionRoleArn,
    if (policyDetails != null) 'PolicyDetails': policyDetails,
    if (state != null) 'State': state.toValue(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/policies/${Uri.encodeComponent(policyId)}',
    exceptionFnMap: _exceptionFns,
  );
}