lifecycle_policy#
State module for managing Elastic Container Registry (Amazon ECR) Lifecycle Policy.
- async idem_aws.states.aws.ecr.lifecycle_policy.present(hub, ctx, name: str, repository_name: str, lifecycle_policy_text: Dict, resource_id: str = None, registry_id: str = None) Dict[str, Any] [source]#
Creates or updates the lifecycle policy for the specified repository. For more information, see Lifecycle policy template.
- Parameters:
name (str) – An Idem name of the resource.
resource_id (str, Optional) – An identifier of the resource in the provider. Defaults to None.
registry_id (str, Optional) – 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. Defaults to None.
repository_name (str) – The name of the repository to receive the policy.
lifecycle_policy_text (dict or str) – The JSON repository policy text to apply to the repository.
- Request Syntax:
[stream-name]: aws.ecr.lifecycle_policy.present: - name: "string" - repository_name: "string" - resource_id: "string" - registry_id: "string" - lifecycle_policy_text: "string"
- Returns:
Dict[str, Any]
Examples
resource_is_present: aws.ecr.lifecycle_policy.present: - name: idem_test_lifecycle_policy - repository_name: idem_test_ecr_repository - lifecycle_policy_text: value
- async idem_aws.states.aws.ecr.lifecycle_policy.absent(hub, ctx, name: str, repository_name: str = None, resource_id: str = None, registry_id: str = None) Dict[str, Any] [source]#
Deletes the lifecycle policy associated with the specified repository.
- Parameters:
name (str) – An Idem name of the resource.
repository_name (str, Optional) – The name of the ECR repository in Amazon Web Services that contains the policy to delete.
resource_id (str, Optional) –
The registry id and repository name with a separator ‘-’. Format:
[registry_id]-[repository_name]
.Warning
Idem automatically considers this resource being absent if this field is not specified.
registry_id (str, Optional) – 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. Defaults to None.
- Request Syntax:
[lifecycle_policy-name]: aws.ecr.lifecycle_policy.absent: - name: 'string' - repository_name: 'string' - resource_id: 'string' - registry_id: 'string'
- Returns:
Dict[str, Any]
Examples
resource_is_absent: aws.ecr.lifecycle_policy.absent: - name: idem_test_policy - repository_name: idem_test_repository - resource_id: idem_test_ecr_registry-idem_test_ecr_repository - registry_id: idem_test_registry
- async idem_aws.states.aws.ecr.lifecycle_policy.describe(hub, ctx) Dict[str, Dict[str, Any]] [source]#
Pass required params to get an Amazon Elastic Container Registry (Amazon ECR) Lifecycle Policy resource.
Describe the resource in a way that can be recreated/managed with the corresponding “present” function. To describe all the repository policies, we first need to list all the repositories, and then we get the policy associated to each repository
- Returns:
Dict[str, Any]
Examples
$ idem describe aws.ecr.lifecycle_policy