VK Cloud logo
Updated at April 15, 2024   08:50 AM

API usage examples

The following are some examples of using the VK Cloud Karboii API.

The requests will use:

  • endpoint:

    https://mcs.mail.ru/infra/karboii/v1
  • token:

    gBkZhRqVNHSuSAJBI6duyXXXX
  • virtual machine:

    +-----------------------------+-----------------------------------------------------------+| Field                       | Value                                                     |+-----------------------------+-----------------------------------------------------------+| id                          | 8f1ba150-XXXX-4ae4-9693-d18844b30d19                      || name                        | Example_CentOS_STD1-1                             || project_id                  | b5b7ffd4ef0547e5b222f44555dfXXXX                          || status                      | ACTIVE                                                    |+-----------------------------+-----------------------------------------------------------+

Get a list of created backup plans

Request example:

curl -X GET \-H "Accept: application/json" \-H "X-Auth-Token: gBkZhRqVNHSuSAJBI6duyXXXX" \https://mcs.mail.ru/infra/karboii/v1/${OS_PROJECT_ID}/plans

Create a new backup plan for the VM

1. Get the prodiver_id

Request example:

curl -X GET \    -H "Accept: application/json" \    -H "X-Auth-Token: gBkZhRqVNHSuSAJBI6duyXXXX" \    https://mcs.mail.ru/infra/karboii/v1/${OS_PROJECT_ID}/providers

2. Create a backup plan

Will be used prodiver_id = 37997f75-0637-XXXX-bf7e-49ff2ff11fa5, because a plan is being created for a virtual machine (not a DB instance).

Request example:

curl -X POST \    -H "Accept: application/json" \    -H "Content-type: application/json" \    -H "X-Auth-Token: gBkZhRqVNHSuSAJBI6duyXXXX" \    -d '{      "plan": {        "name": "example-plan",        "resources": [          {            "id": "8f1ba150-XXXX-4ae4-9693-d18844b30d19",            "type": "OS::Nova::Server",            "name": "Example_CentOS_STD1-1"          }        ],        "provider_id": "37997f75-0637-XXXX-bf7e-49ff2ff11fa5",        "full_day": null,        "retention_type": "max_backups"      }    }' \        https://mcs.mail.ru/infra/karboii/v1/${OS_PROJECT_ID}/plans

3. Create a trigger

Request example:

curl -s -X POST \    -H "Accept: application/json" \    -H "Content-type: application/json" \    -H "X-Auth-Token: gBkZhRqVNHSuSAJBI6duyXXXX" \    -d '{      "trigger_info": {        "name": "example-plan",        "plan_id": "17f09168-62c3-419b-XXXX-8889aac8fb0f",        "properties": {          "pattern": "3 3 * * 2",          "max_backups": 20,          "next_time": 0        }      }    }' \    https://mcs.mail.ru/infra/karboii/v1/${OS_PROJECT_ID}/triggers