Setting the Automatic Snapshot Creation Policy

Function

This API is used to set parameters related to automatic snapshot creation. By default, a snapshot is created per day.

URI

POST /v1.0/{project_id}/clusters/{cluster_id}/index_snapshot/policy
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

cluster_id

Yes

String

ID of the cluster where automatic snapshot creation is enabled.

Request

Table 2 describes the request parameters.

Table 2 Request body parameter

Parameter

Mandatory

Type

Description

indices

No

String

Name of the index to be backed up. The value * indicates all indexes.

prefix

No

String

Prefix of automatically generated snapshots. It is manually configured. Enter up to 32 characters and start with a lowercase letter. Lowercase letters, numbers, hyphens (-), and underscores (_) are allowed.

Note

This parameter is mandatory when enable is set to true.

period

No

String

Time when a snapshot is generated every day. Snapshots can only be generated on the hour. The format is HH:mm z: HH:mm refers to the hour time and z refers to the time zone. For example, 00:00 GMT+08:00 and 01:00 GMT+08:00.

Note

This parameter is mandatory when enable is set to true.

keepday

No

Integer

Number of days that a snapshot can be retained. The value ranges from 1 to 90. The system automatically deletes snapshots that have been retained for the maximum allowed duration on the half hour.

Note

This parameter is mandatory when enable is set to true.

enable

Yes

String

Indicates whether to enable the automatic snapshot creation policy.

  • true: enabled.

  • false: disabled.

deleteAuto

No

String

Indicates whether to delete all automatically created snapshots when the automatic snapshot creation policy is disabled. The default value is false and the automatically created snapshots are not deleted when the automatic snapshot creation function is disabled. If this parameter is set to true, all automatically created snapshots are deleted when the automatic snapshot creation policy is disabled.

Response

None

Examples

Example request

POST /v1.0/6204a5bd270343b5885144cf9c8c158d/clusters/ea244205-d641-45d9-9dcb-ab2236bcd07e/index_snapshot/policy
{
    "prefix":"snapshot",
    "period":"16:00 GMT+02:00",
    "keepday":7,
    "enable":"true"
}

Status Code

Table 3 describes the status code.

Table 3 Status code

Status Code

Code

Status Code Description

200

OK

The request is processed successfully.

406

Not Acceptable

The server cannot fulfill the request according to the content characteristics of the request.