華為云計(jì)算 云知識(shí) 查詢指定可保護(hù)資源ShowProtectable
查詢指定可保護(hù)資源ShowProtectable

 

功能介紹

根據(jù)ID查詢可保護(hù)性資源

調(diào)試

您可以在API Explorer中調(diào)試該接口,支持自動(dòng)認(rèn)證鑒權(quán)。API Explorer可以自動(dòng)生成SDK代碼示例,并提供SDK代碼示例調(diào)試功能。

URI

GET /v3/{project_id}/protectables/{protectable_type}/instances/{instance_id}

表1 路徑參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

instance_id

String

資源ID

project_id

String

項(xiàng)目ID

protectable_type

String

可保護(hù)性類型

枚舉值:

  • server

  • disk

請(qǐng)求參數(shù)

無(wú)

響應(yīng)參數(shù)

狀態(tài)碼: 200

表2 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

instance

ProtectablesResp object

可保護(hù)資源

表3 ProtectablesResp

參數(shù)

參數(shù)類型

描述

children

Array of objects

子資源

detail

Object

資源詳情

id

String

id

name

String

名稱

protectable

ProtectableResult object

是否可備份

size

Integer

大小,單位GB

status

String

資源狀態(tài)

枚舉值:

  • active

  • deleted

  • error

type

String

待備份資源的類型: OS::Nova::Server, OS::Cinder::Volume, OS::Ironic::BareMetalServer, OS::Native::Server, OS::Sfs::Turbo, OS:: Workspace ::DesktopV2

表4 ProtectableResult

參數(shù)

參數(shù)類型

描述

code

String

不支持備份的錯(cuò)誤碼

reason

String

不支持備份的原因

result

Boolean

是否可備份

vault

VaultGet object

綁定的存儲(chǔ)庫(kù)

message

String

資源不可備份的原因信息,當(dāng)資源可保護(hù)性檢驗(yàn)失敗時(shí)才有該字段。

表5 VaultGet

參數(shù)

參數(shù)類型

描述

billing

Billing object

運(yùn)營(yíng)信息

description

String

存儲(chǔ)庫(kù)自定義描述信息。

最小長(zhǎng)度:0

最大長(zhǎng)度:255

id

String

存儲(chǔ)庫(kù)ID

name

String

存儲(chǔ)庫(kù)名稱

最小長(zhǎng)度:1

最大長(zhǎng)度:64

project_id

String

項(xiàng)目ID

provider_id

String

存儲(chǔ)庫(kù)資源類型id

resources

Array of ResourceResp objects

資源

tags

Array of Tag objects

存儲(chǔ)庫(kù)標(biāo)簽

enterprise_project_id

String

企業(yè)項(xiàng)目id,默認(rèn)為‘0’。

auto_bind

Boolean

是否自動(dòng)綁定,默認(rèn)為false,不支持。

bind_rules

VaultBindRules object

綁定規(guī)則

user_id

String

用戶id

created_at

String

創(chuàng)建時(shí)間,例如:"2020-02-05T10:38:34.209782"

auto_expand

Boolean

是否開(kāi)啟存儲(chǔ)庫(kù)自動(dòng)擴(kuò)容能力(只支持按需存儲(chǔ)庫(kù))。

smn_notify

Boolean

存儲(chǔ)庫(kù)smn 消息通知 開(kāi)關(guān)

缺省值:true

threshold

Integer

存儲(chǔ)庫(kù)容量閾值,已用容量占總?cè)萘窟_(dá)到此百分比即發(fā)送相關(guān)通知

最小值:1

最大值:100

缺省值:80

updated_at

String

更新時(shí)間,例如:"2020-02-05T10:38:34.209782"

version

String

版本

表6 Billing

參數(shù)

參數(shù)類型

描述

allocated

Integer

已分配容量,單位GB

charging_mode

String

創(chuàng)建模式,按需:post_paid,包周期:pre_paid,默認(rèn)為post_paid

cloud_type

String

公有云:public ;混合云:hybrid

consistent_level

String

規(guī)格,崩潰一致性(crash_consistent)或應(yīng)用一致性(app_consistent)

object_type

String

對(duì)象類型: 云服務(wù)器 (server), 云硬盤 (disk),文件系統(tǒng)(turbo), 云桌面 (workspace),VMware(vmware),關(guān)系型 數(shù)據(jù)庫(kù) (rds),文件(file)。

order_id

String

訂單ID

product_id

String

產(chǎn)品ID

protect_type

String

保護(hù)類型:備份(backup)、復(fù)制(replication)。

size

Integer

容量,單位GB

最小值:1

最大值:10485760

spec_code

String

規(guī)格編碼。 云服務(wù)備份存儲(chǔ)庫(kù):vault.backup.server.normal; 云硬盤備份 存儲(chǔ)庫(kù):vault.backup.volume.normal;文件備份存儲(chǔ)庫(kù):vault.backup.turbo.normal

