Querying Instance Specifications
Function
This API is used to query the instance specifications supported by IoTDA. For details about the supported instance specifications, see Specifications.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
URI
GET /v5/iot/{project_id}/iotda-instances/flavors
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Parameter description : project ID. For details, see Obtaining a Project ID. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| offset | No | Integer | Parameter description: If offset is set to N, the query starts from the N+1 record after the last record in the previous query. The value is an integer ranging from 0 to 500. The default value is 0. If offset is set to 0, the output starts from the first record after the last record in the previous query. - To ensure API performance, you can use this parameter together with marker to turn pages. For example, if there are 50 records on each page, you can directly specify offset to jump to the specified page within page 1 and 11. If you want to view records displayed on pages 12 to 22, you need to use the marker value returned on page 11 as the marker value for the next query. Value: an integer ranging from 0 to 500. The default value is 0. |
| limit | No | Integer | Parameter description: number of records to display on each page. Value: an integer ranging from 1 to 500. The default value is 500. |
| marker | No | String | ID of the last record in the previous query. The value is returned by the platform during the previous query. Records are queried in descending order of record IDs (the marker value). A newer record will have a larger ID. If marker is specified, only the records whose IDs are smaller than marker are queried. If marker is not specified, the query starts from the record with the largest ID, that is, the latest record. If all data needs to be queried in sequence, this parameter must be filled with the value of marker returned in the last query response each time. |
| instance_type | No | String | Parameter description: instance type. Range: |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| page | Page object | Structure of the batch query result pagination. It defines page numbers, the number of records on each page, the total number of records, and ID of the last record on the current page. |
| flavors | Array of InstanceFlavor objects | Parameter description: details about IoTDA instance specifications. |
| Parameter | Type | Description |
|---|---|---|
| count | Long | Total number of records that meet the filter criteria. |
| marker | String | ID of the last record in this query, which can be used in the next query. |
| Parameter | Type | Description |
|---|---|---|
| instance_type | String | Parameter description : type of the instance to be created. For details about instance types, see Specifications. Range: |
| type | String | Parameter description : name of the IoTDA instance specifications. For details, see Specifications. |
| status | String | Parameter description: on-sale status of the instance specifications. Range: |
| charge_modes | Array of strings | Parameter description: payment modes supported by the instance specifications. Range: |
Example Requests
Queries the instance specifications list.
GET https://{endpoint}/v5/iot/{project_id}/iotda-instances/flavors Example Responses
Status code: 200
OK
{
"page" : {
"count" : 1,
"marker" : 1805431584415871305
},
"flavors" : [ {
"instance_type" : "standard"
}, {
"type" : "iotda.standard.s2"
}, {
"status" : "normal"
}, {
"charge_modes" : [ "prePaid", "postPaid" ]
} ]
} SDK Sample Code
The SDK sample code is as follows.
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.iotdm.v5.region.IoTDMRegion; import com.huaweicloud.sdk.iotdm.v5.*; import com.huaweicloud.sdk.iotdm.v5.model.*; public class ListInstanceFlavorsSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); IoTDMClient client = IoTDMClient.newBuilder() .withCredential(auth) .withRegion(IoTDMRegion.valueOf("<YOUR REGION>")) .build(); ListInstanceFlavorsRequest request = new ListInstanceFlavorsRequest(); try { ListInstanceFlavorsResponse response = client.listInstanceFlavors(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkiotdm.v5.region.iotdm_region import IoTDMRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkiotdm.v5 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = IoTDMClient.new_builder() \ .with_credentials(credentials) \ .with_region(IoTDMRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListInstanceFlavorsRequest() response = client.list_instance_flavors(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" iotdm "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/iotdm/v5/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := iotdm.IoTDMClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := iotdm.NewIoTDMClient(hcClient) request := &model.ListInstanceFlavorsRequest{} response, err := client.ListInstanceFlavors(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot