Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a Backup Policy

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

Function

This API is used to create a backup policy to back up servers periodically.

URI

  • URI format

    POST https://{endpoint}/v1/{project_id}/policies

  • 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.

Request

  • Parameter description
    Table 2 Parameter description

    Parameter

    Mandatory

    Type

    Description

    policy

    Yes

    policy_create

    Creation parameters

    For details, see Table 3.

  • Parameter description of field policy_create
    Table 3 Parameter description of field policy_create

    Parameter

    Mandatory

    Type

    Description

    description

    No

    String

    Backup policy description

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

    name

    Yes

    String

    Backup policy name

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

    parameters

    Yes

    policy_param

    Backup parameters

    For details, see Table 4.

    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.

    resources

    Yes

    List<resource>

    Backup object list. The list can be blank.

    For details, see Table 5.

    scheduled_operations

    Yes

    List<scheduled_operation_create>

    Scheduling period

    For details, see Table 6.

  • Parameter description of field policy_param
    Table 4 Parameter description of field policy_param

    Parameter

    Mandatory

    Type

    Description

    common

    No

    common_param

    General backup policy parameters, which are blank by default

    For details, see Parameter description of field common_param.

  • Parameter description of field common_param

    Parameter

    Mandatory

    Type

    Description

    app_consistency

    No

    Integer

    Whether to perform application-consistent backup on backup objects associated with the backup policy. 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. For details about the application-consistent backup feature, see the description in section "Creating a Resource Backup."

  • Parameter description of field resource
    Table 5 Parameter description of field resource

    Parameter

    Mandatory

    Type

    Description

    id

    Yes

    String

    ID of the object to be backed up

    type

    Yes

    String

    Entity object type of backup objects

    The value is fixed at OS::Nova::Server (ECSs).

    name

    Yes

    String

    Backup object name

    extra_info

    No

    Dict

    Additional information about the backup object

  • Parameter description of field scheduled_operation_create
    Table 6 Parameter description of field scheduled_operation_create

    Parameter

    Mandatory

    Type

    Description

    description

    No

    String

    Scheduling period description

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

    enabled

    Yes

    Boolean

    Whether the backup policy is enabled

    If it is set to true, automatic scheduling is enabled. If it is set to false, automatic scheduling is disabled but you can execute the policy manually.

    name

    No

    String

    Scheduling period name

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

    operation_type

    Yes

    String

    Operation type, which can be backup

    Enumeration values: backup

    operation_definition

    Yes

    operation_definition

    Scheduling period parameters

    For details, see Table 7.

    trigger

    Yes

    trigger

    Scheduling policy

  • Parameter description of field operation_definition
    Table 7 Parameter description of field operation_definition

    Parameter

    Mandatory

    Type

    Description

    max_backups

    No

    Integer

    Maximum number of backups that can be automatically created for a backup object. The value can be -1 or ranges from 0 to 99999. If the value is set to -1, the backups will not be cleared even though the configured retained backup quantity limit is exceeded.

    retention_duration_days

    No

    Integer

    Duration of retaining a backup, in days. The value can be -1 or ranges from 0 to 99999. If the value is set to -1, backups will not be cleared even though the configured retention duration is exceeded.

    permanent

    No

    Boolean

    Whether backups are permanently retained. false: no. true: yes

    plan_id

    No

    String

    Backup policy ID

    provider_id

    No

    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.

    NOTE:
    • If permanent is set to true, backups will be retained permanently, despite the settings of max_backups and retention_duration_days.
    • If permanent is set to false, settings of max_backups and retention_duration_days are effective.
    • If none of permanent, max_backups, and retention_duration_days is set, backups will be retained permanently.
  • Parameter description of field trigger
    Table 8 Parameter description of field trigger

    Parameter

    Mandatory

    Type

    Description

    properties

    Yes

    trigger_properties

    Scheduler properties

    For details, see Table 9.

  • Parameter description of field trigger_properties
    Table 9 Parameter description of field trigger_properties

    Parameter

    Mandatory

    Type

    Description

    pattern

    Yes

    String

    Scheduling policy of the scheduler. The value consists of a maximum of 10,240 characters. The scheduling policy complies with iCalendar RFC 2445, but it supports only four parameters, which are FREQ, BYDAY, BYHOUR, and BYMINUTE. FREQ can be set only to WEEKLY or DAILY. BYDAY can be set to MO, TU, WE, TH, FR, SA, or SU (seven days of a week). BYHOUR ranges from 0 to 23 hours. BYMINUTE ranges from 0 to 59 minutes. The scheduling interval cannot be less than 1 hour. A maximum of 24 time points are allowed in a day.

  • Example request
    POST https://{endpoint}/v1/{project_id}/policies
    {
      "policy" : {
        "name" : "my-plan",
        "description" : "My plan",
        "provider_id" : "fc4d5750-22e7-4798-8a46-f48f62c4c1da",
        "parameters" : {
          "common" : {
              "app_consistency": 1
          }
        },
        "scheduled_operations" : [ {
          "name" : "my-backup-policy",
          "description" : "My backup policy",
          "enabled" : true,
          "operation_definition" : {
            "max_backups" : 20
          },
          "trigger" : {
            "properties" : {
              "pattern" : "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nRRULE:FREQ=WEEKLY;BYDAY=TH;BYHOUR=12;BYMINUTE=27\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
            }
          },
          "operation_type" : "backup"
        }
         
        ],
        "resources" : [ {
          "id" : "45baf976-c20a-4894-a7c3-c94b7376bf55",
          "type" : "OS::Nova::Server",
          "name" : "resource1",
        }, {
          "id" : "5aa119a8-d25b-45a7-8d1b-88e127885635",
          "type" : "OS::Nova::Server",
          "name" : "resource2"
        } ]
      }
    }