status

String

存儲(chǔ)庫(kù)狀態(tài)

枚舉值:

  • available

  • lock

  • frozen

  • deleting

  • error

storage_unit

String

存儲(chǔ)庫(kù)桶名

used

Integer

已使用容量,單位MB

frozen_scene

String

凍結(jié)場(chǎng)景

表7 ResourceResp

參數(shù)

參數(shù)類型

描述

extra_info

ResourceExtraInfo object

資源附加信息

id

String

待備份資源id

name

String

待備份資源名稱

最小長(zhǎng)度:0

最大長(zhǎng)度:255

protect_status

String

保護(hù)狀態(tài)

枚舉值:

  • available

  • error

  • protecting

  • restoring

  • removing

size

Integer

資源已分配容量,單位為GB

type

String

待備份資源的類型: OS::Nova::Server, OS::Cinder::Volume, OS::Ironic::BareMetalServer, OS::Native::Server, OS::Sfs::Turbo, OS::Workspace::DesktopV2

backup_size

Integer

副本大小

backup_count

Integer

副本數(shù)量

表8 ResourceExtraInfo

參數(shù)

參數(shù)類型

描述

exclude_volumes

Array of strings

需要排除備份的卷id。僅在多盤備份特性中有效,排除不需要備份的磁盤。當(dāng)虛擬機(jī)新綁定磁盤時(shí),也能繼續(xù)排除之前設(shè)置不用備份的卷。

表9 Tag

參數(shù)

參數(shù)類型

描述

key

String

鍵。

key最大長(zhǎng)度為36個(gè)字符。

key不能為空字符串。

key前后空格會(huì)被丟棄。

key不能包含非打印字符ASCII(0-31),“=”,“*”,“<”,“>”,“\”,“,”,“|”,“/”。

key只能由中文,字母,數(shù)字,“-”,“_”組成。

value

String

值。

添加標(biāo)簽時(shí)value值必選,刪除標(biāo)簽時(shí)value值可選。

value最大長(zhǎng)度為43個(gè)字符。

value可以為空字符串。

value前后的空格會(huì)被丟棄。

value不能包含非打印字符ASCII(0-31),“=”,“*”,“<”,“>”,“\”,“,”,“|”,“/”。

value只能由中文,字母,數(shù)字,“-”,“_”,“.”組成。

表10 VaultBindRules

參數(shù)

參數(shù)類型

描述

tags

Array of BindRulesTags objects

按tags過(guò)濾自動(dòng)綁定的資源

最小長(zhǎng)度:0

最大長(zhǎng)度:5

數(shù)組長(zhǎng)度:0 - 5

表11 BindRulesTags

參數(shù)

參數(shù)類型

描述

key

String

key不能包含非打印字符ASCII(0-31),“=”,“*”,“<”,“>”,“\”,“,”,“|”,“/”。

key只能由中文,字母,數(shù)字,“-”,“_”組成。

value

String

value不能包含非打印字符ASCII(0-31),“=”,“*”,“<”,“>”,“\”,“,”,“|”,“/”。

value只能由中文,字母,數(shù)字,“-”,“_”,“.”組成。

請(qǐng)求示例

查詢指定可保護(hù)資源。

GET  https://{endpoint}/v3/{project_id}/protectables/{protectable_type}/instances/{instance_id}

響應(yīng)示例

狀態(tài)碼: 200

OK

