Updated on 2022-02-22 GMT+08:00

Creating a Resource Backup

Currently, CSBS APIs are available only to existing users. If you are new users, use CBR and CBR APIs.

Function

This API is used to select and directly back up resources.

URI

  • URI format

    POST https://{endpoint}/v1/{project_id}/providers/{provider_id}/resources/{resource_id}/action

  • Parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

    For details about how to obtain the project ID, see Obtaining a Project ID.

    provider_id

    Yes

    String

    Backup provider ID, which specifies whether the backup object is a server or disk. This parameter has a fixed value. For CSBS, the value is fc4d5750-22e7-4798-8a46-f48f62c4c1da.

    resource_id

    Yes

    String

    ID of a backup server. For details about how to obtain the server ID, see the Elastic Cloud Server API Reference.

    Backup provider IDs mentioned in this document are all fc4d5750-22e7-4798-8a46-f48f62c4c1da.

Request

  • Parameter description
    Table 2 Parameter description

    Parameter

    Mandatory

    Type

    Description

    protect

    Yes

    protect_param

    Backup parameters

    For details, see Table 3.

  • Parameter description of field protect_param
    Table 3 Parameter description of field protect_param

    Parameter

    Mandatory

    Type

    Description

    backup_name

    No

    String

    Backup name. The value consists of 1 to 255 characters and can contain only letters, digits, underscores (_), and hyphens (-).

    description

    No

    String

    Backup description. The value consists of 0 to 255 characters and must not contain a greater-than sign (>) or less-than sign (<).

    incremental

    No

    Boolean

    Backup type. Value True indicates incremental backup and value False indicates full backup. For the initial backup, full backup is always adopted, in spite of which value is set.

    resource_type

    No

    String

    Entity object type of the backup object

    The current value is OS::Nova::Server indicating that the backup object is an ECS. If this parameter is not passed, the backup object type defaults to OS::Nova::Server.

    extra_info

    No

    Dict

    Additional information about the backup object

    app_consistency

    No

    Integer

    Whether to perform application-consistent backup. Possible values are 0 (no), 1 (yes, and stop backing up data after the application-consistent backup fails), and 2 (yes, and continue to perform crash-consistent backup after the application-consistent backup fails). If app_consistency is not specified, application-consistent backup will not be performed. Application-consistent backup backs up files and disks at the same point in time, including memory data, to ensure data integrity and consistency. Before using this parameter, check whether the current site supports this feature.

  • Example request
    POST 
    https://{endpoint}/v1/b942cc8342734d15bcb246babb1953cf/providers/fc4d5750-22e7-4798-8a46-f48f62c4c1da/resources/9506416d-db6c-406e-8bca-c0f43793d914/action
    {
        "protect" : {
        "backup_name" : "backup",
        "description" : "backup des",
        "extra_info" : {
        },
        "app_consistency": 1
      }
    }

Response

  • Parameter description
    Table 4 Parameter description

    Parameter

    Type

    Description

    checkpoint

    protect_resp

    Backup response

    For details, see Table 5.

  • Parameter description of field protect_resp
    Table 5 Parameter description of field protect_resp

    Parameter

    Type

    Description

    status

    String

    Backup status

    Enum:[ waiting_protect, protecting, available, waiting_restore, restoring, error, waiting_delete, deleting,deleted]

    created_at

    String

    Creation time, for example, 2017-04-18T01:21:52.701973

    id

    String

    Backup record ID

    resource_graph

    String

    Resource diagram, which displays the inclusion relationship between backups and sub-backups

    project_id

    String

    Project ID

    For details about how to obtain the project ID, see Obtaining a Project ID.

    protection_plan

    plan_resp

    Backup plan information

    For details, see Table 6.

    extra_info

    String

    Additional information

  • Parameter description of field plan_resp
    Table 6 Parameter description of field plan_resp

    Parameter

    Type

    Description

    id

    String

    Backup policy ID

    name

    String

    Backup policy name

    resources

    List<resource>

    Backup object list

    For details, see Table 7.

  • Parameter description of field resource
    Table 7 Parameter description of field resource

    Parameter

    Type

    Description

    id

    String

    ID of the object to be backed up

    type

    String

    Entity object type of the backup object. The value is fixed at OS::Nova::Server, indicating that the object type is ECSs.

    name

    String

    Backup object name

    extra_info

    Dict

    Additional information about the backup object

  • Example response
    {
      "checkpoint" : {
        "status" : "protecting",
        "created_at" : "2017-04-18T01:21:52.701973",
        "id" : "4468f4b8-7c78-4222-a2ca-346b5d557dd2",
        "resource_graph" : null,
        "project_id" : "b942cc8342734d15bcb246babb1953cf",
        "extra_info" : null,
        "protection_plan" : {
          "id" : "fake_04f8ea0f-2000-4389-a5ce-93a3e20d0faf",
          "resources" : [ {
            "type" : "OS::Nova::Server",
            "id" : "9506416d-db6c-406e-8bca-c0f43793d914",
            "name" : "resource_9506416d-db6c-406e-8bca-c0f43793d914",
            "extra_info" : {
        }
          } ],
          "name" : "server protect plan for 9506416d-db6c-406e-8bca-c0f43793d914"
        }
      }
    }

Status Codes

  • Normal

    Status Code

    Description

    200

    OK

  • Abnormal

    Status Code

    Description

    400

    Invalid request parameters.

    401

    Authentication failed.

    403

    No operation permission.

    404

    Requested object not found.

    500

    Service internal error.

    503

    Service unavailable.

Error Codes

For details, see Error Codes.