Skip to content

start_lifecycle_policy_preview

start_lifecycle_policy_preview(
    repository_name: RepositoryName,
    *,
    config_overrides: Optional[ECRClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
    lifecycle_policy_text: Optional[LifecyclePolicyText] = None,
) -> StartLifecyclePolicyPreviewResponse

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.

Parameters:

  • registry_id (Optional[RegistryId], default: None ) –

    The Amazon Web Services account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed.

  • repository_name (RepositoryName) –

    The name of the repository to be evaluated.

  • lifecycle_policy_text (Optional[LifecyclePolicyText], default: None ) –

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

Raises:

Source code in docs_src/capo_ecr/_services/ecr.py
def start_lifecycle_policy_preview(
    self,
    repository_name: "capo_ecr.types.repository_name.RepositoryName",
    *,
    config_overrides: Optional[ECRClientConfig] = None,
    registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
    lifecycle_policy_text: Optional[
        "capo_ecr.types.lifecycle_policy_text.LifecyclePolicyText"
    ] = None,
) -> "capo_ecr.types.start_lifecycle_policy_preview_response.StartLifecyclePolicyPreviewResponse":
    """<p>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.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed.</p>
        repository_name: <p>The name of the repository to be evaluated.</p>
        lifecycle_policy_text: <p>The policy to be evaluated against. If you do not specify a policy, the current policy for the repository is used.</p>

    Raises:
        capo_ecr.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
        capo_ecr.errors.lifecycle_policy_not_found_exception.LifecyclePolicyNotFoundException: <p>The lifecycle policy could not be found, and no policy is set to the repository.</p>
        capo_ecr.errors.lifecycle_policy_preview_in_progress_exception.LifecyclePolicyPreviewInProgressException: <p>The previous lifecycle policy preview request has not completed. Wait and try again.</p>
        capo_ecr.errors.repository_not_found_exception.RepositoryNotFoundException: <p>The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.</p>
        capo_ecr.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
        capo_ecr.errors.validation_exception.ValidationException: <p>There was an exception validating this request.</p>
        capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ecr.types.start_lifecycle_policy_preview_request.StartLifecyclePolicyPreviewRequest]",
    ) -> OperationResponse[
        "capo_ecr.types.start_lifecycle_policy_preview_response.StartLifecyclePolicyPreviewResponse"
    ]:
        import capo_ecr._operations.amazon_ec2_container_registry_v20150921.start_lifecycle_policy_preview

        output, http_response = (
            capo_ecr._operations.amazon_ec2_container_registry_v20150921.start_lifecycle_policy_preview.start_lifecycle_policy_preview(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartLifecyclePolicyPreview")
    )
    input_: capo_ecr.types.start_lifecycle_policy_preview_request.StartLifecyclePolicyPreviewRequest = {
        "repository_name": repository_name
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id
    if lifecycle_policy_text is not None:
        input_["lifecycle_policy_text"] = lifecycle_policy_text

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output