{
  "instance" : {
    "status" : "ACTIVE",
    "children" : [ {
      "status" : "in-use",
      "name" : "volume-f926-0001",
      "detail" : {
        "attachments" : [ {
          "server_id" : "55ecd8b8-1457-4a2a-a9df-53756a690082",
          "attachment_id" : "3b32cb75-bd96-493b-8fb2-13f063c876d5",
          "volume_id" : "8d3d519f-d409-4be3-8a1f-9f7a5ecb7a99",
          "host_name" : null,
          "attached_at" : "2019-05-08T06:56:25.891730",
          "device" : "/dev/vdb",
          "id" : "8d3d519f-d409-4be3-8a1f-9f7a5ecb7a99"
        } ],
        "links" : [ {
          "href" : "https://volume.region1.com/v2/3aec9116a6a5487ca14987121d2818fe/volumes/8d3d519f-d409-4be3-8a1f-9f7a5ecb7a99",
          "rel" : "self"
        }, {
          "href" : "https://volume.region1.com/3aec9116a6a5487ca14987121d2818fe/volumes/8d3d519f-d409-4be3-8a1f-9f7a5ecb7a99",
          "rel" : "bookmark"
        } ],
        "availability_zone" : "AZ1",
        "os-vol-host-attr:host" : "AZ1.xxxxxx#FusionStorage",
        "encrypted" : false,
        "updated_at" : "2019-05-08T06:56:26.207240",
        "replication_status" : "disabled",
        "snapshot_id" : null,
        "id" : "8d3d519f-d409-4be3-8a1f-9f7a5ecb7a99",
        "size" : 10,
        "user_id" : "f3d66502790d4ddaadef5056059ed8f4",
        "os-vol-tenant-attr:tenant_id" : "3aec9116a6a5487ca14987121d2818fe",
        "os-vol-mig-status-attr:migstat" : null,
        "metadata" : {
          "policy" : "cf3274fc-d23e-4c12-8be7-1e41b3c2faea",
          "readonly" : "False",
          "attached_mode" : "rw"
        },
        "status" : "in-use",
        "description" : null,
        "multiattach" : false,
        "source_volid" : null,
        "consistencygroup_id" : null,
        "os-vol-mig-status-attr:name_id" : null,
        "name" : "volume-f926-0001",
        "bootable" : "false",
        "created_at" : "2019-03-26T09:30:46.783578",
        "volume_type" : "SATA",
        "shareable" : false
      },
      "children" : [ ],
      "type" : "OS::Cinder::Volume",
      "id" : "8d3d519f-d409-4be3-8a1f-9f7a5ecb7a99",
      "size" : 10
    }, {
      "status" : "in-use",
      "name" : "no_delete_for_cbr_interface-volume-0000",
      "detail" : {
        "attachments" : [ {
          "server_id" : "55ecd8b8-1457-4a2a-a9df-53756a690082",
          "attachment_id" : "e16631fa-0522-4ac8-8f78-19db435caf68",
          "volume_id" : "13eb535f-8635-4faf-9f08-584d21e78f0a",
          "host_name" : null,
          "attached_at" : "2019-05-08T06:55:26.563986",
          "device" : "/dev/vda",
          "id" : "13eb535f-8635-4faf-9f08-584d21e78f0a"
        } ],
        "links" : [ {
          "href" : "https://volume.region1.com/v2/3aec9116a6a5487ca14987121d2818fe/volumes/13eb535f-8635-4faf-9f08-584d21e78f0a",
          "rel" : "self"
        }, {
          "href" : "https://volume.region1.com/3aec9116a6a5487ca14987121d2818fe/volumes/13eb535f-8635-4faf-9f08-584d21e78f0a",
          "rel" : "bookmark"
        } ],
        "availability_zone" : "AZ1",
        "os-vol-host-attr:host" : "AZ1.xxxxxx#kvm_fusionstorage",
        "encrypted" : false,
        "updated_at" : "2019-05-08T08:33:07.855484",
        "replication_status" : "disabled",
        "snapshot_id" : null,
        "id" : "13eb535f-8635-4faf-9f08-584d21e78f0a",
        "size" : 40,
        "user_id" : "3204777a731c4ebea330350c04f41b92",
        "os-vol-tenant-attr:tenant_id" : "3aec9116a6a5487ca14987121d2818fe",
        "os-vol-mig-status-attr:migstat" : null,
        "metadata" : {
          "policy" : "2ecbcffd-08ba-43f7-bf8d-95daba753464",
          "readonly" : "False",
          "attached_mode" : "rw"
        },
        "status" : "in-use",
        "volume_image_metadata" : {
          "container_format" : "bare",
          "min_ram" : "0",
          "__account_code" : "",
          "__os_bit" : "64",
          "size" : "2",
          "__os_version" : "CentOS 7.2 64bit",
          "__backup_id" : "",
          "__description" : "",
          "__support_diskintensive" : "true",
          "disk_format" : "vhd",
          "__isregistered" : "true",
          "__image_size" : "3295645696",
          "__platform" : "CentOS",
          "__root_origin" : "file",
          "__originalimagename" : "703eb90a-a65f-4c72-b4c1-f070a55d068b",
          "__quick_start" : "true",
          "image_name" : "CentOS7.2-cloudinit",
          "image_id" : "703eb90a-a65f-4c72-b4c1-f070a55d068b",
          "__os_type" : "Linux",
          "__image_location" : "172.100.45.130:443:pcsimsf8bd00bf6c304d2e8cf4e2beb0aed702:703eb90a-a65f-4c72-b4c1-f070a55d068b",
          "min_disk" : "40",
          "__data_origin" : "file,jingxiang:CentOS-7.2-64bit.zvhd2",
          "__support_kvm" : "true",
          "virtual_env_type" : "FusionCompute",
          "__image_source_type" : "uds",
          "__support_xen" : "true",
          "checksum" : "99914b932bd37a50b983c5e7c90ae93b",
          "__imagetype" : "gold",
          "__productcode" : ""
        },
        "description" : null,
        "multiattach" : false,
        "source_volid" : null,
        "consistencygroup_id" : null,
        "os-vol-mig-status-attr:name_id" : null,
        "name" : "no_delete_for_cbr_interface-volume-0000",
        "bootable" : "true",
        "created_at" : "2019-05-08T06:54:58.477749",
        "volume_type" : "SATA",
        "shareable" : false
      },
      "children" : [ ],
      "type" : "OS::Cinder::Volume",
      "id" : "13eb535f-8635-4faf-9f08-584d21e78f0a",
      "size" : 40
    } ],
    "protectable" : {
      "vault" : null,
      "reason" : "",
      "code" : "",
      "result" : true
    },
    "name" : "no_delete_for_cbr_interface",
    "detail" : {
      "OS-EXT-STS:task_state" : null,
      "addresses" : {
        "94b88790-c906-4450-b7c2-1c2b1ea639bf" : [ {
          "OS-EXT-IPS-MAC:mac_addr" : "fa:16:3e:9b:9d:af",
          "version" : 4,
          "addr" : "192.168.1.44",
          "OS-EXT-IPS:type" : "fixed"
        }, {
          "OS-EXT-IPS-MAC:mac_addr" : "fa:16:3e:9b:9d:af",
          "version" : 4,
          "addr" : "100.78.0.199",
          "OS-EXT-IPS:type" : "floating"
        } ]
      },
      "links" : [ {
        "href" : "https://compute.region1.com/v2.1/3aec9116a6a5487ca14987121d2818fe/servers/55ecd8b8-1457-4a2a-a9df-53756a690082",
        "rel" : "self"
      }, {
        "href" : "https://compute.region1.com/3aec9116a6a5487ca14987121d2818fe/servers/55ecd8b8-1457-4a2a-a9df-53756a690082",
        "rel" : "bookmark"
      } ],
      "image" : "",
      "OS-EXT-STS:vm_state" : "active",
      "OS-EXT-SRV-ATTR:instance_name" : "instance-0004456e",
      "OS-SRV-USG:launched_at" : "2019-05-08T06:55:38.000000",
      "flavor" : {
        "id" : "s3.small.1",
        "links" : [ {
          "href" : "https://compute.region1.com/3aec9116a6a5487ca14987121d2818fe/flavors/s3.small.1",
          "rel" : "bookmark"
        } ]
      },
      "id" : "55ecd8b8-1457-4a2a-a9df-53756a690082",
      "security_groups" : [ {
        "name" : "default"
      } ],
      "user_id" : "f3d66502790d4ddaadef5056059ed8f4",
      "OS-DCF:diskConfig" : "MANUAL",
      "accessIPv4" : "",
      "accessIPv6" : "",
      "progress" : 0,
      "OS-EXT-STS:power_state" : 1,
      "OS-EXT-AZ:availability_zone" : "AZ1",
      "config_drive" : "",
      "status" : "ACTIVE",
      "updated" : "2019-05-08T06:57:02Z",
      "hostId" : "179f22cafe6b951921bd6deb3b13a978df620427fb37bbb7c619de98",
      "OS-EXT-SRV-ATTR:host" : "AZ1.xxxxxx",
      "OS-SRV-USG:terminated_at" : null,
      "key_name" : null,
      "OS-EXT-SRV-ATTR:hypervisor_hostname" : "nova003@36",
      "name" : "no_delete_for_cbr_interface",
      "created" : "2019-05-08T06:55:22Z",
      "tenant_id" : "3aec9116a6a5487ca14987121d2818fe",
      "os-extended-volumes:volumes_attached" : [ {
        "id" : "8d3d519f-d409-4be3-8a1f-9f7a5ecb7a99"
      }, {
        "id" : "13eb535f-8635-4faf-9f08-584d21e78f0a"
      } ],
      "metadata" : {
        "metering.image_id" : "703eb90a-a65f-4c72-b4c1-f070a55d068b",
        "metering.imagetype" : "gold",
        "metering.resourcespeccode" : "s3.small.1.linux",
        "metering.cloudServiceType" : "sys.service.type.ec2",
        "virtual_env_type" : "FusionCompute",
        "image_name" : "CentOS7.2-cloudinit",
        "metering.resourcetype" : "1",
        "vpc_id" : "94b88790-c906-4450-b7c2-1c2b1ea639bf",
        "os_bit" : "64",
        "cas cad ed.instance_extrainfo" : "",
        "os_type" : "Linux",
        "charging_mode" : "0"
      }
    },
    "type" : "OS::Nova::Server",
    "id" : "55ecd8b8-1457-4a2a-a9df-53756a690082",
    "size" : 50
  }
}

狀態(tài)碼

狀態(tài)碼

描述

200

OK

錯(cuò)誤碼

請(qǐng)參見(jiàn)錯(cuò)誤碼。