lifecycle_policies
Creates, updates, deletes, gets or lists a lifecycle_policies resource.
Overview
| Name | lifecycle_policies |
| Type | Resource |
| Id | aws.ecr.lifecycle_policies |
Fields
The following fields are returned by SELECT queries:
- get_lifecycle_policy
| Name | Datatype | Description |
|---|---|---|
last_evaluated_at | string (date-time) | The time stamp of the last time that the lifecycle policy was run. |
lifecycle_policy_text | string | The JSON lifecycle policy text. |
registry_id | string | The registry ID associated with the request. (pattern: <code>[0-9]{12}</code>) |
repository_name | string | The repository name associated with the request. (pattern: <code>[a-z0-9]+((.||__|-+)[a-z0-9]+)*(/[a-z0-9]+((.||__|-+)[a-z0-9]+))</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_lifecycle_policy | select | region | Retrieves the lifecycle policy for the specified repository. | |
put_lifecycle_policy | replace | region, repositoryName, lifecyclePolicyText | Creates or updates the lifecycle policy for the specified repository. For more information, see Lifecycle policy template. | |
delete_lifecycle_policy | delete | region | Deletes the lifecycle policy associated with the specified repository. | |
start_lifecycle_policy_preview | exec | region, repositoryName | 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
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_lifecycle_policy
Retrieves the lifecycle policy for the specified repository.
SELECT
last_evaluated_at,
lifecycle_policy_text,
registry_id,
repository_name
FROM aws.ecr.lifecycle_policies
WHERE region = '{{ region }}' -- required
;
REPLACE examples
- put_lifecycle_policy
Creates or updates the lifecycle policy for the specified repository. For more information, see Lifecycle policy template.
REPLACE aws.ecr.lifecycle_policies
SET
registryId = '{{ registryId }}',
repositoryName = '{{ repositoryName }}',
lifecyclePolicyText = '{{ lifecyclePolicyText }}'
WHERE
region = '{{ region }}' --required
AND repositoryName = '{{ repositoryName }}' --required
AND lifecyclePolicyText = '{{ lifecyclePolicyText }}' --required
RETURNING
lifecycle_policy_text,
registry_id,
repository_name;
DELETE examples
- delete_lifecycle_policy
Deletes the lifecycle policy associated with the specified repository.
DELETE FROM aws.ecr.lifecycle_policies
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- start_lifecycle_policy_preview
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.
EXEC aws.ecr.lifecycle_policies.start_lifecycle_policy_preview
@region='{{ region }}' --required
@@json=
'{
"registryId": "{{ registryId }}",
"repositoryName": "{{ repositoryName }}",
"lifecyclePolicyText": "{{ lifecyclePolicyText }}"
}'
;