Skip to main content
POST
/
cloud
/
v1
/
lifecycle_policy
/
{project_id}
/
{region_id}
Create snapshot policy
curl --request POST \
  --url https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "action": "volume_snapshot",
  "name": "<string>",
  "schedules": [],
  "status": "active",
  "volume_ids": []
}
'
{
  "action": "<string>",
  "id": 123,
  "name": "<string>",
  "project_id": 123,
  "region_id": 123,
  "schedules": [
    {
      "id": "<string>",
      "max_quantity": 123,
      "owner": "<string>",
      "owner_id": 123,
      "retention_time": {
        "days": 0,
        "hours": 2,
        "minutes": 1,
        "weeks": 0
      },
      "type": "<string>",
      "user_id": 123,
      "day": "5",
      "day_of_week": "mon,fri",
      "hour": "0, 20",
      "minute": "30",
      "month": "1,6",
      "resource_name_template": "reserve snap of the volume {volume_id}",
      "timezone": "UTC",
      "week": "1"
    }
  ],
  "status": "active",
  "user_id": 123,
  "volumes": [
    {
      "volume_id": "<string>",
      "volume_name": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

project_id
integer
required

Project ID

region_id
integer
required

Region ID

Body

application/json
action
enum<string>
required

Action that the policy will perform.

Available options:
volume_snapshot
name
string
required

Name of the lifecycle policy.

schedules
(CreateCronScheduleSerializer · object | CreateIntervalScheduleSerializer · object)[]

List of schedules associated with the policy.

Maximum array length: 10

List of schedules associated with the policy. If the schedule made 'max_quantity' snapshots, a new snapshot will be created in time, but the oldest from the schedules snapshots will be deleted. If 'retention_time' was set and the schedules snapshots will be delete after the specified period of time. In resource_name_template you can use such forms that will then be automatically filled in with values: '{volume_id}', '{schedule_id}', '{lifecycle_policy_id}', '{datetime_utc}', '{local_datetime}'.

  • CreateCronScheduleSerializer
  • CreateIntervalScheduleSerializer
status
enum<string>
default:active

Current status of the lifecycle policy.

Available options:
active,
paused
volume_ids
string<uuid4>[]

List of volume IDs.

Response

200 - application/json

OK

action
string
required

Action associated with the lifecycle policy.

id
integer
required

Unique identifier for the policy.

name
string
required

Name of the policy.

project_id
integer
required

Project ID associated with the policy.

region_id
integer
required

Region ID where the policy is applied.

schedules
(GetCronScheduleSerializer · object | GetIntervalScheduleSerializer · object)[]
required

List of schedules within the policy.

  • GetCronScheduleSerializer
  • GetIntervalScheduleSerializer
status
enum<string>
required

Status of the lifecycle policy.

Available options:
active,
paused
user_id
integer
required

User ID of the creator of the policy.

volumes
VolumeDataForLifecyclePolicySerializer · object[]
required

Data of volumes that should be reserved. Displayed only when the query parameter is specified.