创建存储库
功能介绍
创建存储库
URI
POST /v3/{project_id}/vaults
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
项目ID |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
vault |
是 |
VaultCreate object |
存储库创建参数 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
backup_policy_id |
否 |
String |
备份策略ID,不设置时为null,不自动备份。 |
|
billing |
是 |
BillingCreate object |
创建参数信息 |
|
description |
否 |
String |
描述 最小长度:0 最大长度:64 |
|
name |
是 |
String |
存储库名称 最小长度:1 最大长度:64 |
|
resources |
是 |
Array of ResourceCreate objects |
绑定的备份资源,未在创建时绑定资源填[] |
|
tags |
否 |
Array of Tag objects |
标签列表 tags不允许为空列表。 tags中最多包含10个key。 tags中key不允许重复。 |
|
enterprise_project_id |
否 |
String |
企业项目ID,默认为‘0’。 |
|
auto_bind |
否 |
Boolean |
是否支持自动挂载。 |
|
bind_rules |
否 |
VaultBindRules object |
自动挂载的规则 |
|
auto_expand |
否 |
Boolean |
是否自动扩容。按需存储库支持自动扩容,包周期存储库不支持扩容。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
cloud_type |
否 |
String |
枚举值:
|
|
consistent_level |
是 |
String |
|
|
object_type |
是 |
String |
对象类型:云服务器(server),云硬盘(disk),文件系统(turbo)。 枚举值:
|
|
protect_type |
是 |
String |
保护类型:备份(backup)、复制(replication) 枚举值:
|
|
size |
是 |
Integer |
容量,单位GB 最小值:1 最大值:10485760 |
|
charging_mode |
否 |
String |
创建模式,按需:post_paid,包周期:pre_paid,默认为post_paid 缺省值:post_paid 枚举值:
|
|
period_type |
否 |
String |
创建类型,charging_mode为pre_paid必填,按年(year)或者按月(month) 枚举值:
|
|
period_num |
否 |
Integer |
创建类型的数量,charging_mode为pre_paid必填 |
|
is_auto_renew |
否 |
Boolean |
到期后是否自动续期,默认不续期 缺省值:false |
|
is_auto_pay |
否 |
Boolean |
是否自动付费,默认为不自动付费 缺省值:false |
|
console_url |
否 |
String |
跳转URL 最小长度:1 最大长度:255 |
|
extra_info |
否 |
BillbingCreateExtraInfo object |
创建参数扩展信息 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
combined_order_id |
否 |
String |
组合创建ID,组合创建时必传。 |
|
combined_order_ecs_num |
否 |
Integer |
组合创建数量,组合创建时必填。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
extra_info |
否 |
ResourceExtraInfo object |
资源附加信息 |
|
id |
是 |
String |
待备份资源id |
|
type |
是 |
String |
|
|
name |
否 |
String |
名称 最小长度:0 最大长度:255 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
exclude_volumes |
否 |
Array of strings |
需要排除备份的卷id。仅虚拟机磁盘级备份有效 |
|
include_volumes |
否 |
Array of ResourceExtraInfoIncludeVolumes objects |
要备份的卷 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
vault |
Vault object |
存储库查询返回对象 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
billing |
Billing object |
运营信息 |
|
description |
String |
存储库自定义描述信息。 最小长度:0 最大长度:255 |
|
id |
String |
保管库ID |
|
name |
String |
保管库名称 最小长度:1 最大长度:64 |
|
project_id |
String |
项目ID |
|
provider_id |
String |
保管库类型 |
|
resources |
Array of ResourceResp objects |
存储库资源 |
|
tags |
Array of Tag objects |
存储库标签 |
|
enterprise_project_id |
String |
企业项目id,默认为‘0’。 |
|
auto_bind |
Boolean |
是否自动绑定,默认为false,不支持。 |
|
bind_rules |
VaultBindRules object |
绑定规则 |
|
user_id |
String |
用户id |
|
created_at |
String |
创建时间,例如:"2020-02-05T10:38:34.209782" |
|
auto_expand |
Boolean |
是否开启存储库自动扩容能力(只支持按需存储库)。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
allocated |
Integer |
已分配容量,单位MB |
|
charging_mode |
String |
创建模式 枚举值:
|
|
cloud_type |
String |
云平台 枚举值:
|
|
consistent_level |
String |
|
|
object_type |
String |
对象类型 枚举值:
|
|
order_id |
String |
订单ID |
|
product_id |
String |
产品ID |
|
protect_type |
String |
保护类型 枚举值:
|
|
size |
Integer |
容量,单位GB 最小值:1 最大值:10485760 |
|
spec_code |
String |
规格编码 枚举值:
|
|
status |
String |
保管库状态 枚举值:
|
|
storage_unit |
String |
存储库桶名 |
|
used |
Integer |
已使用容量,单位MB |
|
frozen_scene |
String |
冻结场景 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
extra_info |
ResourceExtraInfo object |
资源附加信息 |
|
id |
String |
待备份资源id |
|
name |
String |
待备份资源名称 最小长度:0 最大长度:255 |
|
protect_status |
String |
保护状态 枚举值:
|
|
size |
Integer |
资源已分配容量,单位为GB |
|
type |
String |
|
|
backup_size |
Integer |
副本大小 |
|
backup_count |
Integer |
副本数量 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
exclude_volumes |
Array of strings |
需要排除备份的卷id。仅虚拟机磁盘级备份有效 |
|
include_volumes |
Array of ResourceExtraInfoIncludeVolumes objects |
要备份的卷 |
状态码: 400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
请参见错误码。 |
|
error_msg |
String |
错误信息 |
请求示例
POST https://{endpoint}/v3/f841e01fd2b14e7fa41b6ae7aa6b0594/vaults
{
"vault" : {
"backup_policy_id" : "6dd81d7d-a4cb-443e-b8ed-1af0bd3a261b",
"billing" : {
"cloud_type" : "public",
"consistent_level" : "crash_consistent",
"object_type" : "server",
"protect_type" : "backup",
"size" : 100,
"charging_mode" : "post_paid",
"is_auto_renew" : false,
"is_auto_pay" : false,
"console_url" : "https://console.demo.com/cbr/?agencyId=97fcd896b7914cb98f553a087232e243®ion=testregion/cbr/manager/csbs/vaultList"
},
"description" : "vault_description",
"name" : "vault_name",
"resources" : [ {
"extra_info" : {
"include_volumes" : [ {
"id" : "73ee8446-bce7-4371-9650-b440b5f4c1d0",
"os_version" : "CentOS 7.6 64bit"
} ]
},
"id" : "23a320a5-3efd-4568-b1aa-8dd9183cc64c",
"type" : "OS::Nova::Server"
} ],
"tags" : [ {
"key" : "key01",
"value" : "value01"
} ],
"enterprise_project_id" : "0"
}
}
响应示例
状态码: 200
OK
{
"vault" : {
"provider_id" : "0daac4c5-6707-4851-97ba-169e36266b66",
"description" : "vault_description",
"tags" : [ {
"value" : "value01",
"key" : "key01"
} ],
"enterprise_project_id" : "0",
"auto_bind" : false,
"id" : "ad7627ae-5b0b-492e-b6bd-cd809b745197",
"user_id" : "38d65be2ecd840d19046e239e841a734",
"name" : "vault_name",
"billing" : {
"status" : "available",
"used" : 0,
"protect_type" : "backup",
"object_type" : "server",
"allocated" : 40,
"spec_code" : "vault.backup.server.normal",
"size" : 100,
"cloud_type" : "public",
"consistent_level" : "crash_consistent",
"charging_mode" : "post_paid"
},
"created_at" : "2019-05-23T12:51:10.071232",
"project_id" : "fc347bc64ccd4589ae52e4f44b7433c7",
"resources" : [ {
"name" : "ecs-b977-0002",
"backup_size" : 0,
"protect_status" : "available",
"backup_count" : 0,
"extra_info" : {
"include_volumes" : [ {
"os_version" : "CentOS 7.6 64bit",
"id" : "73ee8446-bce7-4371-9650-b440b5f4c1d0"
} ]
},
"type" : "OS::Nova::Server",
"id" : "23a320a5-3efd-4568-b1aa-8dd9183cc64c",
"size" : 40
} ]
}
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK |
|
400 |
Bad Request |
错误码
请参见错误码。