curl --request POST \
--url https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "volume_snapshot",
"name": "schedule_1",
"schedules": [],
"status": "active",
"volume_ids": [
"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f"
]
}
'import requests
url = "https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage"
payload = {
"action": "volume_snapshot",
"name": "schedule_1",
"schedules": [],
"status": "active",
"volume_ids": ["3ed9e2ce-f906-47fb-ba32-c25a3f63df4f"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'volume_snapshot',
name: 'schedule_1',
schedules: [],
status: 'active',
volume_ids: ['3ed9e2ce-f906-47fb-ba32-c25a3f63df4f']
})
};
fetch('https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'volume_snapshot',
'name' => 'schedule_1',
'schedules' => [
],
'status' => 'active',
'volume_ids' => [
'3ed9e2ce-f906-47fb-ba32-c25a3f63df4f'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage"
payload := strings.NewReader("{\n \"action\": \"volume_snapshot\",\n \"name\": \"schedule_1\",\n \"schedules\": [],\n \"status\": \"active\",\n \"volume_ids\": [\n \"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"volume_snapshot\",\n \"name\": \"schedule_1\",\n \"schedules\": [],\n \"status\": \"active\",\n \"volume_ids\": [\n \"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"volume_snapshot\",\n \"name\": \"schedule_1\",\n \"schedules\": [],\n \"status\": \"active\",\n \"volume_ids\": [\n \"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"max_cost": {
"currency_code": "USD",
"discount_percent": 0.16,
"price_per_hour": 1,
"price_per_month": 720,
"price_status": "show",
"price_without_discount_per_month": 604.8,
"tax_percent": 17
},
"max_volume_snapshot_count_usage": 2,
"max_volume_snapshot_sequence_length": 2,
"max_volume_snapshot_size_usage": 20
}Check snapshot policy quota
Calculate the maximum resource usage if all snapshots are created by the policy.
curl --request POST \
--url https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "volume_snapshot",
"name": "schedule_1",
"schedules": [],
"status": "active",
"volume_ids": [
"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f"
]
}
'import requests
url = "https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage"
payload = {
"action": "volume_snapshot",
"name": "schedule_1",
"schedules": [],
"status": "active",
"volume_ids": ["3ed9e2ce-f906-47fb-ba32-c25a3f63df4f"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'volume_snapshot',
name: 'schedule_1',
schedules: [],
status: 'active',
volume_ids: ['3ed9e2ce-f906-47fb-ba32-c25a3f63df4f']
})
};
fetch('https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'volume_snapshot',
'name' => 'schedule_1',
'schedules' => [
],
'status' => 'active',
'volume_ids' => [
'3ed9e2ce-f906-47fb-ba32-c25a3f63df4f'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage"
payload := strings.NewReader("{\n \"action\": \"volume_snapshot\",\n \"name\": \"schedule_1\",\n \"schedules\": [],\n \"status\": \"active\",\n \"volume_ids\": [\n \"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"volume_snapshot\",\n \"name\": \"schedule_1\",\n \"schedules\": [],\n \"status\": \"active\",\n \"volume_ids\": [\n \"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/lifecycle_policy/{project_id}/{region_id}/estimate_max_policy_usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"volume_snapshot\",\n \"name\": \"schedule_1\",\n \"schedules\": [],\n \"status\": \"active\",\n \"volume_ids\": [\n \"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"max_cost": {
"currency_code": "USD",
"discount_percent": 0.16,
"price_per_hour": 1,
"price_per_month": 720,
"price_status": "show",
"price_without_discount_per_month": 604.8,
"tax_percent": 17
},
"max_volume_snapshot_count_usage": 2,
"max_volume_snapshot_sequence_length": 2,
"max_volume_snapshot_size_usage": 20
}Authorizations
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
1
Region ID
1
Body
Action that the policy will perform.
volume_snapshot "volume_snapshot"
Name of the lifecycle policy.
"schedule_1"
List of schedules associated with the policy.
10List 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
Show child attributes
Show child attributes
{
"day_of_week": "fri",
"hour": "0, 20",
"max_quantity": 2,
"minute": "30",
"resource_name_template": "snapshot of volume {volume_id}",
"timezone": "UTC",
"type": "cron"
}
Current status of the lifecycle policy.
active, paused "active"
List of volume IDs.
["3ed9e2ce-f906-47fb-ba32-c25a3f63df4f"]
Response
OK
Total billed cost of all snapshots that can be created by the schedule. Cost of max_volume_snapshot_count_usage snapshots.
Show child attributes
Show child attributes
{
"currency_code": "USD",
"price_per_hour": 0.01,
"price_per_month": 7.2,
"price_status": "show"
}
Count of snapshots that can be created if the schedule creates the maximum possible number of snapshots.
2
Maximum volume snapshot sequence length.
2
The amount of memory in GiB that snapshots will take up if the schedule creates the maximum possible number of them.
20
Was this page helpful?