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

Querying Information About a Template with a Specified ID

Function

This API is used to query information about an ECS template with a specified ID.

URI

GET /v1/sms/vm/template/{id}

For details about the parameters, see Table 1.

Table 1 Parameter description

Parameter

Mandatory

Type

Description

id

Yes

String

Template ID. Use the API provided in Querying the Template List to query the template ID list.

Request

None

Response

Response parameters

For details about the response parameters, see Table 3.

Table 2 Response parameters

Parameter

Type

Description

template

String

Template information. For details, see Table 3.

disks

String

Disk information. For details, see Table 9.

Table 3 template information

Parameter

Type

Description

name

String

Template name

id

String

Template ID

is_template

Boolean

Whether the object is a template. The value is true if a user saves the template, and false if the user does not save the template and directly create a task.

region

String

Region name

target_server_name

String

Name of the target ECS

availability_zone

String

AZ

volumetype

String

Disk type

vpc

Object

VPC information. The value is {} if the VPC is automatically created. For details, see Table 4.

security_groups

Array

Security group. The value is [] if the security group is automatically created. For details, see Table 5.

nics

Array

Subnet information. The value is [] if the subnet is automatically created. For details, see Table 6.

flavors

Array

ECS specifications. The value is [] if the ECS is automatically created. For details, see Table 7.

publicip

Object

EIP information. For details, see Table 8.

Table 4 vpc information

Parameter

Type

Description

id

String

VPC ID

name

String

VPC name

Table 5 security_groups information

Parameter

Type

Description

id

String

Security group ID

name

String

Security group name

Table 6 nics information

Parameter

Type

Description

id

String

Subnet ID

name

String

Subnet name

cidr

String

Gateway/mask

ip

String

Private IP address

Table 7 flavors information

Parameter

Type

Description

id

String

ECS specification ID

name

String

ECS flavor

Table 8 publicip information

Parameter

Type

Description

id

String

EIP ID, which is mandatory for a newly assigned one.

ip

String

EIP address, which is mandatory for a newly assigned one.

type

String

EIP type. The default value is 5_bgp.

bandwidth_size

Integer

Bandwidth size (Mbit/s). The value ranges from 1 to 2000.

The minimum increment for bandwidth adjustment varies depending on the bandwidth range. The minimum increment is 1 Mbit/s if the allowed bandwidth ranges from 0 to 300 Mbit/s (with 300 Mbit/s included). The minimum increment is 50 Mbit/s if the allowed bandwidth ranges 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s included). The minimum increment is 500 Mbit/s if the allowed bandwidth is greater than 1000 Mbit/s.

NOTE:

This parameter is mandatory when sharetype is set to PER and is optional when sharetype is set to WHOLE with an ID specified.

bandwidth_share_type

String

Bandwidth sharing type. Enumerated values: PER (indicates exclusive bandwidth) and WHOLE (indicates sharing). The default value is PER.

Table 9 disk information

Parameter

Type

Description

index

Integer

Disk number, starting from 0

name

String

Disk name

disktype

String

Disk type. The value is the same as that of volumetype.

size

Integer

Disk size (GB)

Example

  • Example request
    GET  v1/sms/vm/template/90c950d7-d184-4b5e-87c0-f0bd09dfa0c1
  • Example response
    {
        "template": {
            "id":"aaaa-bbbb",
            "name": "template name",
            "is_template":"false",// false indicates creating a task, and true indicates saving the template.
            
            
            
            
            "region":"my-kualalumpur-1",
            
            "target_server_name":"target server 1",
            "availability_zone":"az1-dc1", //AZ name
            "volumetype": "DESS_SSD_FC",
            "vpc": {
              "id":"0dae26c9-9a70-4392-93f3-87d53115d171",
              "name":"vpc1" 
            },
            "security_groups":[
              {
    	    "id":"507ca48f-814c-4293-8706-300564d54620", 
                "name":"default"
    	   }
             ], 
            "nics":[
              {
                "id":"157ee789-03ea-45b1-a698-76c92660dd83",
                "name": "subnet-1637",
                "cidr": "192.168.0.0/24",
    	    "ip":"192.168.0.0"
               }
            ],
            "flavors":[
              {
                "id": "c3.2xlarge.4",
    	    "name": "c3.2xlarge.4",
              }
            ],
            "publicip":  {
                 "id":"1111",
                 "ip ":"x.x.x.x",
                 "type": "5_bgp",
                 "bandwidth_size":10,
                 "bandwidth_share_type":"PER"
            }
        },
        "disks":[
          {
            "index":0,
            "name":"Disk 01",
            "disktype":"DESS_SSD_FC",
            "size":40
         }
        ]
    }

Status Codes

See Status Codes.