List
Retrieves the list of snapshot schedules in the specified folder.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListSnapshotSchedulesRequest =
cloudApi.compute.snapshot_schedule_service.ListSnapshotSchedulesRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.SnapshotScheduleServiceClient);
const result = await client.list(
ListSnapshotSchedulesRequest.fromPartial({
folderId: "folderId",
// pageSize: 0,
// pageToken: "pageToken",
// filter: "filter",
// orderBy: "orderBy"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.compute.v1.snapshot_schedule_service_pb2 import ListSnapshotSchedulesRequest
from yandex.cloud.compute.v1.snapshot_schedule_service_pb2_grpc import SnapshotScheduleServiceStub
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(SnapshotScheduleServiceStub)
response = service.List(
ListSnapshotSchedulesRequest(
folder_id="folderId",
# page_size = 0,
# page_token = "pageToken",
# filter = "filter",
# order_by = "orderBy"
)
)
print(response)
ListSnapshotSchedulesRequest
folderId : string
ID of the folder to list snapshot schedules in.
To get the folder ID, make a yandex.cloud.resourcemanager.v1.FolderService.List request.
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 ListSnapshotSchedulesResponse.next_page_token
that can be used to get the next page of results in subsequent list requests.
pageToken : string
Page token. To get the next page of results, set page_token to the
ListSnapshotSchedulesResponse.next_page_token returned by a previous list request.
filter : string
A filter expression that filters snapshot schedules listed in the response.
The expression must specify:
- The field name. Currently you can use filtering only on SnapshotSchedule.name field.
- An operator. Can be either
=or!=for single values,INorNOT INfor lists of values. - The value. Must be 3-63 characters long and match the regular expression
^[a-z][-a-z0-9]{1,61}[a-z0-9]. Example of a filter:name=my-schedule.
orderBy : string
A sorting expression that sorts snapshot schedules listed in the response.
The expression must specify the field name from SnapshotSchedule and ascending or descending order,
e.g. createdAt desc.
Default value: id asc.
ListSnapshotSchedulesResponse
snapshotSchedules : SnapshotSchedule
List of snapshot schedules in the specified folder.
nextPageToken : string
Token for getting the next page of the list. If the number of results is greater than
the specified ListSnapshotSchedulesRequest.page_size, use next_page_token as the value
for the ListSnapshotSchedulesRequest.page_token parameter in the next list request.
Each subsequent page will have its own next_page_token to continue paging through the results.
SnapshotSchedule
A snapshot schedule. For details about the concept, see documentation.
Status
STATUS_UNSPECIFIEDCREATINGThe snapshot schedule is being created.
ACTIVEThe snapshot schedule is on: new disk snapshots will be created, old ones deleted (if [SnapshotSchedule.retention_policy][8] is specified).
INACTIVEThe schedule is interrupted, snapshots won't be created or deleted.
DELETINGThe schedule is being deleted.
UPDATINGChanges are being made to snapshot schedule settings or a list of attached disks.
id : string
ID of the snapshot schedule.
folderId : string
ID of the folder that the snapshot schedule belongs to.
createdAt : google.protobuf.Timestamp
Creation timestamp.
name : string
Name of the snapshot schedule.
The name is unique within the folder.
description : string
Description of the snapshot schedule.
labels : string
Snapshot schedule labels as key:value pairs.
status : Status
Status of the snapshot schedule.
schedulePolicy : SchedulePolicy
Frequency settings of the snapshot schedule.
One of retentionPolicy
Retention policy of the snapshot schedule.
retentionPeriod: google.protobuf.DurationRetention period of the snapshot schedule. Once a snapshot created by the schedule reaches this age, it isautomatically deleted.
snapshotCount: int64Retention count of the snapshot schedule. Once the number of snapshots created by the schedule exceeds thisnumber, the oldest ones are automatically deleted. E.g. if the number is 5, the first snapshot is deleted after the sixth one is created, the second is deleted after the seventh one is created, and so on.
snapshotSpec : SnapshotSpec
Attributes of snapshots created by the snapshot schedule.
SchedulePolicy
A resource for frequency settings of a snapshot schedule.
startAt : google.protobuf.Timestamp
Timestamp for creating the first snapshot.
expression : string
Cron expression for the snapshot schedule (UTC+0).
The expression must consist of five fields (Minutes Hours Day-of-month Month Day-of-week) or be one of
nonstandard predefined expressions (e.g. @hourly). For details about the format,
see documentation
SnapshotSpec
A resource for attributes of snapshots created by the snapshot schedule.
description : string
Description of the created snapshot.
labels : string
Snapshot labels as key:value pairs.