startLifecyclePolicyPreview method

Future<StartLifecyclePolicyPreviewResponse> startLifecyclePolicyPreview({
  1. required String repositoryName,
  2. String? lifecyclePolicyText,
  3. String? registryId,
})

Starts a preview of a lifecycle policy for the specified repository. This allows you to see the results before associating the lifecycle policy with the repository.

May throw ServerException. May throw InvalidParameterException. May throw RepositoryNotFoundException. May throw LifecyclePolicyNotFoundException. May throw LifecyclePolicyPreviewInProgressException.

Parameter repositoryName : The name of the repository to be evaluated.

Parameter lifecyclePolicyText : The policy to be evaluated against. If you do not specify a policy, the current policy for the repository is used.

Parameter registryId : The AWS account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed.

Implementation

Future<StartLifecyclePolicyPreviewResponse> startLifecyclePolicyPreview({
  required String repositoryName,
  String? lifecyclePolicyText,
  String? registryId,
}) async {
  ArgumentError.checkNotNull(repositoryName, 'repositoryName');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    2,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'lifecyclePolicyText',
    lifecyclePolicyText,
    100,
    30720,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AmazonEC2ContainerRegistry_V20150921.StartLifecyclePolicyPreview'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'repositoryName': repositoryName,
      if (lifecyclePolicyText != null)
        'lifecyclePolicyText': lifecyclePolicyText,
      if (registryId != null) 'registryId': registryId,
    },
  );

  return StartLifecyclePolicyPreviewResponse.fromJson(jsonResponse.body);
}