Querying DeHs

Function

This API is used to query the DeH list.

URI

GET /v1.0/{project_id}/dedicated-hosts

Table 1 describes the parameters.

Table 1 Parameters description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies the project ID.

For details about how to obtain the project ID, see Obtaining Required Information.

Request

You can add parameters host_type, host_type_name, flavor, dedicated_host_id, state, tenant, availability_zone, name, limit, marker, tags, instance_uuid, or changes-since to the URI to filter the search result,

for example, /v1.0/{project_id}/dedicated-hosts?host_type={host_type}&state={state}.

Table 2 Request parameters

Parameter

In

Type

Mandatory

Description

dedicated_host_id

query

String

No

Specifies the DeH ID.

name

query

String

No

Specifies the DeH name.

host_type

query

String

No

Specifies the DeH type.

host_type_name

query

String

No

Specifies the name of the DeH type.

flavor

query

String

No

Specifies the flavor ID.

state

query

String

No

Specifies the DeH status.

The value can be available, fault, or released.

tenant

query

String

No

The value can be a tenant ID or all.

Only users with the DeH administrator permissions can specify this parameter.

availability_zone

query

String

No

Specifies the AZ to which the DeH belongs.

limit

query

String

No

Specifies the number of records displayed per page.

marker

query

String

No

Specifies the ID of the last record on the previous page. If the marker value is invalid, status code 400 is returned.

tags

query

String

No

Specifies the DeH tags.

instance_uuid

query

String

No

Specifies the ID of the ECS on the DeH.

changes-since

query

String

No

Filters the response by date and timestamp when the DeH status changes. To help keep track of changes, this parameter may also display recently deleted DeHs.

The format of the date and timestamp is ISO 8601:

CCYY-MM-DDThh:mm:ss±hh:mm

If the hh:mm value is included, the time zone is returned as the UTC offset, for example, 2015-08-27T09:49:58-05:00. If you omit the time zone, the UTC time zone is assumed.

Response

Table 3 Response parameters

Parameter

In

Type

Description

dedicated_hosts

body

Array of objects

Specifies the DeHs that meet the search criteria.

For details, see Table 1.

total

body

Integer

Specifies the quantity of DeHs that meet the search criteria.

Example Request

Query the DeHs in the available state.

GET https://{Endpoint}/v1.0/9c53a566cb3443ab910cf0daebca90c4/dedicated-hosts?state=available

Example Response

{
    "dedicated_hosts": [
        {
            "dedicated_host_id": "d465d0ae-f859-4a83-a508-8db654c05e7e",
            "name": "DEH001",
            "auto_placement": "off",
            "availability_zone": "eu-de-01",
            "host_properties": {
                "vcpus": 74,
                "cores": 22,
                "sockets": 2,
                "memory": 303104,
                "host_type": "c4",
                "host_type_name": "dedicated_general_purpose",
                "available_instance_capacities": [
                    {
                        "flavor": "c4.large.4"
                    },
                    {
                        "flavor": "c4.xlarge.4"
                    },
                    {
                        "flavor": "c4.2xlarge.4"
                    },
                    {
                        "flavor": "c4.3xlarge.4"
                    },
                    {
                        "flavor": "c4.6xlarge.4"
                    },
                    {
                        "flavor": "c4.16xlarge.4"
                    }
                ]
            },
            "state": "available",
            "project_id": "9c53a566cb3443ab910cf0daebca90c4",
            "available_vcpus": 20,
            "available_memory": 81920,
            "instance_total": 5,
            "allocated_at": "2016-10-10T14:35:47Z",
            "released_at": null
            }
            ],
    "total": 1
}

Status Code

See Status Codes.