Get
Returns the specified lifecycle policy.
To get the list of all available lifecycle policies, make a List request.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const GetLifecyclePolicyRequest =
cloudApi.containerregistry.lifecycle_policy_service.GetLifecyclePolicyRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.LifecyclePolicyServiceClient);
const result = await client.get(
GetLifecyclePolicyRequest.fromPartial({
lifecyclePolicyId: "lifecyclePolicyId",
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.containerregistry.v1.lifecycle_policy_service_pb2 import GetLifecyclePolicyRequest
from yandex.cloud.containerregistry.v1.lifecycle_policy_service_pb2_grpc import (
LifecyclePolicyServiceStub,
)
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(LifecyclePolicyServiceStub)
response = service.Get(GetLifecyclePolicyRequest(lifecycle_policy_id="lifecyclePolicyId"))
print(response)
GetLifecyclePolicyRequest
lifecyclePolicyId
: string
ID of the lifecycle policy.
LifecyclePolicy
Status
STATUS_UNSPECIFIED
ACTIVE
Policy is active and regularly deletes Docker images according to the established rules.
DISABLED
Policy is disabled and does not delete Docker images in the repository. Policies in this status can be used for preparing and testing rules.
id
: string
ID of the lifecycle policy.
name
: string
Name of the lifecycle policy.
repositoryId
: string
ID of the repository that the lifecycle policy belongs to. Required. The maximum string length in characters is 50.
description
: string
Description of the lifecycle policy. The maximum string length in characters is 256.
status
: Status
Status of lifecycle policy.
createdAt
: google.protobuf.Timestamp
Creation timestamp.
rules
: LifecycleRule
The rules of lifecycle policy.
LifecycleRule
description
: string
Description of the lifecycle policy rule.
expirePeriod
: google.protobuf.Duration
Period of time for automatic deletion. Period must be a multiple of 24 hours.
tagRegexp
: string
Tag for specifying a filter in the form of a regular expression.
untagged
: bool
Tag for applying the rule to Docker images without tags.
retainedTop
: int64
Number of Docker images (falling under the specified filter by tags) that must be left, even if the expire_period has already expired.