List
Retrieves the list of lifecycle policies in the specified repository.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListLifecyclePoliciesRequest =
cloudApi.containerregistry.lifecycle_policy_service
.ListLifecyclePoliciesRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.LifecyclePolicyServiceClient);
const result = await client.list(
ListLifecyclePoliciesRequest.fromPartial({
// registryId: "registryId",
// repositoryId: "repositoryId",
// pageSize: 0,
// pageToken: "pageToken",
// filter: "filter",
// orderBy: "orderBy"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.containerregistry.v1.lifecycle_policy_service_pb2_grpc import (
LifecyclePolicyServiceStub,
)
from yandex.cloud.containerregistry.v1.lifecycle_policy_service_pb2 import (
ListLifecyclePoliciesRequest,
)
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(LifecyclePolicyServiceStub)
response = service.List(
ListLifecyclePoliciesRequest(
# registry_id = "registryId",
# repository_id = "repositoryId",
# page_size = 0,
# page_token = "pageToken",
# filter = "filter",
# order_by = "orderBy"
)
)
print(response)
ListLifecyclePoliciesRequest
One of id
registryId
: stringID of the lifecycle policy.
repositoryId
: stringRepository of the lifecycle policy.
pageSize
: int64
The maximum number of results per page to return. If the number of available
results is larger than page_size
, the service returns
a ListLifecyclePoliciesResponse.next_page_token that can be used to get the next page of results in subsequent list requests.
Default value: 100.
pageToken
: string
Page token. To get the next page of results, set page_token
to the
ListLifecyclePoliciesResponse.next_page_token returned by a previous list request.
filter
: string
A filter expression that filters lifecycle policy resources listed in the response.
The expression must specify:
- The field name. Currently you can use filtering only on LifecyclePolicy.name field.
- An
=
operator. - The value in double quotes (
"
). Must be 3-63 characters long and match the regular expression[a-z][-a-z0-9]{1,61}[a-z0-9]
.
orderBy
: string
Sorting the list by LifecyclePolicy.name, LifecyclePolicy.created_at and LifecyclePolicy.status fields. The default sorting order is ascending.
ListLifecyclePoliciesResponse
lifecyclePolicies
: LifecyclePolicy
List of lifecycle policies.
nextPageToken
: string
Token for getting the next page of the list. If the number of results is greater than
the specified ListLifecyclePoliciesRequest.page_size, use next_page_token
as the value
for the ListLifecyclePoliciesRequest.page_token parameter in the next list request.
Each subsequent page will have its own next_page_token
to continue paging through the results.
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.