Response

  • Parameter description
    Table 10 Parameter description

    Parameter

    Type

    Description

    policy

    policy_resp

    For details, see Table 11.

  • Parameter description of field policy_resp
    Table 11 Parameter description of field policy_resp

    Parameter

    Type

    Description

    created_at

    String

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

    description

    String

    Backup policy description

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

    id

    String

    Backup policy ID

    name

    String

    Backup policy name

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

    parameters

    policy_param

    Parameters of a backup policy

    For details, see Table 12.

    project_id

    String

    Project ID

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

    provider_id

    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.

    resources

    List<resource>

    Backup object list

    For details, see Table 13.

    scheduled_operations

    List<scheduled_operation_resp>

    Scheduling period list

    For details, see Table 14.

    status

    String

    Backup policy status

    disabled: indicates that the backup policy is unavailable.

    enabled: indicates that the backup policy is available.

  • Parameter description of field policy_param
    Table 12 Parameter description of field policy_param

    Parameter

    Type

    Description

    common

    common_param

    Common parameters of a backup policy

    For details, see Parameter description of field common_param.

  • Parameter description of field common_param

    Parameter

    Type

    Description

    app_consistency

    Integer

    Whether to perform application-consistent backup on backup objects associated with the backup policy. 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. For details about the application-consistent backup feature, see the description in section "Creating a Resource Backup."

  • Parameter description of field resource
    Table 13 Parameter description of field resource

    Parameter

    Type

    Description

    id

    String

    ID of the object to be backed up

    type

    String

    Entity object type of backup objects

    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

  • Parameter description of field scheduled_operation_resp
    Table 14 Parameter description of field scheduled_operation_resp

    Parameter

    Type

    Description

    description

    String

    Scheduling period description

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

    enabled

    Boolean

    Whether the backup policy is enabled

    The default value is true. If it is set to false, automatic scheduling is disabled but manual scheduling is supported.

    name

    String

    Scheduling period name

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

    operation_type

    String

    Operation type, which can be backup

    Enumeration values: backup

    operation_definition

    operation_definition

    Scheduling period parameters

    For details, see Table 15.

    trigger

    trigger_resp

    Scheduling policy

    id

    String

    Scheduling period ID

    trigger_id

    String

    Scheduler ID

  • Parameter description of field operation_definition
    Table 15 Parameter description of field operation_definition

    Parameter

    Type

    Description

    max_backups

    String

    Maximum number of backups that can be retained. The value can be -1 or ranges from 0 to 99999. If the value is set to -1, the backups will not be cleared even though the configured retained backup quantity limit is exceeded.

    retention_duration_days

    String

    Duration of retaining a backup, in days. The value can be -1 or ranges from 0 to 99999. If the value is set to -1, backups will not be cleared even though the configured retention duration is exceeded.

    permanent

    String

    Whether backups are permanently retained

    plan_id

    String

    Backup policy ID

    provider_id

    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.

    NOTE:
    • If permanent is set to true, backups will be retained permanently, despite the settings of max_backups and retention_duration_days.
    • If permanent is set to false, settings of max_backups and retention_duration_days are effective.
    • If none of permanent, max_backups, and retention_duration_days is set, backups will be retained permanently.
  • Parameter description of field trigger_resp
    Table 16 Parameter description of field trigger_resp

    Parameter

    Type

    Description

    properties

    trigger_properties_resp

    Scheduler properties

    For details, see Parameter description of field trigger_properties_resp.

    id

    String

    Scheduler ID

    name

    String

    Scheduler name

    type

    String

    Scheduling type. The value is fixed at time.

  • Parameter description of field trigger_properties_resp
    Table 17 Parameter description of field trigger_properties_resp

    Parameter

    Type

    Description

    pattern

    String

    Scheduling policy of the scheduler

    The value consists of a maximum of 10,240 characters. The scheduling policy complies with iCalendar RFC 2445, but it supports only four parameters, which are FREQ, BYDAY, BYHOUR, and BYMINUTE. FREQ can be set to WEEKLY and DAILY, BYDAY can be set to MO, TU, WE, TH, FR, SA, and SU (seven days of a week), BYHOUR ranges from 0 hours to 23 hours, and BYMINUTE ranges from 0 minutes to 59 minutes. The scheduling interval must not be less than 1 hour. A maximum of 24 time points are allowed in a day.

    start_time

    String

    Scheduler start time, for example, 2017-04-18T01:21:52

    format

    String

    Scheduler type

  • Example response
    {
      "policy" : {
        "created_at" : "2017-03-07T09:27:40.928000",
        "description" : "My plan",
        "id" : "f766c171-9336-479a-8b30-b83cabf6381e",
        "name" : "my-plan",
        "parameters" : {
          "common" : {
              "app_consistency": 1
          }
        },
        "project_id" : "tenant",
        "provider_id" : "c714180d-ea34-4b13-9a5e-577c7c416eec",
        "resources" : [ {
          "id" : "45baf976-c20a-4894-a7c3-c94b7376bf55",
          "name" : "resource1",
          "type" : "OS::Nova::Server",
          "extra_info" : {
        }
        }, {
          "id" : "5aa119a8-d25b-45a7-8d1b-88e127885635",
          "name" : "resource2",
          "type" : "OS::Nova::Server"
        } ],
        "scheduled_operations" : [ {
          "description" : "My backup policy",
          "enabled" : true,
          "id" : "9303a23d-e433-48e7-b88a-5ee6442e434e",
          "name" : "my-backup-policy",
          "operation_definition" : {
            "max_backups" : "20",
            "plan_id" : "f766c171-9336-479a-8b30-b83cabf6381e",
            "provider_id" : "c714180d-ea34-4b13-9a5e-577c7c416eec"
          },
          "operation_type" : "backup",
          "trigger" : {
            "id" : "8178846b-766d-4fe6-941f-b38c76b6f3b9",
            "name" : "default",
            "properties" : {
              "pattern" : "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nRRULE:FREQ=WEEKLY;BYDAY=TH;BYHOUR=12;BYMINUTE=27\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
              "start_time" : "2017-03-07 09:27:41",
              "format" : "ical"
            },
            "type" : "time"
          },
          "trigger_id" : "8178846b-766d-4fe6-941f-b38c76b6f3b9"
        }
    ,
       ],
        "status" : "suspended"
      }
    }

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.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback