developer guide - huawei cloud · sdk acquisition and installation add the following maven...

153
SDK Developer Guide Issue 05 Date 2020-05-18 HUAWEI TECHNOLOGIES CO., LTD.

Upload: others

Post on 10-Oct-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

SDK

Developer Guide

Issue 05

Date 2020-05-18

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. i

Page 3: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Contents

1 SDK Overview........................................................................................................................... 1

2 Java............................................................................................................................................. 22.1 Getting Started with Java SDK........................................................................................................................................... 22.2 Using the Java SDK................................................................................................................................................................. 42.2.1 Java SDK Authentication Modes.....................................................................................................................................42.2.2 Java SDK Service Endpoint Configuration................................................................................................................... 72.2.3 Java SDK Troubleshooting.................................................................................................................................................82.3 IAM Java SDK Demo.............................................................................................................................................................. 82.4 IMS Java SDK Demo............................................................................................................................................................... 92.5 VPC Java SDK Demo............................................................................................................................................................ 102.6 ECS Java SDK Demo............................................................................................................................................................. 112.7 EVS Java SDK Demo............................................................................................................................................................. 122.8 AS Java SDK Demo............................................................................................................................................................... 132.9 Cloud Eye Java SDK Demo.................................................................................................................................................132.10 ELB Java SDK Demo...........................................................................................................................................................142.11 CTS Java SDK Demo.......................................................................................................................................................... 142.12 CDN Java SDK Demo.........................................................................................................................................................162.13 BSS Java SDK Demo.......................................................................................................................................................... 162.14 TMS Java SDK Demo......................................................................................................................................................... 172.15 EPS Java SDK Demo...........................................................................................................................................................172.16 RDS Java SDK Demo..........................................................................................................................................................17

3 Python...................................................................................................................................... 193.1 Getting Started with Python SDK....................................................................................................................................193.2 Using the Python SDK......................................................................................................................................................... 213.2.1 Installing the Python SDK...............................................................................................................................................213.2.2 Python SDK Authentication Modes............................................................................................................................. 213.2.3 Python SDK Configuration on the Client.................................................................................................................. 243.2.4 Python SDK Service Endpoint Configuration........................................................................................................... 243.2.5 Python SDK Troubleshooting.........................................................................................................................................253.2.6 Common Parameters of Python SDK......................................................................................................................... 253.3 IAM Python SDK Demo.......................................................................................................................................................263.4 IMS Python SDK Demo....................................................................................................................................................... 27

SDKDeveloper Guide Contents

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. ii

Page 4: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

3.5 VPC Python SDK Demo....................................................................................................................................................... 283.6 ECS Python SDK Demo....................................................................................................................................................... 293.7 EVS Python SDK Demo....................................................................................................................................................... 303.8 AS Python SDK Demo......................................................................................................................................................... 303.9 Cloud Eye Python SDK Demo........................................................................................................................................... 313.10 ELB Python SDK Demo..................................................................................................................................................... 313.11 RDS Python SDK Demo.................................................................................................................................................... 323.12 CDN Python SDK Demo................................................................................................................................................... 323.13 BSS Python SDK Demo..................................................................................................................................................... 333.14 TMS Python SDK Demo................................................................................................................................................... 333.15 EPS Python SDK Demo..................................................................................................................................................... 34

4 Go.............................................................................................................................................. 354.1 Getting Started with Go SDK............................................................................................................................................ 354.2 Using the Go SDK................................................................................................................................................................. 384.2.1 Go SDK Authentication Modes..................................................................................................................................... 384.2.2 Go SDK Troubleshooting................................................................................................................................................. 424.3 ECS Go SDK User Guide...................................................................................................................................................... 424.4 EVS Go SDK User Guide......................................................................................................................................................434.5 VPC Go SDK User Guide..................................................................................................................................................... 434.6 IAM Go SDK User Guide..................................................................................................................................................... 444.7 IMS Go SDK User Guide..................................................................................................................................................... 454.8 Cloud Eye Go SDK User Guide......................................................................................................................................... 474.9 RDS Go SDK User Guide..................................................................................................................................................... 474.10 BSS Go SDK User Guide................................................................................................................................................... 48

5 SDK-related FAQ.................................................................................................................... 495.1 How Can I Create a Key Pair on the Console?............................................................................................................495.2 How Can I Create a Security Group?............................................................................................................................. 495.3 How Do I Obtain the Username, Account ID, and Project ID?............................................................................. 50

A Mappings Between APIs and SDKs................................................................................... 51A.1 Java............................................................................................................................................................................................ 51A.1.1 IAM.........................................................................................................................................................................................51A.1.2 IMS......................................................................................................................................................................................... 57A.1.3 VPC......................................................................................................................................................................................... 58A.1.4 ECS......................................................................................................................................................................................... 65A.1.5 EVS......................................................................................................................................................................................... 73A.1.6 AS............................................................................................................................................................................................76A.1.7 Cloud Eye............................................................................................................................................................................. 79A.1.8 ELB......................................................................................................................................................................................... 80A.1.9 CTS......................................................................................................................................................................................... 83A.1.10 CDN..................................................................................................................................................................................... 84A.1.11 BSS....................................................................................................................................................................................... 86

SDKDeveloper Guide Contents

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. iii

Page 5: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

A.1.12 TMS..................................................................................................................................................................................... 90A.1.13 EPS....................................................................................................................................................................................... 91A.1.14 RDS...................................................................................................................................................................................... 92A.2 Python...................................................................................................................................................................................... 93A.2.1 IAM.........................................................................................................................................................................................93A.2.2 IMS......................................................................................................................................................................................... 97A.2.3 VPC......................................................................................................................................................................................... 98A.2.4 ECS....................................................................................................................................................................................... 104A.2.5 EVS....................................................................................................................................................................................... 109A.2.6 AS......................................................................................................................................................................................... 110A.2.7 CES....................................................................................................................................................................................... 113A.2.8 ELB....................................................................................................................................................................................... 114A.2.9 RDS...................................................................................................................................................................................... 116A.2.10 CDN................................................................................................................................................................................... 118A.2.11 BSS.....................................................................................................................................................................................123A.2.12 TMS................................................................................................................................................................................... 126A.2.13 EPS..................................................................................................................................................................................... 127A.3 Go............................................................................................................................................................................................ 127A.3.1 ECS....................................................................................................................................................................................... 127A.3.2 EVS....................................................................................................................................................................................... 132A.3.3 VPC...................................................................................................................................................................................... 133A.3.4 IAM...................................................................................................................................................................................... 139A.3.5 IMS....................................................................................................................................................................................... 139A.3.6 RDS...................................................................................................................................................................................... 140A.3.7 BSS....................................................................................................................................................................................... 142A.3.8 CES....................................................................................................................................................................................... 147

B Change History.................................................................................................................... 148

SDKDeveloper Guide Contents

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. iv

Page 6: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

1 SDK Overview

A software development kit (SDK) contains code and examples that you use tocreate cloud applications in the language of your choice.

Currently, the SDK supports Java, Python, and languages. If one of the followingSDKs do not support your language or examples, you can use the APIs or anyother known SDKs.

SDKDeveloper Guide 1 SDK Overview

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 1

Page 7: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

2 Java

2.1 Getting Started with Java SDKWelcome to use HUAWEI CLOUD developer tools (Java SDK). Java SDK allows youto easily access cloud services using codes.

This tutorial describes how to install and use Java SDK and provides examples tohelp you quickly get started.

The supported Java SDK is developed based on OpenStack4j.

Supported Cloud Services

The Java SDK supports the following cloud services:

Identity and AccessManagement (IAM)

Image ManagementService (IMS)

Virtual Private Cloud(VPC)

Elastic Cloud Server(ECS)

Elastic Volume Service(EVS)

Auto Scaling (AS)

Cloud Eye (CES) Elastic Load Balancing(ELB)

Cloud Trace Service(CTS)

Operation Capability(BSSINTL)

Content DeliveryNetwork (CDN)

Tag ManagementService (TMS)

EnterpriseManagement (EPS)

Relational DatabaseService (RDS)

N/A

Prerequisites1. You have obtained a cloud platform account and provisioned all required

services.2. You have installed JDK. The Java SDK is applicable to JDK1.8 and later

versions. You are advised to use JDK1.8.

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 2

Page 8: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

SDK Acquisition and InstallationAdd the following Maven dependency to the pom.xml file to install the Java SDK:

<dependency><groupId>com.huawei</groupId><artifactId>openstack4j</artifactId><version>1.0.12</version></dependency>

For the latest version supported by Java SDK, see here.

The services involved in this document use the same JAR file.

How to UseSet parameters, initialize the SDK client, and invoke the SDK to access the serviceAPI. For details about the parameters, see Table 2-1.

package demo;

import java.util.HashMap;import java.util.List;import java.util.Map;

import com.huawei.openstack4j.openstack.OSFactory;import com.huawei.openstack4j.api.OSClient.OSClientV3;import com.huawei.openstack4j.core.transport.Config;import com.huawei.openstack4j.model.common.Identifier;import com.huawei.openstack4j.model.compute.Server;

public class Demo { public static void main(String[] args) { // Set the authentication parameters. String authUrl = "https://iam.example.com/v3";//endpointUrl String user = "replace-with-your-username";//username String password = "replace-with-your-password";//user password String projectId = "replace-with-your-projectId";//project ID String userDomainId = "replace-with-your-domainId";//account ID

// Initialize the client. OSClientV3 os = OSFactory.builderV3() .endpoint(authUrl) .credentials(user, password, Identifier.byId(userDomainId)) .scopeToProject(Identifier.byId(projectId)).authenticate();

// Set query parameters. Map<String, String> filter = new HashMap<String, String>();

// Put the parameters that need to be entered into the filter. filter.put("limit", "3");

// Invoke the interface for querying the VM List. List<? extends Server> serverList = os.compute().servers().list(filter); if (serverList.size() > 0) { System.out.println("get serverList success, size = " + serverList.size()); for (Server server : serverList) { System.out.println(server); } } else { System.out.println("no server exists."); } }}

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 3

Page 9: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Table 2-1 Parameter description

Parameter

Description Example Value

authUrl Specifies the endpoint of theIAM service.example in https://iam.example.com/v3 indicatesRegion.Cloud platformdomain name. For detailsabout the parameter, seehere.

https://iam.cn-north-1.myhuaweicloud.com/v3

user Specifies the username. Fordetails about how to obtainthe username, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

password Specifies the user password. N/A

projectId Specifies the project ID. Fordetails about how to obtainthe project ID, see How Do IObtain the Username,Account ID, and Project ID?.

None

userDomainId

Specifies the account ID. Fordetails about how to obtainthe account ID, see How Do IObtain the Username,Account ID, and Project ID?.

None

2.2 Using the Java SDK

2.2.1 Java SDK Authentication ModesJava SDK supports two authentication modes: token-based authentication andAK/SK authentication.

Token AuthenticationFor details about the code for token-based authentication, see Table 2-2.

package demo;

import java.util.HashMap;import java.util.List;import java.util.Map;

import com.huawei.openstack4j.openstack.OSFactory;import com.huawei.openstack4j.api.OSClient.OSClientV3;import com.huawei.openstack4j.core.transport.Config;

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 4

Page 10: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

import com.huawei.openstack4j.model.common.Identifier;import com.huawei.openstack4j.model.compute.Server;

public class Demo { public static void main(String[] args) { // Set the authentication parameters. String authUrl = "https://iam.example.com/v3";//endpointUrl String user = "replace-with-your-username";//username String password = "replace-with-your-password";//user password String projectId = "replace-with-your-projectId";//project ID String userDomainId = "replace-with-your-domainId";//account ID

// Initialize the client. OSClientV3 os = OSFactory.builderV3() .endpoint(authUrl) .credentials(user, password, Identifier.byId(userDomainId)) .scopeToProject(Identifier.byId(projectId)).authenticate();

// Set query parameters. Map<String, String> filter = new HashMap<String, String>();

// Put the parameters that need to be entered into the filter. filter.put("limit", "3");

// Invoke the interface for querying the VM List. List<? extends Server> serverList = os.compute().servers().list(filter); if (serverList.size() > 0) { System.out.println("get serverList success, size = " + serverList.size()); for (Server server : serverList) { System.out.println(server); } } else { System.out.println("no server exists."); } }}

Table 2-2 Parameter description

Parameter

Description Example Value

authUrl Specifies the endpoint of theIAM service.example in https://iam.example.com/v3 indicatesRegion.Cloud platformdomain name. For detailsabout the parameter, seehere.

https://iam.cn-north-1.myhuaweicloud.com/v3

user Specifies the username. Fordetails about how to obtainthe username, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

password Specifies the user password. N/A

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 5

Page 11: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Parameter

Description Example Value

projectId Specifies the project ID. Fordetails about how to obtainthe project ID, see How Do IObtain the Username,Account ID, and Project ID?.

None

userDomainId

Specifies the account ID. Fordetails about how to obtainthe account ID, see How Do IObtain the Username,Account ID, and Project ID?.

None

The validity period of a token is 24 hours. If your operation time exceeds 24 hours,before you use SDK to invoke APIs, you are advised to reapply the token accordingto the following method:

import com.huawei.openstack4j.openstack.OSFactory;OSFactory.refreshToken();

AK/SK AuthenticationFor details about the code for AK/SK authentication, see Table 2-3.

package demo;

import java.util.HashMap;import java.util.List;import java.util.Map;

import com.huawei.openstack4j.api.OSClient.OSClientAKSK;import com.huawei.openstack4j.core.transport.Config;import com.huawei.openstack4j.model.compute.Server;import com.huawei.openstack4j.openstack.OSFactory;

public class Demo { public static void main(String[] args) { // Set the authentication parameters. String ak = "replace-your-ak"; String sk = "replace-your-sk"; String projectId = "replace-your-projectId"; String region = "replace-your-region"; //example: region = "cn-north-1" String cloud = "myhuaweicloud.com"; OSClientAKSK osclient = OSFactory.builderAKSK().credentials(ak, sk, region, projectId, cloud) .authenticate(); // Set query parameters. Map<String , String> filter = new HashMap<String, String>(); // Put the parameters that need to be entered into the filter. filter.put("limit", "3"); // Invoke the interface for querying the VM List. List<? extends Server> serverList = osclient.compute().servers().list(filter); if(serverList.size() > 0) { System.out.println("get serverList success, size = " + serverList.size());

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 6

Page 12: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

for (Server server : serverList) { System.out.println(server); } } else { System.out.println("no server exists."); } }}

Table 2-3 Parameter description

Parameter

Description Example Value

ak/sk Specifies the AK/SK accesskey.NOTE

● AK/SK generation description:Log in to the managementconsole, choose MyCredentials, and click AccessKeys to create an AK and SK.

● The time error between theAK/SK signature time andUTC time cannot exceed 15minutes. Otherwise, theauthentication fails.

● If the AK/SK signature failsfor more than fiveconsecutive times, the AK/SKrequest of the source IPaddress is locked for 5minutes.

N/A

projectId Specifies the project ID. Fordetails about how to obtainthe project ID, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

region Specifies the region name. cn-north-1

cloud Specifies the cloud platformdomain name.

myhuaweicloud.com

2.2.2 Java SDK Service Endpoint ConfigurationWhen using SDK to invoke cloud service APIs, you need to obtain the address(endpoint) of each cloud service.

You can use Java SDK to automatically obtain the endpoints or manually encodethe endpoints.

The following are examples of manually encoding endpoints for cloud services:

endpointResolver.addOverrideEndpoint(ServiceType.CLOUD_EYE, "https://ces.xxx.yyy.com/V1.0/%(project_id)s");

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 7

Page 13: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

endpointResolver.addOverrideEndpoint(ServiceType.DNS, "https://dns.yyy.com");endpointResolver.addOverrideEndpoint(ServiceType.CDN, "https://cdn.yyy.com/v1.0");endpointResolver.addOverrideEndpoint(ServiceType.COMPUTE, "https://ecs.xxx.yyy.com/v2/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.NETWORK, "https://vpc.xxx.yyy.com");endpointResolver.addOverrideEndpoint(ServiceType.IMAGE, "https://ims.xxx.yyy.com");endpointResolver.addOverrideEndpoint(ServiceType.BLOCK_STORAGE, "https://evs.xxx.yyy.com/v2/%(project_id)s"");endpointResolver.addOverrideEndpoint(ServiceType.VOLUME_BACKUP, "https://vbs.xxx.yyy.com/v2/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.AUTO_SCALING, "https://as.xxx.yyy.com/autoscaling-api/v1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.LOAD_BALANCER, "https://elb.xxx.yyy.com/v1.0/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.MAP_REDUCE, "https://mrs.xxx.yyy.com/v1.1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.KEY_MANAGEMENT, "https://kms.xxx.yyy.com/v1.0/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.CLOUD_TRACE, "https://cts.xxx.yyy.com/v1.0/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.ANTI_DDOS, "https://antiddos.xxx.yyy.com/v1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.Notification, "https://smn.xxx.yyy.com/v2/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.MessageQueue, "https://dms.xxx.yyy.com/v1.0/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.MAAS, "https://maas.xxx.yyy.com/v1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.ECS, "https://ecs.xxx.yyy.com/v1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.ECS1_1, "https://ecs.xxx.yyy.com/v1.1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.EVS, "https://evs.xxx.yyy.com/v2/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.EVS2_1, "https://evs.xxx.yyy.com/v2.1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.VPC, "https://vpc.xxx.yyy.com/v1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.VPC2, "https://vpc.xxx.yyy.com/v2.0/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.IDENTITY, "https://iam.xxx.yyy.com/v3");endpointResolver.addOverrideEndpoint(ServiceType.ORCHESTRATION, "https://rts.xxx.yyy.com/v1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.NAT, "https://nat.xxx.yyy.com/v2.0");endpointResolver.addOverrideEndpoint(ServiceType.BMS, "https://bms.xxx.yyy.com/v1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.DEH, "https://deh.xxx.yyy.com/v1.0/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.CSBS, "https://csbs.xxx.yyy.com/v1/%(project_id)s");endpointResolver.addOverrideEndpoint(ServiceType.IAM, "https://iam.xxx.yyy.com/v3");

● example in the preceding code is in Region.Cloud platform domain nameformat. For details about the parameters, see here.

● In the preceding code, you do not need to replace the project_id value withthe actual value.

● Click here to obtain a complete code example of using Java SDK for reference.

2.2.3 Java SDK TroubleshootingExecute the following code to print the execution details of Java SDK:OSFactory.enableHttpLoggingFilter(true);

2.3 IAM Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see IAM.

For details about the parameters supported by SDK, see the description of IAMAPIs.

The IAM Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 8

Page 14: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

token Code

securitytoken Code

credential Code

region Code

project Code (Identity)Code (IAM)

domain Code

user Code (Identity)Code (IAM)

group Code

role Code

custom role Code

agency Code

version Code

service Code

endpoint Code

2.4 IMS Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the of IMS APIs.

The IMS v2 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

image Code

The Glance v2 Java SDK supports operations on the following resource objects.The following table lists the example code for adding, modifying, deleting, andquerying a resource.

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 9

Page 15: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

image Code

image member Code

2.5 VPC Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by the SDK when the VPC SDK is used,see the description of VPC APIs.

The VPC v1 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

bandwidth Code

port Code

private ip Code

public ip Code

quota Code

security group Code

security group rule Code

subnet Code

vpc Code

The VPC v2.0 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

bandwidth Code

public ip Code

The Neutron v2.0 Java SDK supports operations on the following resource objects.The following table lists the example code for adding, modifying, deleting, andquerying a resource.

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 10

Page 16: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

floating ip Code

network Code

port Code

route Code

security group Code

security group rule Code

subnet Code

2.6 ECS Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of ECSAPIs.

The ECS v1 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

cloudserver v1 Code

job Code

The ECS v1.1 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

cloudserver Code

The Nova v2 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

flavor Code

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 11

Page 17: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

floating ip Code

interface Code

keypair Code

quota set Code

security group Code

server Code

server group Code

zone Code

The following table lists the scenario example code provided by the ECS Java SDK:

Scenario Example code

create one or more servers Code

create server with password Code

2.7 EVS Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of EVSAPIs.

The EVS v2 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

volume Code

snapshot Code

job Code

The Cinder v2 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 12

Page 18: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

volume Code

snapshot Code

zone Code

transfer Code

2.8 AS Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see description.

For details about the parameters supported by SDK, see the description of ASAPIs.

The AS v1 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

group Code

configration Code

instance Code

lifecyclehook Code

log Code

notification Code

policy Code

quota Code

tag Code

2.9 Cloud Eye Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of CloudEye APIs.

The Cloud Eye V1.0 Java SDK supports the following resource. The table lists theexample code for adding, modifying, deleting, and querying a resource.

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 13

Page 19: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

metric Code

alarm Code

metric data Code

quota Code

2.10 ELB Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of ELBAPIs.

The ELB (Enhanced Load Balancer) v2 Java SDK supports operations on thefollowing resource objects. The following table lists the example code for adding,modifying, deleting, and querying a resource.

Resource Object Example Code

loadbalancer Code

listener Code

pool Code

member Code

healthmonitor Code

certificate Code

whitelist Code

l7policy Code

l7rule Code

2.11 CTS Java SDK Demo

TrackerA tracker will be created after CTS is enabled. All traces recorded by CTS areassociated with the tracker.

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 14

Page 20: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Creating a TrackerYou can create a tracker using OpenStack4j based on the following code.Currently, only one tracker system can be created.

public void CreateTracker() { Tracker create = osclient.cloudTraceV1().trackers().create(bucket_name,FilePrefixName); }

Deleting a TrackerYou can delete a tracker using OpenStack4j based on the following code:

public void DeleteTraker() {ActionResponse delete = osclient.cloudTraceV1().trackers().delete(tracker_name);Assert.assertTrue(delete.isSuccess());List<Tracker> trackers = osclient.cloudTraceV1().trackers().list();Assert.assertTrue(trackers.size() == 0);}

Updating a TrackerYou can update a tracker using OpenStack4j based on the following code. Theinformation that can be updated includes the bucket name, folder name, status,and the tracker name. The tracker name is optional and can be only system.

public void UpdateTraker() { TrackerUpdate update = TrackerUpdate.builder().trackerName(tracker_name) .bucketName(bucket_name).filePrefixName("SDK-unittest").status(TrackerStatus.Enabled").build(); Tracker updated = osclient.cloudTraceV1().trackers().update(update); }

Querying a TrackerYou can query a tracker using OpenStack4j based on the following code byspecifying tracker_name:

public void GetTraker() {Tracker get = osclient.cloudTraceV1().trackers().get(tracker_name);}

TraceThis interface is used to query records of operations on resources during the lastseven days.

Querying the Trace ListYou can query a trace list using OpenStack4j based on the following code. You canfilter out required traces by specifying multiple parameters.

/*v2interface*/publicvoidListTrace(){ TraceListOptionsoptions=TraceListOptions.create().limit(5).user("renxiaomei").serviceType("CTS"); List<Trace>list=osclient.cloudTraceV2().traces().list("system", options); if(list.size()>0){ Tracetrace=list.get(list.size()-1); options.marker(trace.getId()); List<Trace>list2=osclient.cloudTraceV2().traces().list("system", options); }}

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 15

Page 21: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

2.12 CDN Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of CDNAPIs.

The CDN Java SDK supports operations on the following resource objects.

Resource Object Example Code

Domain Code

Statistic Code

Log Code

2.13 BSS Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by BSS SDK, see the PartnerOperation Capability API and Customer Operation Capability API of BSS APIs.

The BSS v1 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

customer management Code

realname auth Code

enquiry Code

period order Code

period resource Code

credit Code

pay-per-use resource Code

bill Code

utilities Code

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 16

Page 22: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

2.14 TMS Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by TMS SDK, see the description.

The TMS v1 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

Tag management Code

2.15 EPS Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

The EPS v1 Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

EnterpriseProject management Code

2.16 RDS Java SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by RDS SDK, see description of RDSAPIs.

The RDS Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

Rds Instance management Code

The following table lists the code provided by SDK.

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 17

Page 23: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Scenario Example Code

Rds Backup and Restore Code

Rds Param Configurtion Code

SDKDeveloper Guide 2 Java

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 18

Page 24: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

3 Python

3.1 Getting Started with Python SDKWelcome to use HUAWEI CLOUD developer tools (Python SDK). Python SDKallows you to easily access cloud services using codes.

This tutorial describes how to install and use Python SDK and provides examplesto help you quickly get started.

The supported Python SDK is developed based on the Python OpenStack SDK.

Supported Cloud Services

The Python SDK supports the following cloud services:

Identity and AccessManagement (IAM)

Image ManagementService (IMS)

Virtual Private Cloud(VPC)

Elastic Cloud Server(ECS)

Elastic Volume Service(EVS)

Auto Scaling (AS)

Cloud Eye (CES) Elastic Load Balancing(ELB)

BSS Python SDKDemoOperationCapability (BSSINTL)

Content DeliveryNetwork (CDN)

Tag ManagementService (TMS)

EnterpriseManagement (EPS)

Prerequisites1. You have obtained a cloud platform account and provisioned all required

services.

2. You have installed Python, pip, and git. Python SDK is applicable to Python2.7.10 to 2.7.15 and 3.4 to 3.7.

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 19

Page 25: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

SDK Acquisition and InstallationIf the pip is used for installation, run the following command:

pip install huaweicloud-sdk-python

How to UseSet parameters, create connections, and invoke the SDK to access the service API.For details about the parameters, see Table 3-1.

# -*- coding:utf-8 -*-from openstack import connection

# create connectionusername = "replace-with-your-username" # usernamepassword = "replace-with-your-password" # user passwordprojectId = "replace-with-your-projectId" # project IDuserDomainId = "replace-with-your-domainId" # account IDauth_url = "https://iam.example.com/v3" # endpoint urlconn = connection.Connection(auth_url=auth_url, user_domain_id=userDomainId, project_id=projectId, username=username, password=password)

# set parameterslimit = 5

# define function for listing serversdef list_servers(): # get server list with params servers = conn.compute.servers(limit=limit) # iterate servers list for server in servers: print(server)

# visit APIlist_servers()

Table 3-1 Parameter description

Parameter

Description Example Value

auth_url Specifies the endpoint of theIAM service.example in the https://iam.example.com/v3,indicates the Region.Cloudplatform domain name. Fordetails about the parameter,see here.

https://iam.cn-north-1.myhuaweicloud.com/v3

username Specifies the username. Fordetails about how to obtainthe username, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

password Specifies the user password. N/A

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 20

Page 26: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Parameter

Description Example Value

projectId Specifies the project ID. Fordetails about how to obtainthe project ID, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

userDomainId

Specifies the account ID. Fordetails about how to obtainthe account ID, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

3.2 Using the Python SDK

3.2.1 Installing the Python SDKThe Python SDK provides GitHub and pip two installation modes.

Method 1: Downloading the GitHub Source Code

Download the code to a proper position of your project. Use pythonsdk as anexample. Run the following commands to download the source code and installthe SDK:

git clone https://github.com/huaweicloud/huaweicloud-sdk-python pythonsdk

cd pythonsdk

pip install -r requirements.txt

python setup.py install

Method 2: Run the Following Command:

pip install huaweicloud-sdk-python

3.2.2 Python SDK Authentication ModesPython SDK supports two authentication modes: token-based authentication andAK/SK authentication.

Token AuthenticationFor details about the code for token-based authentication, see Table 3-2.

# -*- coding:utf-8 -*-from openstack import connection

# create connection

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 21

Page 27: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

username = "replace-with-your-username" # usernamepassword = "replace-with-your-password" # user passwordprojectId = "replace-with-your-projectId" # project IDuserDomainId = "replace-with-your-domainId" # account IDauth_url = "https://iam.example.com/v3" # endpoint urlconn = connection.Connection(auth_url=auth_url, user_domain_id=userDomainId, project_id=projectId, username=username, password=password)

# set parameterslimit = 5

# define function for listing serversdef list_servers(): # get server list with params servers = conn.compute.servers(limit=limit) # iterate servers list for server in servers: print(server)

# visit APIlist_servers()

Table 3-2 Parameter description

Parameter

Description Example Value

auth_url Specifies the endpoint of theIAM service.example in the https://iam.example.com/v3,indicates the Region.Cloudplatform domain name. Fordetails about the parameter,see here.

https://iam.cn-north-1.myhuaweicloud.com/v3

username Specifies the username. Fordetails about how to obtainthe username, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

password Specifies the user password. N/A

projectId Specifies the project ID. Fordetails about how to obtainthe project ID, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

userDomainId

Specifies the account ID. Fordetails about how to obtainthe account ID, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 22

Page 28: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

AK/SK Authentication

For details about the code for AK/SK authentication, see Table 3-3.

#encoding=utf-8

from openstack import connection

projectId = "***"cloud = "myhuaweicloud.com"region= "***" # example: region = "cn-north-1"AK = "***"SK = "***"

conn = connection.Connection( project_id=projectId, cloud=cloud, region=region, ak = AK, sk = SK)

def test_compute(): servers = conn.compute.servers(limit = 3) for server in servers: print server

if __name__ == "__main__": test_compute()

Table 3-3 Parameter description

Parameter

Description Example Value

ak/sk Specifies the AK/SK accesskey.NOTE

● AK/SK generation description:Log in to the managementconsole, choose MyCredentials, and click AccessKeys to create an AK and SK.

● The time error between theAK/SK signature time andUTC time cannot exceed 15minutes. Otherwise, theauthentication fails.

● If the AK/SK signature failsfor more than fiveconsecutive times, the AK/SKrequest of the source IPaddress is locked for 5minutes.

N/A

project_id Specifies the project ID. Fordetails about how to obtainthe project ID, see How Do IObtain the Username,Account ID, and Project ID?.

N/A

region Specifies the region name. cn-north-1

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 23

Page 29: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Parameter

Description Example Value

cloud Specifies the cloud platformdomain name.

myhuaweicloud.com

3.2.3 Python SDK Configuration on the ClientSome functions supported by SDK can be enabled or disabled throughconfiguration.

Sample code

conn = connection.Connection(auth_url=auth_url, user_domain_id=userDomainId, project_id=projectId, username=username, password=password, verify=False)

Currently, the following custom parameters are supported.

Parameter Default Value FunctionDescription

Remarks

verify True SSL check You are advised toset verify to True.

3.2.4 Python SDK Service Endpoint ConfigurationWhen using SDK to invoke cloud service APIs, you need to obtain the address(endpoint) of each cloud service.

You can use Python SDK to automatically obtain the endpoints or manuallyencode the endpoints.

The following are examples of manually encoding endpoints for cloud services:

os.environ.setdefault( 'OS_CLOUD_EYE_ENDPOINT_OVERRIDE', 'https://ces.example.com/V1.0/%(project_id)s')os.environ.setdefault( 'OS_AUTO_SCALING_ENDPOINT_OVERRIDE', ('https://as.example.com' '/autoscaling-api/v1/%(project_id)s'))os.environ.setdefault( 'OS_DNS_ENDPOINT_OVERRIDE', 'https://dns.example.com/v2')os.environ.setdefault( 'OS_VOLUME_BACKUP_ENDPOINT_OVERRIDE', 'https://vbs.example.com/v2/%(project_id)s')os.environ.setdefault(

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 24

Page 30: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

'OS_ELBV1_ENDPOINT_OVERRIDE', 'https://elb.example.com/v1.0/%(project_id)s')os.environ.setdefault( 'OS_MAP_REDUCE_ENDPOINT_OVERRIDE', 'https://mrs.example.com/v1.1/%(project_id)s')os.environ.setdefault( 'OS_CTS_ENDPOINT_OVERRIDE', 'https://cts.example.com/v1.0/%(project_id)s')os.environ.setdefault( 'OS_SMN_ENDPOINT_OVERRIDE', 'https://smn.example.com/v2/%(project_id)s')os.environ.setdefault( 'OS_MAAS_ENDPOINT_OVERRIDE', 'https://maas.example.com/v1/%(project_id)s')os.environ.setdefault( 'OS_KMS_ENDPOINT_OVERRIDE', 'https://kms.example.com/v1.0/%(project_id)s')os.environ.setdefault( 'OS_ANTI_DDOS_ENDPOINT_OVERRIDE', 'https://antiddos.example.com/v1/%(project_id)s')os.environ.setdefault( 'OS_DMS_ENDPOINT_OVERRIDE', 'https://dms.example.com/v1.0/%(project_id)s')os.environ.setdefault( 'OS_RDSV1_ENDPOINT_OVERRIDE', 'https://rds.example.com/v3/%(project_id)s')os.environ.setdefault( 'OS_CDN_ENDPOINT_OVERRIDE', 'https://cdn.example.com/v1.0')

● example in the preceding code is in Region.Cloud platform domain nameformat. For details about the parameter, see here.

● In the preceding code, you do not need to replace the project_id value withthe actual value.

● Click here to obtain a complete code example of using Python SDK forreference.

3.2.5 Python SDK TroubleshootingTo enable the debugging function using Python SDK, add the following code tothe application:

from openstack import utilsutils.enable_logging(debug=True,stream=sys.stdout)

3.2.6 Common Parameters of Python SDKThe Python SDK supports some common parameters. They are used as follows:

ignore_missing

This parameter is usually displayed in the delete interface of a service. The defaultvalue is True. For example:

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 25

Page 31: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

delete_flavor(self, flavor, ignore_missing=True)

delete_image(self, image, ignore_missing=True)

If this parameter is set to True and the deleted resource does not exist, noexception information is displayed and thrown.

If this parameter is set to False and the deleted resource does not exist, theopenstack.exceptions.ResourceNotFound exception will be thrown. If theexception is not handled, the program stops abnormally.

details

This parameter is usually displayed in the interface for obtaining the detailedresource list. For example:

flavors(self, details=True, **query)

images(self, details=True, **query)

Only the resources that support /detail interface can be imported.

If this parameter is set to True and the URI of the requested resource is {RES} /details, return the detailed information of the resource.

If this parameter is set to False and the URI of the requested resource is {RES},return the most basic information of the resource.

limit

This parameter is usually displayed in the interface for obtaining the detailedresource list. For example:

flavors(self, details=True, limit = 5)

images(self, details=True, limit = 10)

When the limit parameter is imported, the returned results are displayed in pages.The number of returned results equates the limit value.

If the limit parameter is not imported, the query results are returned once.

3.3 IAM Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see IAM.

For details about the parameters supported by SDK, see the description IAM API.

The IAM Python SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

authtoken Code

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 26

Page 32: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

securitytoken Code

credential Code

region Code

project Code (Identity)Code (IAM)

domain Code

user Code (Identity)Code (IAM)

group Code

role Code

customrole Code

agency Code

version Code

service Code

endpoint Code

3.4 IMS Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the of IMS APIs.

The IMS v2 Python SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

image Code

The Glance v2 Python SDK supports operations on the following resource objects.The following table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

image Code

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 27

Page 33: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

image member Code

3.5 VPC Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by the SDK when the VPC SDK is used,see the description of VPC APIs.

The VPC v1 Python SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

bandwidth Code

port Code

private ip Code

public ip Code

quota Code

security group Code

security group rule Code

subnet Code

vpc Code

The VPC v2.0 Python SDK supports operations on the following resource objects.The following table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

sharebandwidth Code

The Neutron v2.0 Python SDK supports operations on the following resourceobjects. The following table lists the example code for adding, modifying, deleting,and querying a resource.

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 28

Page 34: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

floating ip Code

network Code

port Code

route Code

security group Code

security group rule Code

subnet Code

3.6 ECS Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of ECSAPIs.

The ECS Java SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

availability zone Code

flavor Code

job Code

keypair Code

server (v2) Code

server group Code

server interface Code

server ip Code

server tag Code

cloudserver (v1.1) Code

cloudserver (v1) Code

The following table lists the scenario example codes provided by the ECS JavaSDK:

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 29

Page 35: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Scenario Example Code

create one or more servers Code

create server with password Code

3.7 EVS Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see EVS.

For details about the parameters supported by SDK, see the description of EVSAPIs.

The EVS v2 Python SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

ResourceObject

Example Code

volume Code

The Cinder v2 Python SDK supports operations on the following resource objects.The following table lists the example code for adding, modifying, deleting, andquerying a resource.

ResourceObject

Example Code

volume Code

snapshot Code

type Code

3.8 AS Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see AS.

For details about the parameters supported by SDK, see the description of ASAPIs.

The AS v1 Python SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 30

Page 36: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

group Code

config Code

hook Code

instance Code

policy Code

quota Code

activity Code

3.9 Cloud Eye Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of CloudEye APIs.

The Cloud Eye V1.0 Python SDK supports the following resource. The table lists theexample code for adding, modifying, deleting, and querying a resource.

Resource Object Example Code

metric Code

alarm Code

metric data Code

quota Code

3.10 ELB Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of ELBAPIs.

The ELB (Enhanced Load Balancer) v2 Python SDK supports operations on thefollowing resource objects. The following table lists the example code for adding,modifying, deleting, and querying a resource.

Resource Object Example Code

loadbalacner Code

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 31

Page 37: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

listener Code

pool Code

member Code

healthmonitor Code

certificate Code

l7policy Code

l7rule Code

whitelist Code

3.11 RDS Python SDK DemoRelational Database Service (RDS) is a cloud-based web service that is reliable,scalable, easy to manage, and immediately ready for use.

The SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see RDS.

For details about the parameters supported by SDK, see the Relational DatabaseService API Reference.

The RDS v3 Python SDK supports operations on the following resource objects:

Resource Object Example Code

backup Code

config Code

instance Code

log Code

3.12 CDN Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of CDNAPIs.

The CDN Python SDK supports operations on the following resource objects.

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 32

Page 38: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

Acceleration domain name Code

Statistic Code

Log Code

Preheating task Code

Refreshing task Code

Query task Code

3.13 BSS Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by BSS SDK, see the PartnerOperation Capability API and Customer Operation Capability API of BSS APIs.

The BSS v1 Python SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

customer management Code

realname auth Code

enquiry Code

period order Code

period resourse Code

pay-per-use resource Code

bill Code

utilities Code

credit Code

3.14 TMS Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by TMS SDK, see the description.

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 33

Page 39: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

The TMS v1 Python SDK supports operations on the following resource objects.The following table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

Tag management Code

3.15 EPS Python SDK DemoThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

The EPS v1 Python SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

EnterpriseProject management Code

SDKDeveloper Guide 3 Python

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 34

Page 40: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

4 Go

4.1 Getting Started with Go SDKWelcome to use HUAWEI CLOUD developer tools (Go SDK). Go SDK allows you toeasily access cloud services using codes.

This tutorial describes how to install and use Go SDK and provides examples tohelp you quickly get started.

The Go SDK is developed based on Gophercloud.

Supported Cloud ServicesThe Go SDK supports the following cloud services:

Elastic Cloud Server(ECS)

Elastic Volume Service(EVS)

Virtual Private Cloud(VPC)

Identity and AccessManagement (IAM)

Image ManagementService (IMS)

Operation Capability(BSSINTL)

Prerequisites1. You have obtained a cloud platform account and provisioned all required

services.2. If Go SDK is used, Go 1.9.1 is recommended.

SDK Acquisition and InstallationYou can download the source code of Go SDK at the following Github websites:

https://github.com/huaweicloud/huaweicloud-sdk-release/tree/master/go-sdk

Perform the installation on the Linux OS:

Before the installation, ensure that the GOPATH environment variable points tothe target directory of Gophercloud to be installed.

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 35

Page 41: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

mkdir $HOME/gomkdir -p $HOME/go/srcexport GOPATH=$HOME/go

Download the source code package. Decompress it and install it in the srcdirectory of the go. Run the go build command.

# unzip source codeunzip -d $GOPATH/src xxxxxx.zip#run go build cd $GOPATH/src/github.com/gophercloud/gophercloudgo build

How to UseBefore making a call to the SDK to access service APIs, you need to configureparameters and complete authentication. For details about the parameters, seeTable 4-1.

package main

import ( "github.com/gophercloud/gophercloud/auth/token" "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" "github.com/gophercloud/gophercloud/openstack" "fmt")

func main() {// Set the authentication parameters. tokenOpts := token.TokenOptions{ IdentityEndpoint: "https://iam.example.com/v3", Username: "{username}", Password: "{password}", DomainID: "{domainid}", ProjectID: "{projectid}", }// Initialize the provider client. provider, providerErr := openstack.AuthenticatedClient(tokenOpts) if providerErr != nil { fmt.Println("init provider client error:", providerErr) panic(providerErr) }

// Initialize the service client. sc, serviceErr := openstack.NewComputeV2(provider, gophercloud.EndpointOpts{}) if serviceErr != nil { fmt.Println("init compute service client error:", serviceErr) panic(serviceErr) }

// List all servers. allPages, err := servers.List(sc, servers.ListOpts{}).AllPages()

if err != nil { fmt.Println("request server list error:", err) panic(err) }// Parse the return values. allServers, err := servers.ExtractServers(allPages) if err != nil { fmt.Println("extract response data error:", err) if ue, ok := err.(*gophercloud.UnifiedError); ok { fmt.Println("ErrCode:", ue.ErrorCode()) fmt.Println("Message:", ue.Message()) }

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 36

Page 42: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

return }// Print the information. fmt.Println("List Servers:") for _, s := range allServers { fmt.Println("server ID is :", s.ID) fmt.Println("server name is :", s.Name) fmt.Println("server Status is :", s.Status) fmt.Println("server AvailbiltyZone is :", s.AvailbiltyZone) }}

● ProviderClient is the top-level client required by all OpenStack services. Theclient contains all authentication details, such as the URL and token ID. Afterthe authentication, the compiled Go code can access the APIs.

● The Service Client of a service is required if you need to access this service. Fordetails, see the related chapter about this service in this document.

Table 4-1 Parameter description

Parameter Description Example Value

IdentityEndpoint

Specifies the endpoint of theIAM service.example in https://iam.example.com/v3indicates Region.Cloudplatform domain name. Fordetails about the parameter,see here.

https://iam.cn-north-1.myhuaweicloud.com/v3

Username Specifies the username. Fordetails about how to obtainthe username, see How Do IObtain the Username,Account ID, and ProjectID?.

N/A

Password Specifies the user password. N/A

ProjectID Specifies the project ID. Fordetails about how to obtainthe project ID, see How Do IObtain the Username,Account ID, and ProjectID?.

N/A

DomainID Specifies the account ID. Fordetails about how to obtainthe account ID, see How DoI Obtain the Username,Account ID, and ProjectID?.

N/A

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 37

Page 43: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

4.2 Using the Go SDK

4.2.1 Go SDK Authentication ModesGo SDK supports two authentication modes: token-based authentication andAK/SK authentication.

Token AuthenticationFor details about the code for token-based authentication, see Table 4-2.

package main

import ( "github.com/gophercloud/gophercloud/auth/token" "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" "github.com/gophercloud/gophercloud/openstack" "fmt")

func main() {// Set the authentication parameters. tokenOpts := token.TokenOptions{ IdentityEndpoint: "https://iam.example.com/v3", Username: "{username}", Password: "{password}", DomainID: "{domainid}", ProjectID: "{projectid}", }// Initialize the provider client. provider, providerErr := openstack.AuthenticatedClient(tokenOpts) if providerErr != nil { fmt.Println("init provider client error:", providerErr) panic(providerErr) }

// Initialize the service client. sc, serviceErr := openstack.NewComputeV2(provider, gophercloud.EndpointOpts{}) if serviceErr != nil { fmt.Println("init compute service client error:", serviceErr) panic(serviceErr) }

// List all servers. allPages, err := servers.List(sc, servers.ListOpts{}).AllPages()

if err != nil { fmt.Println("request server list error:", err) panic(err) }// Parse the return values. allServers, err := servers.ExtractServers(allPages) if err != nil { fmt.Println("extract response data error:", err) if ue, ok := err.(*gophercloud.UnifiedError); ok { fmt.Println("ErrCode:", ue.ErrorCode()) fmt.Println("Message:", ue.Message()) } return }// Print the information. fmt.Println("List Servers:")

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 38

Page 44: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

for _, s := range allServers { fmt.Println("server ID is :", s.ID) fmt.Println("server name is :", s.Name) fmt.Println("server Status is :", s.Status) fmt.Println("server AvailbiltyZone is :", s.AvailbiltyZone) }}

● ProviderClient is the top-level client required by all OpenStack services. Theclient contains all authentication details, such as the URL and token ID. Afterthe authentication, the compiled Go code can access the APIs.

● The Service Client of a service is required if you need to access this service. Fordetails, see the related chapter about this service in this document.

Table 4-2 Parameter description

Parameter Description Example Value

IdentityEndpoint

Specifies the endpoint of theIAM service.example in https://iam.example.com/v3indicates Region.Cloudplatform domain name. Fordetails about the parameter,see here.

https://iam.cn-north-1.myhuaweicloud.com/v3

Username Specifies the username. Fordetails about how to obtainthe username, see How Do IObtain the Username,Account ID, and ProjectID?.

N/A

Password Specifies the user password. N/A

ProjectID Specifies the project ID. Fordetails about how to obtainthe project ID, see How Do IObtain the Username,Account ID, and ProjectID?.

N/A

DomainID Specifies the account ID. Fordetails about how to obtainthe account ID, see How DoI Obtain the Username,Account ID, and ProjectID?.

N/A

AK/SK AuthenticationFor details about the code for AK/SK authentication, see Table 4-3.

package main

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 39

Page 45: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

import ( "github.com/gophercloud/gophercloud/auth/aksk" "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" "github.com/gophercloud/gophercloud/openstack" "fmt")

func main() {// Set the authentication parameters. akskOpts := aksk.AKSKOptions{ IdentityEndpoint: "https://iam.example.com/v3", DomainID: "{domainid}", ProjectID: "{projectid}", Cloud: "myhuaweicloud.com", Region: "cn-north-1", AccessKey: "{your AK string}", SecretKey: "{your SK string}", }// Initialize the provider client. provider, providerErr := openstack.AuthenticatedClient(akskOpts) if providerErr != nil { fmt.Println("init provider client error:", providerErr) panic(providerErr) }

// Initialize the service client. sc, serviceErr := openstack.NewComputeV2(provider, gophercloud.EndpointOpts{}) if serviceErr != nil { fmt.Println("init compute service client error:", serviceErr) panic(serviceErr) }

// List all servers. allPages, err := servers.List(sc, servers.ListOpts{}).AllPages()

if err != nil { fmt.Println("request server list error:", err) panic(err) }// Parse the return values. allServers, err := servers.ExtractServers(allPages) if err != nil { fmt.Println("extract response data error:", err) if ue, ok := err.(*gophercloud.UnifiedError); ok { fmt.Println("ErrCode:", ue.ErrorCode()) fmt.Println("Message:", ue.Message()) } return }// Print the information. fmt.Println("List Servers:") for _, s := range allServers { fmt.Println("server ID is :", s.ID) fmt.Println("server name is :", s.Name) fmt.Println("server Status is :", s.Status) fmt.Println("server AvailbiltyZone is :", s.AvailbiltyZone) }}

AK/SK generation description: Log in to the management console, choose MyCredentials, and click Access Keys to create an AK and SK.

The time error between the AK/SK signature time and UTC time cannot exceed 15minutes. Otherwise, the authentication fails.

If the AK/SK signature fails for more than five consecutive times, the AK/SKrequest of the source IP address is locked for 5 minutes.

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 40

Page 46: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Table 4-3 Parameter description

Parameter Description Example Value

IdentityEndpoint

Specifies the endpoint ofthe IAM service.example in https://iam.example.com/v3indicates Region.Cloudplatform domain name.For details about theparameter, see here.

https://iam.cn-north-1.myhuaweicloud.com/v3

DomainID Specifies the account ID. Fordetails about how to obtainthe account ID, see How DoI Obtain the Username,Account ID, and ProjectID?.

N/A

ProjectID Specifies the project ID. Fordetails about how to obtainthe project ID, see How DoI Obtain the Username,Account ID, and ProjectID?.

N/A

ak/sk Specifies the AK/SK accesskey.NOTE

● AK/SK generationdescription: Log in to themanagement console,choose My Credentials,and click Access Keys tocreate an AK and SK.

● The time error betweenthe AK/SK signature timeand UTC time cannotexceed 15 minutes.Otherwise, theauthentication fails.

● If the AK/SK signature failsfor more than fiveconsecutive times, theAK/SK request of thesource IP address is lockedfor 5 minutes.

N/A

Region Specifies the region name. cn-north-1

Cloud Specifies the cloud platformdomain name.

myhuaweicloud.com

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 41

Page 47: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

4.2.2 Go SDK TroubleshootingTo enable the debugging function using Go SDK, add the following code to theapplication:

import ( "github.com/gophercloud/gophercloud")gophercloud.EnableDebug=true

4.3 ECS Go SDK User GuideResource Object Example Code

cloudservers Code

tags Code

flavors Code

The ECS v1.1 go SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

cloudservers Code

The ECS v2 go SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

cloudservers Code

The Nova v2 go SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

flavors Code

images Code

keypairs Code

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 42

Page 48: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

quotas Code

servers Code

volume attach Code

4.4 EVS Go SDK User GuideThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of EVSAPIs.

The Cinder v2 Go SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

volume Code

4.5 VPC Go SDK User GuideThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by the SDK when the VPC SDK is used,see the description of VPC APIs.

The VPC v1 Go SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

bandwidth Code

port Code

private ip Code

public ip Code

quota Code

security group Code

security group rule Code

subnet Code

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 43

Page 49: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

vpc Code

4.6 IAM Go SDK User Guide

Service ClientTo interact with OpenStack APIs, transfer the identity credentials to the provider.After that, if you want to retrieve any information about the identity service, youneed to make a call to NewIdentityV3 to create an identity service client and thenuse required SDKs.

client, err := openstack.NewIdentityV3(provider, gophercloud.EndpointOpts{ Region: "RegionName",})

TokensA token is a text returned during authentication. It is used for subsequent accessand control of API resources. Each token has a specific range, which specifies theresources that can be accessed using the token.

Create a token.

import ( "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens" )

func TestCreateTokenByPasswd(t *testing.T){ scope := tokens.Scope{ ProjectName: TenantName, DomainID: DomainID, }

authOptions := tokens.AuthOptions{ Username: Username, Password: Password, DomainName: DomainName, Scope: scope, }

token, err := tokens.Create(client, &authOptions).Extract()}

Validate a token.

Check whether the token is valid.

func TestValidateToken(t *testing.T) { token, err := tokens.Validate(client, "token_id")}

Service CatalogsA service is a RESTful API that controls an OpenStack service function. Thecontrolled OpenStack services include the compute and object storage services. Aservice provides one or multiple endpoints. Through these endpoints, you canaccess resources and perform required operations.

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 44

Page 50: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

List services.

import ( "github.com/gophercloud/gophercloud/openstack/identity/v3/services" )

func TestServicesList(t *testing.T) {// List enumerates the services available to a specific user.listOpts := services.ListOpts{ ServiceType: "identity", }}// Retrieve a pager (i.e. a paginated collection)allPages, err := services.List(client, listOpts).AllPages()

// Define an anonymous function to be executed on each page's iterationallServices, err := services.ExtractServices(allPages)

for _, service := range allServices { // " service " will be a services.Service}

Get details about a specific service.

func TestServicesGet(t *testing.T) { service, err := services.Get(client,"service_id").Extract()}

Endpoints

An endpoint is a network accessible address. Generally, it is a URL address used toaccess a service.

List endpoints.

import ( "github.com/gophercloud/gophercloud/openstack/identity/v3/endpoints" )

func TestEndpointsList(t *testing.T) { endpointListOpts := endpoints.ListOpts{ Availability: gophercloud.AvailabilityPublic, }// Retrieve a pager (i.e. a paginated collection) allPages, err := endpoints.List(client, endpointListOpts).AllPages()

// Define an anonymous function to be executed on each page's iterationallEndpoints, err := endpoints.ExtractEndpoints(allPages)

for _, endpoint := range allEndpoints { // "endpoint " will be a endpoints.Endpoint }}

4.7 IMS Go SDK User Guide

Service Client

To interact with OpenStack APIs, transfer the identity credentials to the provider.After that, if you want to retrieve any information about the image service, youneed to make a call to NewImageServiceV2 to create an image service client andthen use required SDKs.

client, err := openstack.NewImageServiceV2(provider, gophercloud.EndpointOpts{ Region: "RegionName",})

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 45

Page 51: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Images

An image is the OS of a VM and it is a series of files used to create or rebuildservers. By default, the carrier provides preset OS images, but you can also createcustomized images from the ECSs.

Create an image.

You can use Create to create an image.

import ( "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" )

func TestImagesCreateDestroyEmptyImage(t *testing.T) { protected := false visibility := images.ImageVisibilityPrivate createOpts := &images.CreateOpts{ Name: name, ContainerFormat: "bare", DiskFormat: "vhd", MinDisk: 40, MinRAM: 1024, Protected: &protected, Visibility: &visibility, Tags: []string{"test","adsfi"}, Properties: map[string]string{ "architecture": "x86_64", }, } image, err := images.Create(client, createOpts).Extract()}

Update an image.

func TestImagesUpdate(t *testing.T) { updateOpts := images.UpdateOpts{ images.ReplaceImageName{ NewName: "alternateName", }, } image, err := images.Update(client, "imageupdate_id", updateOpts).Extract()}

List images.

func TestImagesListALL(t *testing.T) { listOpts := images.ListOpts{ Visibility: images.ImageVisibilityPublic, Owner: "owner_id", Status: "active", Marker: "marker_id", SortKey: "name", SortDir: "asc", }

// Retrieve a pager (i.e. a paginated collection) allPages, err := images.List(client, listOpts).AllPages()

// Define an anonymous function to be executed on each page's iteration allImages, err := images.ExtractImages(allPages)

for _, image := range allImages { // " image " will be a images.Image }}

Get details about a specific image.

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 46

Page 52: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

func TestImagesGet(t *testing.T) { image, err := images.Get(client, "image_id").Extract()}

Delete an image.

func DeleteImage(t *testing.T, client *gophercloud.ServiceClient, image *images.Image) { err := images.Delete(client, "image_id").ExtractErr()}

4.8 Cloud Eye Go SDK User GuideThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by SDK, see the description of CloudEye APIs.

The Cloud Eye V1.0 Go SDK supports the following resource. The table lists theexample code for adding, modifying, deleting, and querying a resource.

Resource Object Example Code

metric Code

alarm Code

metric data Code

quota Code

4.9 RDS Go SDK User GuideFor details about the mapping between SDKs and APIs, see RDS.

For details about the parameters supported by SDK, see the Relational DatabaseService API Reference.

The RDS v3 Go SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

datastore Code

instance Code

configuration Code

backup Code

database Code

dbuser Code

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 47

Page 53: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Resource Object Example Code

flavor Code

4.10 BSS Go SDK User GuideThe SDK corresponds to RESTful APIs. For details about the APIs supported by thelatest SDK version and the mapping between the SDK and APIs, see here.

For details about the parameters supported by BSS SDK, see the PartnerOperation Capability API and Customer Operation Capability API of BSS APIs.

The BSS v1 Go SDK supports operations on the following resource objects. Thefollowing table lists the example code for adding, modifying, deleting, andquerying a resource.

Resource Object Example Code

customer management Code

realname auth Code

enquiry Code

period order Code

period resource Code

credit Code

pay-per-use resource Code

bill Code

utilities Code

SDKDeveloper Guide 4 Go

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 48

Page 54: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

5 SDK-related FAQ

5.1 How Can I Create a Key Pair on the Console?Click Create SSH Key Pair to create a key pair myOpenStackKey, click OK, andsave the myOpenStackKey.pem file to the local PC.

5.2 How Can I Create a Security Group?1. Choose Security Group > Create Security Group.

2. Click Add Rule. On the displayed dialog box, add rules.

SDKDeveloper Guide 5 SDK-related FAQ

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 49

Page 55: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

5.3 How Do I Obtain the Username, Account ID, andProject ID?

This section describes how to obtain the username, account ID, and project ID onthe management console.

1. Log in to the management console.2. Click the username and select My Credentials from the drop-down list.

On the displayed page, view the username, account ID, and project ID.

Figure 5-1 Viewing required information

SDKDeveloper Guide 5 SDK-related FAQ

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 50

Page 56: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

A Mappings Between APIs and SDKs

A.1 Java

A.1.1 IAMThe SDK interfaces based on the IAM API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

TokenService

Token create(Stringnocatalog, Auth auth)

POST /v3/auth/tokensObtaining a User Token ThroughPassword AuthenticationObtaining a User Token ThroughPassword and Virtual MFAAuthenticationObtaining an Agency Token

Token get(String tokenId)TokengetWithoutCatalog(StringtokenId, String nocatalog

GET /v3/auth/tokens

List<? extends Project>getProjectScopes(StringtokenId)

GET /v3/auth/projects

List<? extends Domain>getDomainScopes(StringtokenId)

GET /v3/auth/domains

List<? extends Service>getServiceCatalog()

GET /v3/auth/catalog

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 51

Page 57: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

SecuritytokenService

Securitytoken create(Authauth)

POST /v3.0/OS-CREDENTIAL/securitytokens

CredentialService

PermanentCredentialRespcreatePermanentAcces-sKey(CreatePermanentCre-dentialReq createPermanent-CredentialReq)

POST /v3.0/OS-CREDENTIAL/credentials

Credentials listPermanentAc-cessKeys(String userId)

GET /v3.0/OS-CREDENTIAL/credentials

PermanentCredentialRespqueryPermanentAcces-sKey(String accessKey)

GET /v3.0/OS-CREDENTIAL/credentials/{access_key}

UpdateCredentialRespupdatePermanentAcces-sKey(String accessKey,UpdateCredentialRequpdateCredentialReq)

PUT /v3.0/OS-CREDENTIAL/credentials/{access_key}

ActionResponsedeletePermanentAcces-sKey(String accessKey)

DELETE /v3.0/OS-CREDENTIAL/credentials/{access_key}

RegionService

List<? extends Region> list() GET /v3/regions

Region get(String regionId) GET /v3/regions/{region_id}

ProjectService(identity)

List<? extends Project>listByObject(Map<String,Object> filteringParams)

GET /v3/projects

Project create(Project project) POST /v3/projects

Project update(Projectproject)

PATCH /v3/projects/{project_id}

Project get(String projectId) GET /v3/projects/{project_id}

ProjectService(iam)

ActionResponseupdateStatus(String projectId,UpdateProjectReq project)

PUT /v3-ext/projects/{project_id}

QueryProjectRespquery(String projectId)

GET /v3-ext/projects/{project_id}

DomainService

PasswordConfiggetDomainPasswordCon-fig(String domainId)

GET /v3/domains/{domain_id}/config/security_compliance

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 52

Page 58: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

PasswordConfiggetDomainPasswordConfig-ByOption(String domainId,String option)

GET /v3/domains/{domain_id}/config/security_compliance/{option}

UserService(identity)

List<? extends User> list()List<? extends User>list(Map<String, String>filteringParams)

GET /v3/users

User get(String userId) GET /v3/users/{user_id}

List<? extends Group>listUserGroups(String userId)

GET /v3/users/{user_id}/groups

User create(User user) POST /v3/users

ActionResponsechangePassword(StringuserId,StringoriginalPassword,Stringpassword)

POST /v3/users/{user_id}/password

User update(User user) PATCH /v3/users/{user_id}

ActionResponse delete(StringuserId)

DELETE /v3/users/{user_id}

List<? extends Project>listUserProjects(String userId)

GET /v3/users/{user_id}/projects

UserService(iam)

CreateUserRespcreate(CreateUserReq user)

POST /v3.0/OS-USER/users

QueryUserResp query(StringuserId)

GET /v3.0/OS-USER/users/{user_id}

ActionResponse update(StringuserId, UpdateUserReq user)

PUT /v3.0/OS-USER/users/{user_id}/info

UpdateUserByAdminRespupdateByAdmin(String userId,UpdateUserByAdminReq user)

PUT /v3.0/OS-USER/users/{user_id}

GroupService

List<? extends Group>list(Map<String, String>filteringParams)

GET /v3/groups

Group get(String groupId) GET /v3/groups/{group_id}

Group create(Group group) POST /v3/groups

Group update(Group group) PATCH /v3/groups/{group_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 53

Page 59: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ActionResponse delete(StringgroupId)

DELETE /v3/groups/{group_id}

ActionResponsecheckGroupUser(StringgroupId, String userId)

HEAD /v3/groups/{group_id}/users/{user_id}

ActionResponseaddUserToGroup(StringgroupId, String userId)

PUT /v3/groups/{group_id}/users/{user_id}

ActionResponseremoveUserFromGroup(StringgroupId, String userId)

DELETE /v3/groups/{group_id}/users/{user_id}

List<? extends User>listGroupUsers(String groupId,Map<String, String>filteringParams)

GET /v3/groups/{group_id}/users

List<? extends Role>listDomainGroupRoles(StringgroupId, String domainId)

GET /v3/domains/{domain_id}/groups/{group_id}/roles

List<? extends Role>listProjectGroupRoles(StringgroupId, String projectId)

GET /v3/projects/{project_id}/groups/{group_id}/roles

RoleService List<? extends Role>list(Map<String, String>filteringParams)

GET /v3/roles

Role get(String roleId) GET /v3/roles/{role_id}

ActionResponsegrantDomainGrou-pRole(String domainId, StringgroupId, String roleId)

PUT /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id}

ActionResponsegrantProjectGroupRole(StringprojectId, String groupId,String roleId)

PUT /v3/projects/{project_id}/groups/{group_id}/roles/{role_id}

ActionResponsecheckDomainGrou-pRole(String domainId, StringgroupId, String roleId)

HEAD /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id}

ActionResponsecheckProjectGroupRole(StringprojectId, String groupId,String roleId)

HEAD /v3/projects/{project_id}/groups/{group_id}/roles/{role_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 54

Page 60: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ActionResponserevokeDomainGrou-pRole(String domainId, StringgroupId, String roleId)

DELETE /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id}

ActionResponserevokeProjectGrou-pRole(String projectId, StringgroupId, String roleId)

DELETE /v3/projects/{project_id}/groups/{group_id}/roles/{role_id}

ActionResponsegrantGroupAllProjects-Role(String domainId, StringgroupId, String roleId)

PUT /v3/OS-INHERIT/domains/{domain_id}/groups/{group_id}/roles/{role_id}/inherited_to_projects

CustomRoleService

List<CreateRoleResp>list().getRoles()

GET /v3.0/OS-ROLE/roles

QueryRoleResp get(StringroleId)

GET /v3.0/OS-ROLE/roles/{role_id}

CreateRoleRespcreate(CreateRoleReqroleReq)

POST /v3.0/OS-ROLE/rolesfor creating a custom cloudservice policyfor creating a custom agencypolicy

UpdateRoleRespupdate(String roleId,UpdateRoleRequpdateRoleReq)

PATCH /v3.0/OS-ROLE/roles/{role_id}for modifying a custom cloudservice policyfor modifying a custom agencypolicy

ActionResponse delete(StringroleId)

DELETE /v3.0/OS-ROLE/roles/{role_id}

AgencyService

ListAgenciesResplistAgencies(String domainId,Map<String, String>filteringParams)

GET /v3.0/OS-AGENCY/agencies

AgencyResp get(StringagencyId)

GET /v3.0/OS-AGENCY/agencies/{agency_id}

AgencyRespcreate(CreateAgencyReqcreateAgencyReq)

POST /v3.0/OS-AGENCY/agencies

AgencyResp update(StringagencyId, UpdateAgencyRequpdateAgencyReq)

PUT /v3.0/OS-AGENCY/agencies/{agency_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 55

Page 61: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ActionResponse delete(StringagencyId)

DELETE /v3.0/OS-AGENCY/agencies/{agency_id}

ListPermissionsResplistPermissionsOnDo-main(String domainId, StringagencyID)

GET /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles

ListPermissionsResplistPermissionsOnPro-ject(String projectId, StringagencyId)

GET /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles

ActionResponseaddPermissionOnDo-main(String domainId, StringagencyId, String roleId)

PUT /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id}

ActionResponseaddPermissionOnPro-ject(String projectId, StringagencyId, String roleId)

PUT /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id}

ActionResponsecheckPermissionOnDo-main(String domainId, StringagencyId, String roleId)

HEAD /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id}

ActionResponsecheckPermissionOnPro-ject(String projectId, StringagencyId, String roleId)

HEAD /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id}

ActionResponsedeletePermissionOnDo-main(String domainId, StringagencyId, String roleId)

DELETE /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id}

ActionResponsedeletePermissionOnPro-ject(String projectId, StringagencyId, String roleId)

DELETE /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id}

VersionService

Version get() GET /v3

ServiceEndpointService

List<? extends Service>list(Map<String, String>filteringParams)

GET /v3/services

Service get(String serviceId) GET /v3/services/{service_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 56

Page 62: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

List<? extends Endpoint>listEndpoints(Map<String,String> filteringParams)

GET /v3/endpoints

Endpoint getEndpoint(StringendpointId)

GET /v3/endpoints/{endpoint_id}

A.1.2 IMSThe SDK interfaces based on the Glance v2 API are as follows. For details aboutthe invoking methods, see the sample codes.

Interface Method API

ImageService

Image create(Image image) POST /v2/images

ActionResponse upload(StringimageId, Payload payload, Imageimage)

PUT /v2/images/{image_id}/file

ActionResponse delete(StringimageId)

DELETE /v2/images/{image_id}

List<? extends Image> list() GET /v2/images

Image get(String imageId) GET /v2/images/{image_id}

ActionResponse updateTag(StringimageId, String tagkeyvalue)

PUT /v2/images/{image_id}/tags/{tag}

ActionResponse deleteTag(StringimageId, String tagkey)

DELETE /v2/images/{image_id}/tags/{tag}

List<? extends Member>listMembers(String imageId)

GET /v2/images/{image_id}/members

Member getMember(StringimageId, memberId)

GET /v2/images/{image_id}/members/{member_id}

ActionResponsedeleteMember(String imageId,String memberId)

DELETE /v2/images/{image_id}/members/{member_id}

Member updateMember(StringimageId, String memberId,Member.MemberStatus.ACCEPTED)

PUT /v2/images/{image_id}/members/{member_id}

Member createMember(StringimageId, String memberId)

POST /v2/images/{image_id}/members

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 57

Page 63: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

The SDK interfaces based on the IMS v2 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

ImageService

String create(ImageCreateByIn-stance imageCreateByInstance)

POST /v2/cloudimages/action

String create(ImageCreateByEx-ternalImage imageCreateByExter-nalImage)

POST /v2/cloudimages/action

List<Image> list(Map<String,String> filteringParams)

GET /v2/cloudimages

Image update(List<ImageUpdate>updateModel, String imageId)

PATCH /v2/cloudimages/{image_id}

The SDK interfaces based on the IMS v1 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

ImageService String create(ImageCreateByOBSimageCreateByOBS)

POST /v1/cloudimages/dataimages/action

String regist(RegistImage image,String imageId)

PUT /v1/cloudimages/{image_id}/upload

String export(ExportImage image,String imageId)

POST /v1/cloudimages/{image_id}/file

String create(ImageCreateByEx-ternalImage imageCreateByExter-nalImage)

POST /v1/cloudimages/wholeimages/action

String create(ImageCreateByIn-stance imageCreateByInstance)

POST /v1/cloudimages/wholeimages/action

Jobservice Job get(String jobId) GET /v1/{project_id}/jobs/{job_id}

A.1.3 VPCThe SDK interfaces based on the VPC v1 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

VpcService Vpc create(VpcCreatecreation)

POST /v1/{project_id}/vpcs

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 58

Page 64: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Vpc get(String vpcId) GET /v1/{project_id}/vpcs/{vpc_id}

List<? extends Vpc> list() GET /v1/{project_id}/vpcs

List<? extends Vpc>list(Map<String, String>filteringParams)

GET /v1/{project_id}/vpcs

Vpc update(String vpcId,VpcUpdate vpcUpdate)

PUT /v1/{project_id}/vpcs/{vpc_id}

ActionResponsedelete(String vpcId)

DELETE /v1/{project_id}/vpcs/{vpc_id}

PublicIpService VirtualPublicIpsRespapply(VirtualPublicIpsvirtualPublicIps)

POST /v1/{project_id}/publicips

VirtualPublicIp get(StringpublicipId)

GET /v1/{project_id}/publicips/{publicip_id}

List<? extends PublicIp>list()

GET /v1/{project_id}/publicips

List<? extends PublicIp>list(Map<String, String>filteringParams)

GET /v1/{project_id}/publicips

PublicIp update(StringpublicIpId,PublicIpUpdatepublicIpUpdate)

PUT /v1/{project_id}/publicips/{publicip_id}

ActionResponsedelete(String publicIpId)

DELETE /v1/{project_id}/publicips/{publicip_id}

PrivateIpService List<? extends PrivateIp>apply(PrivateIpsprivateIps)

POST /v1/{project_id}/privateips

PrivateIp get(StringprivateIpId)

GET /v1/{project_id}/privateips/{privateip_id}

List<? extends PrivateIp>list(String subnetId)

GET /v1/{project_id}/subnets/{subnet_id}/privateips

List<? extends PrivateIp>list(String subnetId,Map<String, String>filteringParams)

GET /v1/{project_id}/subnets/{subnet_id}/privateips

ActionResponsedelete(String privateIpId)

DELETE /v1/{project_id}/privateips/{privateip_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 59

Page 65: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

SecurityGroupService SecurityGroupcreate(SecurityGroupCreate securityGroup)

POST /v1/{project_id}/security-groups

SecurityGroup get(StringsecurityGroupId)

GET /v1/{project_id}/security-groups/{security_group_id}

List<? extendsSecurityGroup> list()

GET /v1/{project_id}/security-groups

List<? extendsSecurityGroup>list(Map<String, String>filteringParams)

GET /v1/{project_id}/security-groups

ActionResponsedelete(StringsecurityGroupId)

DELETE /v1/{project_id}/security-groups/{security_group_id}

SecurityGroupRulecreateSecurityGrou-pRule(SecurityGroupRulesecurityGroupRule)

POST /v1/{project_id}/security-group-rules

SecurityGroupRulegetSecurityGrou-pRule(StringsecurityGroupRuleId)

GET /v1/{project_id}/security-group-rules/{rules_security_groups_id}

List<? extendsSecurityGroupRule>listSecurityGroupRules()

GET /v1/{project_id}/security-group-rules

List<? extendsSecurityGroupRule>listSecurityGrou-pRules(Map<String,String> filteringParams)

GET /v1/{project_id}/security-group-rules

ActionResponsedeleteSecurityGrou-pRule(StringsecurityGroupRuleId)

DELETE /v1/{project_id}/security-group-rules/{rules_security_groups_id}

BandWidthService VirtualBandWidthsget(String bandwidthId)

GET /v1/{project_id}/bandwidths/{bandwidth_id}

List<VirtualBandWidths>list()

GET /v1/{project_id}/bandwidths

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 60

Page 66: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

List<VirtualBandWidths>list(Map<String, String>filteringParams)

GET /v1/{project_id}/bandwidths

VirtualBandWidthsupdate(VirtualBandWidthUpdatebandWidtUpdate, StringbandwidthId)

PUT /v1/{project_id}/bandwidths/{bandwidth_id}

QuotaService Quotas list() GET /v1/{project_id}/quotas

Quotas list(String type) GET /v1/{project_id}/quotas

SubnetService Subnetcreate(SubnetCreatecreation)

POST /v1/{project_id}/subnets

Subnet get(StringsubnetId)

GET /v1/{project_id}/subnets/{subnet_id}

List<? extends Subnet>list()

GET /v1/{project_id}/subnets

List<? extends Subnet>list(Map<String, String>filteringParams)

GET /v1/{project_id}/subnets

SubnetUpdateRespupdate(String vpcId,String subnetId,SubnetUpdatesubnetUpdate)

PUT /v1/{project_id}/vpcs/{vpc_id}/subnets/{subnet_id}

ActionResponsedelete(String vpcId,StringsubnetId)

DELETE /v1/{project_id}/vpcs/{vpc_id}/subnets/{subnet_id}

PortService Port create(PortCreateport)

POST /v1/{project_id}/ports

Port get(String portId) GET /v1/{project_id}/ports/{port_id}

List<? extends Port>list()

GET /v1/{project_id}/ports

List<? extends Port>list(Map<String, String>filteringParams)

GET /v1/{project_id}/ports

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 61

Page 67: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Port update(StringportId, PortUpdateportUpdate)

PUT /v1/{project_id}/ports/{port_id}

ActionResponsedelete(String portId)

DELETE /v1/{project_id}/ports/{port_id}

The SDK interfaces based on the Neutron v2.0 API are as follows. For details aboutthe invoking methods, see the sample codes.

Interface Method API

NetFloatingIPService NetFloatingIPassociateToPort(String id,String portId)

PUT /v2.0/floatingips/{floatingip_id}

NetFloatingIPcreate(NetFloatingIPfloatingIp)

POST /v2.0/floatingips

ActionResponsedelete(String id)

DELETE /v2.0/floatingips/{floatingip_id}

NetFloatingIPdisassociateFrom-Port(String id)

PUT /v2.0/floatingips/{floatingip_id}

NetFloatingIP get(Stringid)

GET /v2.0/floatingips/{floatingip_id}

List<? extendsNetFloatingIP> list()

GET /v2.0/floatingips

List<? extendsNetFloatingIP>list(Map<String, String>filteringParams)

GET /v2.0/floatingips

NetworkService Network create(Networknetwork)

POST /v2.0/networks

ActionResponsedelete(String networkId)

DELETE /v2.0/networks/{network_id}

Network get(StringnetworkId)

GET /v2.0/networks/{network_id}

List<? extends Network>list()

GET /v2.0/networks

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 62

Page 68: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

List<? extends Network>list(Map<String,String>filteringParams)

GET /v2.0/networks

Network update(StringnetworkId,NetworkUpdate network)

PUT /v2.0/networks/{network_id}

PortService Port create(Port port) POST /v2.0/ports

ActionResponsedelete(String portId)

DELETE /v2.0/ports/{port_id}

Port get(String portId) GET /v2.0/ports/{port_id}

List<? extends Port> list() GET /v2.0/ports

List<? extends Port>list(PortListOptionsoptions)

GET /v2.0/ports?network_id={network_id}

Port update(Port port) PUT /v2.0/ports/{port_id}

RouterService RouterInterfaceattachInterface(StringrouterId, AttachInterface-Type type, StringportOrSubnetId)

PUT /v2.0/routers/{router_id}/add_router_interface

Router create(Routerrouter)

POST /v2.0/routers

Router create(Stringname, booleanadminStateUp)

POST /v2.0/routers

ActionResponsedelete(String routerId)

DELETE /v2.0/routers/{router_id}

RouterInterfacedetachInterface(StringrouterId, String subnetId,String portId)

PUT /v2.0/routers/{router_id}/remove_router_interface

Router get(StringrouterId)

GET /v2.0/routers/{router_id}

List<? extendsRouter>list()

GET /v2.0/routers

Router toggleAdminState-Up(String routerId,boolean adminStateUp)

PUT /v2.0/routers/{router_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 63

Page 69: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Router update(Routerrouter)

PUT /v2.0/routers/{router_id}

SecurityGroupRuleSer-vice

SecurityGroupRulecreate(SecurityGroupRulerule)

POST /v2.0/security-group-rules

void delete(String id) DELETE /v2.0/security-group-rules/{security-group-rules-id}

SecurityGroupRuleget(String id)

GET /v2.0/security-group-rules/{security-group-rules-id}

List<? extendsSecurityGroupRule> list()

GET /v2.0/security-group-rules

SecurityGroupService SecurityGroupcreate(SecurityGroupsecurityGroup)

POST /v2.0/security-groups

ActionResponsedelete(String id)

DELETE /v2.0/security-groups/{security-group-id}

SecurityGroup get(Stringid)

GET /v2.0/security-groups/{security-group-id}

List<? extendsSecurityGroup>list()

GET /v2.0/security-groups

SubnetService Subnet create(Subnetsubnet)

POST /v2.0/subnets

ActionResponsedelete(String subnetId)

DELETE /v2.0/subnets/{subnet_id}

Subnet get(StringsubnetId)

GET /v2.0/subnets/{subnet_id}

List<? extendsSubnet>list()

GET /v2.0/subnets

List<? extendsSubnet>list(Map<String,String> filteringParams)

GET /v2.0/subnets

Subnet update(StringsubnetId, Subnet subnet)

PUT /v2.0/subnets/{subnet_id}

Subnet update(Subnetsubnet)

PUT /v2.0/subnets/{subnet_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 64

Page 70: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

A.1.4 ECSThe SDK interfaces based on the Nova v2 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

ComputeFloatingIPService

ActionResponseaddFloatingIP(Server server,String ipAddress)

POST /v2/{project_id}/servers/{server_id}/action

ActionResponseaddFloatingIP(Server server,String fixedIpAddress, StringipAddress)

POST /v2/{project_id}/servers/{server_id}/action

FloatingIP allocateIP(Stringpool)

POST /v2/{project_id}/os-floating-ips

ActionResponsedeallocateIP(String id)

DELETE /v2/{project_id}/os-floating-ips/{floating_ip_id}

List<? extends FloatingIP> list() GET /v2/{project_id}/os-floating-ips

ActionResponseremoveFloatingIP(Server server,String ipAddress)

POST /v2/{project_id}/servers/{server_id}/action

ComputeImageService

ActionResponse delete(StringimageId)

DELETE /v2/{project_id}/images/{image_id}

Image get(String imageId) GET /v2/{project_id}/images/{image_id}

List<? extends Image> list() GET /v2/{project_id}/images/detail

List<? extends Image>list(boolean detailed)

● detailed=true:GET /v2/{project_id}/images/detail

● detailed=false:GET /v2/{project_id}/images

ComputeSecurity-GroupService

SecGroupExtension create(Stringname, String description)

POST /v2/{project_id}/os-security-groups

SecGroupExtension.RulecreateRule(SecGroupExtension.Rule rule)

POST /v2/{project_id}/os-security-group-rules

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 65

Page 71: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ActionResponse delete(StringsecurityGroupId)

DELETE /v2/{project_id}/os-security-groups/{security_group}

ActionResponsedeleteRule(String ruleId)

DELETE /v2/{project_id}/os-security-group-rules/{security_group_rule_id}

SecGroupExtension get(StringsecurityGroupId)

GET /v2/{project_id}/os-security-groups/{security_group_id}

List<? extendsSecGroupExtension> list()

GET /v2/{project_id}/os-security-groups

SecGroupExtensionupdate(String securityGroupId,String name, String description)

PUT /v2/{project_id}/os-security-groups/{security_group_id}

FlavorService Flavor get(String flavorId) GET /v2/{project_id}/flavors/{flavor_id}

List<? extends Flavor> list() GET /v2/{project_id}/flavors/detail

KeypairService Keypair create(String name,String publicKey)

POST /v2/{project_id}/os-keypairs

ActionResponse delete(Stringname)

DELETE /v2/{project_id}/os-keypairs/{keypair_name}

Keypair get(String name) GET /v2/{project_id}/os-keypairs/{keypair_name}

List<? extends Keypair> list() GET /v2/{project_id}/os-keypairs

InstanceActions-Service

List<? extends InstanceAction>list(String serverId)

GET /v2/{project_id}/servers/{server_id}/os-instance-actions

InstanceAction get(StringserverId, String requestId)

GET /v2/{project_id}/servers/{server_id}/os-instance-actions/{request_id}

QuotaSetService QuotaSet get(String tenantId) GET /v2/{project_id}/os-quota-sets/{project_id}

QuotaSet get(String tenantId,String userId)

GET /v2/{project_id}/os-quota-sets/{project_id}?user_id={user_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 66

Page 72: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Limits limits() GET /v2/{project_id}/limits

getDefault(String tenantId) GET /v2/{project_id}/os-quota-sets/{project_id}/defaults

ServerGroupService

ServerGroup create(String name,String policy)

POST /v2/{project_id}/os-server-groups

ActionResponse delete(String id) DELETE /v2/{project_id}/os-server-groups/{server_group_id}

ServerGroup get(String id) GET /v2/{project_id}/os-server-groups/{server_group_id}

List<? extends ServerGroup>list()

GET /v2/{project_id}/os-server-groups

ServerService VolumeAttachmentgetAttachVolume(StringserverId, String volumeId)

GET /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

List<? extendsVolumeAttachment>listAttachedVolumes(StringserverId)

GET /v2/{project_id}/servers/{server_id}/os-volume_attachments

ActionResponse action(StringserverId, Action action)Executes the specified Actionsuch as RESUME, PAUSE, START,and STOP.

POST /v2/{project_id}/servers/{server_id}/action

ActionResponse stop(StringserverId, StopType type)

POST /v2/{project_id}/servers/{server_id}/action

VolumeAttachmentattachVolume(String serverId,String volumeId, String device)

POST /v2/{project_id}/servers/{server_id}/os-volume_attachments

Server boot(ServerCreate server) POST /v2/{project_id}/servers

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 67

Page 73: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ServerbootAndWaitActive(ServerCreateserver, int maxWaitTime)

POST /v2/{project_id}/serversGET /v2/{project_id}/servers/{server_id}

ActionResponseconfirmResize(String serverId)

POST /v2/{project_id}/servers/{server_id}/action

String createSnapshot(StringserverId, String snapshotName)

POST /v2/{project_id}/servers/{server_id}/action

ActionResponse delete(StringserverId)

DELETE /v2/{project_id}/servers/{server_id}

ActionResponsedeleteMetadataItem(StringserverId, String key)

DELETE /v2/{project_id}/servers/{server_id}/metadata/{key}

ActionResponsedetachVolume(String serverId,String attachmentId)

DELETE /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

ActionResponsedetachVolume(String serverId,String volumeId, int deleteFlag)

DELETE /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}?delete_flag={delete_flag}

Server get(String serverId) GET /v2/{project_id}/servers/{server_id}

Map<String,String>getMetadata(String serverId)

GET /v2/{project_id}/servers/{server_id}/metadata

List<? extends Server> list() GET /v2/{project_id}/servers/detail

List<? extends Server>list(boolean detail)

● detail=true:GET /v2/{project_id}/servers/detail

● detail=false:GET /v2/{project_id}/servers

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 68

Page 74: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

List<? extends Server>list(Map<String,String>filteringParams)

GET /v2/{project_id}/servers/detail{?changes-since,image,flavor,name,status,host,limit,marker}

ActionResponse reboot(StringserverId, RebootType type)

POST /v2/{project_id}/servers/{server_id}/action

ActionResponse resize(StringserverId, String flavorId)

POST /v2/{project_id}/servers/{server_id}/action

ActionResponserevertResize(String serverId)

POST /v2/{project_id}/servers/{server_id}/action

Server update(String serverId,ServerUpdateOptions options)

PUT /v2/{project_id}/servers/{server_id}

Map<String,String>updateMetadata(String serverId,Map<String,String> metadata)

PUT /v2/{project_id}/servers/{server_id}/metadata

Server waitForServerSta-tus(String serverId, Server.Statusstatus, int maxWait, TimeUnitmaxWaitUnit)

GET /v2/{project_id}/servers/{server_id}

List<? extends Server>list(boolean detail , Map<String,String> filteringParams)

● detail = true:GET /v2/{project_id}/servers/detail{?changes-since,image,flavor,name,status,limit,marker,not-tags,reservation_id,ip}● detail = false:GET /v2/{project_id}/servers{?changes-since,image,flavor,name,status,limit,marker,not-tags,reservation_id}

String getConsoleOutput(StringserverId, int numLines)

POST /v2/{project_id}/servers/{server_id}/action

Map<String, String>getMetadataItem(StringserverId, String key)

GET /v2/{project_id}/servers/{server_id}/metadata/{key}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 69

Page 75: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Map<String, String>setMetadataItem(StringserverId, String key, String value)

PUT /v2/{project_id}/servers/{server_id}/metadata/{key}

InterfaceService(ext)

InterfaceAttachmentcreate(String serverId, StringportId)

POST /v2/{project_id}/servers/{server_id}/os-interface

InterfaceAttachmentcreate(String serverId,NovaInterfaceAttachmentCreatenovaInterfaceAttachmentCreate)

POST /v2/{project_id}/servers/{server_id}/os-interface

ActionResponse detach(StringserverId, String attachmentId)

DELETE /v2/{project_id}/servers/{server_id}/os-interface/{port_id}

InterfaceAttachment get(StringserverId, String attachmentId)

GET /v2/{project_id}/servers/{server_id}/os-interface/{port_id}

List<? extends InterfaceAttach-ment> list(String serverId)

GET /v2/{project_id}/servers/{server_id}/os-interface

ZoneService(ext) List<? extends AvailabilityZone>list()

GET /v2/{project_id}/os-availability-zone

The SDK interfaces based on the Nova v2.1 API are as follows. For details aboutthe invoking methods, see the sample codes.

Interface Method API

ServerService NovaRemoteConsoleRes-ponsegetRemoteConsole(StringserverId,NovaRemoteConsoleremoteConsole,Map<String, String>headers)

POST /v2.1/{project_id}/servers/{server_id}/remote-consoles

ServerTagService NovaServerTag list(StringserverId)

GET /v2.1/{project_id}/servers/{server_id}/tags

NovaServerTagaddTags(String serverId,NovaServerTag tags)

PUT /v2.1/{project_id}/servers/{server_id}/tags

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 70

Page 76: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ActionResponsedelete(String serverId,String tag)

DELETE /v2.1/{project_id}/servers/{server_id}/tags

ActionResponsecheck(String serverId,String tag)

GET /v2.1/{project_id}/servers/{server_id}/tags/{tag}

ActionResponseaddSingle(String serverId,String tag)

PUT /v2.1/{project_id}/servers/{server_id}/tags/{tag}

ActionResponsedeleteAll(String serverId)

DELETE /v2.1/{project_id}/servers/{server_id}/tags/{tag}

The SDK interfaces based on the ECS v1 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

CloudServerService

String create(ServerCreatecreation)

POST /v1/{project_id}/cloudservers

List<CloudServer> list() GET /v1/{project_id}/cloudservers/detail

CloudServers listWithCount() GET /v1/{project_id}/cloudservers/detail

CloudServer get(String serverId) GET /v1/{project_id}/cloudservers/{server_id}

String resize(ResizeServerresize,String serverId)

POST /v1/{project_id}/cloudservers/{server_id}/resize

String delete(List<String>serverIds, booleandeletePublicIp, booleandeleteVolume)

POST /v1/{project_id}/cloudservers/delete

String stop(List<String>serverIds, StopType type)

POST /v1/{project_id}/cloudservers/action

String reboot(List<String>serverIds, RebootType type)

POST /v1/{project_id}/cloudservers/action

String start(List<String>serverIds)

POST /v1/{project_id}/cloudservers/action

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 71

Page 77: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

List<CloudServer>list(Map<String, String>filteringParams)

GET /v1/{project_id}/cloudservers/detail{?flavor,name,status,limit,offset,not-tags,reservation_id,enterprise_project_id}

CloudServerslistWithCount(Map<String,String> filteringParams)

GET /v1/{project_id}/cloudservers/detail{?flavor,name,status,limit,offset,not-tags,reservation_id,enterprise_project_id}

List<Flavor>getSpecifications(StringavailabilityZone)

GET /v1/{project_id}/cloudservers/flavors{?availability_zone}

CloudAbsoluteLimit limits() GET /v1/{project_id}/cloudservers/limits

SupportAutoRecoverygetAutoRecovery(StringserverId)

GET /v1/{project_id}/cloudservers/{server_id}/autorecovery

ActionResponsemanageAutoRecovery(StringserverId, SupportAutoRecoverysupportAutoRecovery)

PUT /v1/{project_id}/cloudservers/{server_id}/autorecovery

RemoteConsoleResponseremoteConsole(String serverId,RemoteConsole remoteConsole)

POST /v1/{project_id}/cloudservers/{server_id}/remote_console

JobService Job get(String jobId) GET /v1/{project_id}/jobs/{job_id}

InterfaceService InterfaceAttachments list(StringserverId)

GET /v1/{project_id}/cloudservers/{server_id}/os-interface

TagService ActionResponse add(StringserverId, List<ServerTags>serverTags)

POST /v1/{project_id}/cloudservers/{server_id}/tags/action

ActionResponse delete(StringserverId, List<ServerTags>serverTags)

POST /v1/{project_id}/cloudservers/{server_id}/tags/action

CloudServerTag list(StringserverId)

GET /v1/{project_id}/cloudservers/{server_id}/tags

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 72

Page 78: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ProjectTag listProjectTags() GET /v1/{project_id}/cloudservers/tags

The SDK interfaces based on the ECS v2 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

CloudServerV2Service

AsyncJobEntityreinstallOS(OSReinstallosReinstall, StringserverId)

POST /v2/{project_id}/cloudservers/{server_id}/reinstallos

A.1.5 EVSThe SDK interfaces based on the EVS v2 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

VolumeService String create(CloudVolumesvolume)

POST /v2/{project_id}/cloudvolumes

String extend(Extendextend,String volumeId)

POST /v2/{project_id}/cloudvolumes/{volume_id}/action

CloudVolumeResponse list() GET /v2/{project_id}/cloudvolumes/detail

CloudVolumesResponselist(Map<String,Object>filteringParams)

GET /v2/{project_id}/cloudvolumes/detail

VolumeSnapshotService

CloudVolumeSnapshotsRes-ponse list()

GET /v2/{project_id}/cloudsnapshots/detail

CloudVolumeSnapshotsRes-ponselist(Map<String,Object>filteringParams)

GET /v2/{project_id}/cloudsnapshots/detail

RollbackResponserollback(String snapshotId)

POST /v2/{project_id}/cloudsnapshots/{snapshot_id}/rollback

RollbackResponserollback(String snapshotId,Rollback rollback)

POST /v2/{project_id}/cloudsnapshots/{snapshot_id}/rollback

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 73

Page 79: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

JobService Job get(String job_id) GET /v1/{project_id}/jobs/{job_id}

The SDK interfaces based on the Cinder v2 API are as follows. For details aboutthe invoking methods, see the sample codes.

Interface Method API

BlockVolumeService Volume create(Volumevolume)

POST /v2/{project_id}/volumes

Volume create(Volumevolume, Map<String,Object> schedulerHints)

POST /v2/{project_id}/volumes

Volume update(StringvolumeId,CinderVolumeUpdatevolume)

PUT /v2/{project_id}/volumes/{volume_id}

ActionResponsedelete(String volumeId)

DELETE /v2/{project_id}/volumes/{volume_id}

ActionResponseextend(String volumeId,Integer newSize)

POST /v2/{project_id}/volumes/{volume_id}/action

Volume get(StringvolumeId)

GET /v2/{project_id}/volumes/{volume_id}

List<? extends Volume>list()

GET /v2/{project_id}/volumes/detail

List<? extends Volume>list(Map<String,String>filteringParams)

● GET /v2/{project_id}/volumes/detail?limit={limit_nmuber}

● GET /v2/{project_id}/volumes/detail?marker={volume_id}

ActionResponseupdate(String volumeId,String name, Stringdescription)

PUT /v2/{project_id}/volumes/{volume_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 74

Page 80: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

VolumeUploadImageuploadToImage(StringvolumeId,UploadImageData data)

POST /v2/{project_id}/volumes/{volume_id}/action

ActionResponsereadOnlyModeUpdate(String volumeId, booleanreadonly)

POST /v2/{project_id}/volumes/{volume_id}/action

List<? extendsVolumeType>listVolumeTypes()

GET /v2/{project_id}/types

BlockVolumeSnapshotSer-vice

ActionResponsedelete(StringsnapshotId)

DELETE /v2/{project_id}/snapshots/{snapshot_id}

VolumeSnapshotcreate(VolumeSnapshotsnapshot)

POST /v2/{project_id}/snapshots

ActionResponseupdate(StringsnapshotId, Stringname, Stringdescription)

PUT /v2/{project_id}/snapshots/{snapshot_id}

VolumeSnapshotget(String snapshotId)

GET /v2/{project_id}/snapshots/{snapshot_id}

List<? extendsVolumeSnapshot> list()

GET /v2/{project_id}/snapshots

List<? extendsVolumeSnapshot>list(Map<String,String>filteringParams)

GET /v2/{project_id}/snapshots?volume_id={volume_id}

CinderZoneService List<? extendsAvailabilityZone> list()

GET /v2/{project_id}/os-availability-zone

BlockVolumeTransferService List<? extendsVolumeTransfer> list()

GET /v2/{project_id}/os-volume-transfer/detail

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 75

Page 81: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

List<? extendsVolumeTransfer>list(boolean detailed)

● GET /v2/{project_id}/os-volume-transfer

● GET /v2/{project_id}/os-volume-transfer/detail

VolumeTransferget(String transferId)

GET /v2/{project_id}/os-volume-transfer/{transfer_id}

VolumeTransfercreate(String volumeId)

POST /v2/{project_id}/os-volume-transfer

VolumeTransfercreate(String volumeId,String name)

POST /v2/{project_id}/os-volume-transfer

VolumeTransferaccept(String transferId,String authKey)

POST /v2/{project_id}/os-volume-transfer/{transfer_id}/accept

ActionResponsedelete(String transferId)

DELETE /v2/{project_id}/os-volume-transfer/{transfer_id}

A.1.6 ASThe SDK interfaces based on the AS v1 API are as follows. For details about theinvoking methods, see the sample codes.

Interface

Method API

AutoScalingGroupServic

String create(ScalingGroupCreategroup)

POST /autoscaling-api/v1/{project_id}/scaling_group

List<? extends ScalingGroup>list()

GET /autoscaling-api/v1/{project_id}/scaling_group

ScalingGroup get(String groupId) GET /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}

String update(String groupId,ScalingGroupUpdate group)

PUT /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 76

Page 82: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface

Method API

ActionResponse delete(StringgroupId)

DELETE /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id

ActionResponse resume(StringgroupId)

POST /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}/action

ActionResponse pause(StringgroupId)

POST /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}/action

AutoScalingConfigService

String create(ScalingConfigCreateconfig)

POST /autoscaling-api/v1/{project_id}/scaling_configuration

List<? extends ScalingConfig>list()

GET /autoscaling-api/v1/{project_id}/scaling_configuration

ScalingConfig get(String configId) GET /autoscaling-api/v1/{project_id}/scaling_configuration/{scaling_configuration_id}

ActionResponse delete(StringconfigId)

DELETE /autoscaling-api/v1/{project_id}/scaling_configuration/{scaling_configuration_id}

ActionResponsedelete(List<String> configIds)

POST /autoscaling-api/v1/{project_id}/scaling_configurations

AutoScalingGroupInstanceService

List<? extendsScalingGroupInstance> list(StringgroupId, ScalingGroupInstanceLis-tOptions options)

GET /autoscaling-api/v1/{project_id}/scaling_group_instance/{scaling_group_id}/list

ActionResponse delete(StringinstanceId, booleandeleteInstance)

DELETE /autoscaling-api/v1/{project_id}/scaling_group_instance/{instance_id}

ActionResponse batchAdd(StringgroupId, List<String> instanceIds,boolean deleteInstance)

POST /autoscaling-api/v1/{project_id}/scaling_group_instance/{scaling_group_id}/action

ActionResponsebatchRemove(String groupId,List<String> instanceIds, booleandeleteInstance)

POST /autoscaling-api/v1/{project_id}/scaling_group_instance/{scaling_group_id}/action

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 77

Page 83: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface

Method API

AutoScalingPolicyService

String create(ScalingPolicyCrea-teUpdate policy)

POST /autoscaling-api/v1/{project_id}/scaling_policy

String update(ScalingPolicyCrea-teUpdate policy)

PUT /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}

List<? extends ScalingPolicy>list(String groupId)

GET /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_group_id}/list

ScalingPolicy get(String policyId) GET /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}

ActionResponse execute(StringpolicyId)

POST /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}/action

ActionResponse resume(StringpolicyId)

POST /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}/action

ActionResponse pause(StringpolicyId)

POST /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}/action

ActionResponse delete(StringpolicyId)

DELETE /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}

AutoScalingActivityLogService

list(String groupId,ScalingActivityLogListOptionsoptions)

GET /autoscaling-api/v1/{project_id}/scaling_activity_log/{scaling_group_id}

AutoScalingQuotaService

List<Quota> list() GET /autoscaling-api/v1/{project_id}/quotas

List<Quota> list(String groupId) GET /autoscaling-api/v1/{project_id}/quotas/{scaling_group_id}

AutoScalingLifecycleHookService

ASAutoScalingLifecycleHookcreate(ASAutoScalingLifecycle-Hook lifecycleHook, StringgroupId)

POST /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}

List<? extends ASAutoScalingLife-cycleHook> list(String groupId)

GET /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}/list

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 78

Page 84: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface

Method API

ASAutoScalingLifecycleHooklist(String groupId, StringlifecycleHookName)

GET /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

ActionResponse delete(StringgroupId, StringlifecycleHookName)

DELETE /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

ASAutoScalingLifecycleHookupdate(String groupId, StringlifecycleHookName,ASAutoScalingLifecycleHooklifecycleHook)

PUT /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

List<? extends AutoScalingInstan-ceHangupInfo> scalingInstance-Hangup(String groupId,ScalingInstanceOptionsinstanceId)

GET /autoscaling-api/v1/{project_id}/scaling_instance_hook/{scaling_group_id}/list

ActionResponse scalingInstance-HookCallback(String groupId,ASAutoScalingLifecycleInstance-Callback lifecycleInstanceCall-back)

PUT /autoscaling-api/v1/{project_id}/scaling_instance_hook/{scaling_group_id}/callback

AutoScalingInformService

ASAutoScalingInformdeploy(String groupId,ASAutoScalingInform info)

PUT /autoscaling-api/v1/{project_id}/scaling_notification/{scaling_group_id}

ASAutoScalingTopics list(StringgroupId)

GET /autoscaling-api/v1/{project_id}/scaling_notification/{scaling_group_id}

ActionResponse delete(StringgroupId, String topicUrn)

DELETE /autoscaling-api/v1/{project_id}/scaling_notification/{scaling_group_id}/{topic_urn}

A.1.7 Cloud EyeThe SDK interfaces based on the Cloud Eye v1.0 API are as follows. For detailsabout the invoking methods, see the sample codes.

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 79

Page 85: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

MetricService List<? extends Metric>getList(MetricFilterOptionsoptions);

GET /V1.0/{project_id}/metrics

AlarmService List<? extends Alarm>list(AlarmFilterOptionsoptions);

GET /V1.0/{project_id}/alarms

List<? extends Alarm>get(String alarmId);

GET /V1.0/{project_id}/alarms/{alarm_id}

ActionResponsestartAlarm(String alarmId)

PUT /V1.0/{project_id}/alarms/{alarm_id}/action

ActionResponsestopAlarm(String alarmId)

PUT /V1.0/{project_id}/alarms/{alarm_id}/action

ActionResponsedeleteAlarm(String alarmId);

DELETE /V1.0/{project_id}/alarms/{alarm_id}

MetricDataService MetricAggregation get(Stringnamespace, Stringmetric_name, Date from, Dateto, Period period, Filter filter,String[] dimValues);

GET /V1.0/{project_id}/metric-data

ActionResponse add(List<?extends MetricData> metrics);

POST /V1.0/{project_id}/metric-data

QuotaService CloudEyeQuota get(); GET /V1.0/{project_id}/quotas

A.1.8 ELBThe SDK interfaces based on the ELB v2.0 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

LbRuleV2Service

NeutronRules list(Stringl7policyId)

GET /v2.0/lbaas/l7policies/{l7policy_id}/rules

NeutronRule get(Stringl7policyId, String ruleId)

GET /v2.0/lbaas/l7policies/{l7policy_id}/rules/{l7rule_id}

NeutronRulecreate(NeutronRuleruleModel, String l7policyId)

POST /v2.0/lbaas/l7policies/{l7policy_id}/rules

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 80

Page 86: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

NeutronRuleupdate(NeutronRuleUpdateupdateModel, Stringl7policyId, String ruleId)

PUT /v2.0/lbaas/l7policies/{l7policy_id}/rules/{l7rule_id}

ActionResponse delete(Stringl7policyId, String ruleId)

DELETE /v2.0/lbaas/l7policies/{l7policy_id}/rules/{l7rule_id}

LbWhitelistV2Service

NeutronWhitelists list() GET /v2.0/lbaas/whitelists

NeutronWhitelist get(StringwhitelistId)

GET /v2.0/lbaas/whitelists/{whitelist_id}

NeutronWhitelistcreate(NeutronWhitelistmodel)

POST /v2.0/lbaas/whitelists

NeutronWhitelistupdate(NeutronWhitelistmodel,String whitelistId)

PUT /v2.0/lbaas/whitelists/{whitelist_id}

ActionResponse delete(StringwhitelistId)

DELETE /v2.0/lbaas/whitelists/{whitelist_id}

LbCertificateV2Service

NeutronCertificates list() GET /v2.0/lbaas/certificates

NeutronCertificate get(Stringid)

GET /v2.0/lbaas/certificates/{certificate_id}

NeutronCertificatecreate(NeutronCertificatemodel)

POST /v2.0/lbaas/certificates

NeutronCertificateupdate(NeutronCertificateUp-date model, String id)

PUT /v2.0/lbaas/certificates/{certificate_id}

ActionResponse delete(Stringid)

DELETE /v2.0/lbaas/certificates/{certificate_id}

LbPolicyV2Service

NeutronL7Policies list() GET /v2.0/lbaas/l7policies

NeutronL7Policy get(StringpolicyId)

GET /v2.0/lbaas/l7policies/{policy_id}

NeutronL7Policycreate(NeutronL7Policymodel)

POST /v2.0/lbaas/l7policies

NeutronL7Policyupdate(NeutronL7PolicyUpdate l7PolicyUpdate, Stringl7policyId)

PUT /v2.0/lbaas/l7policies/{policy_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 81

Page 87: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ActionResponse delete(Stringl7policyId)

DELETE /v2.0/lbaas/l7policies/{policy_id}

LoadBalancerV2Service

List<? extendsLoadBalancerV2> list()

GET /v2.0/lbaas/loadbalancers

LoadBalancerV2 get(StringloadbalancerId)

GET /v2.0/lbaas/loadbalancers/{loadbalancer_id}

LoadBalancerV2create(LoadBalancerV2loadbalancer)

POST /v2.0/lbaas/loadbalancers

LoadBalancerV2update(String loadbalancerId,LoadBalancerV2Updateloadbalancer)

PUT /v2.0/lbaas/loadbalancers/{loadbalancer_id}

ActionResponse delete(StringloadbalancerId)

DELETE /v2.0/lbaas/loadbalancers/{loadbalancer_id}

LoadBalancerV2StatusTreestatusTree(StringloadbalancerId)

GET /v2.0/lbaas/loadbalancers/{loadbalancer_id}/statuses

ListenerV2Service

List<? extends ListenerV2>list()

GET /v2.0/lbaas/listeners

ListenerV2 get(StringlistenerId)

GET /v2.0/lbaas/listeners/{listener_id}

ListenerV2 create(ListenerV2listener)

POST /v2.0/lbaas/listeners

ListenerV2 update(StringlistenerId, ListenerV2Updatelistener)

PUT /v2.0/lbaas/listeners/{listener_id}

ActionResponse delete(StringlistenerId)

DELETE /v2.0/lbaas/listeners/{listener_id}

LbPoolV2Service

List<? extends LbPoolV2>list()

GET /v2.0/lbaas/pools

LbPoolV2 get(String lbPoolId) GET /v2.0/lbaas/pools/{pool_id}

LbPoolV2 create(LbPoolV2lbPool)

POST /v2.0/lbaas/pools

LbPoolV2 update(StringlbPoolId, LbPoolV2UpdatelbPool)

PUT /v2.0/lbaas/pools/{pool_id}

ActionResponse delete(StringlbPoolId)

DELETE /v2.0/lbaas/pools/{pool_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 82

Page 88: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

HealthMonitorV2Service

List<? extendsHealthMonitorV2> list()

GET /v2.0/lbaas/healthmonitors

HealthMonitorV2 get(StringhealthMonitorId)

GET /v2.0/lbaas/healthmonitors/{healthmonitor_id}

HealthMonitorV2create(HealthMonitorV2healthMonitor)

POST /v2.0/lbaas/healthmonitors

HealthMonitorV2update(StringhealthMonitorId,HealthMonitorV2UpdatehealthMonitor)

PUT /v2.0/lbaas/healthmonitors/{healthmonitor_id}

ActionResponse delete(StringhealthMonitorId)

DELETE /v2.0/lbaas/healthmonitors/{healthmonitor_id}

LbPoolV2Service

List<? extends MemberV2>listMembers(String lbPoolId)

GET /v2.0/lbaas/pools/{pool_id}/members

MemberV2 getMember(StringlbPoolId, String memberId)

GET /v2.0/lbaas/pools/{pool_id}/members/{member_id}

MemberV2createMember(StringlbPoolId, MemberV2member)

POST /v2.0/lbaas/pools/{pool_id}/members

MemberV2updateMember(StringlbPoolId, String memberId,MemberV2Update member)

PUT /v2.0/lbaas/pools/{pool_id}/members/{member_id}

ActionResponsedeleteMember(StringlbPoolId, String memberId)

DELETE /v2.0/lbaas/pools/{pool_id}/members/{member_id}

A.1.9 CTSThe SDK interfaces based on the CTS v1.0 API are as follows. For details about theinvoking methods, see the sample codes.

Interface method API URL

TrackerService Tracker create(String bucketName,String filePrefixName)

POST /v1.0/{project_id}/tracker

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 83

Page 89: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface method API URL

Tracker get(String trackerName) GET /v1.0/{project_id}/tracker{?tracker_name}

Tracker update(TrackerUpdateupdate)

PUT /v1.0/{project_id}/tracker/{?tracker_name}

ActionResponse delete(StringtrackerName)

DELETE /v1.0/{project_id}/tracker{?tracker_name}

TraceService List<Trace> list(StringtrackerName, TraceListOptionsoptions)

GET /v2.0/{project_id}/{tracker_name}/trace{?trace_id,service_type,resource_type,resource_id,resource_name,trace_name,trace_rating,user,limit,from,to,next}

A.1.10 CDNThe SDK interfaces based on the CDN v1 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

DomainService

list(**params) GET /v1.0/cdn/domains

create(**attrs) POST /v1.0/cdn/domains

getDetail(domainId,**params)

GET /v1.0/cdn/domains/{domain_id}/detail

delete(domainId, **params) DELETE /v1.0/cdn/domains/{domain_id}

enable(domainId, **params) PUT /v1.0/cdn/domains/{domain_id}/enable

disable(domainId, **params) PUT /v1.0/cdn/domains/{domain_id}/disable

setOrigin(domainId, **attrs,**params)

PUT /v1.0/cdn/domains/{domain_id}/origin

setOriginHost(domainId,**attrs, **params)

PUT /v1.0/cdn/domains/{domain_id}/originhost

getOriginHost(domainId,**params)

GET /v1.0/cdn/domains/{domain_id}/originhost

setOriginRange(domainId,**attrs)

PUT /v1.0/cdn/domains/{domainId}/range-switch

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 84

Page 90: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

setFollow302(domainId,**attrs)

PUT /v1.0/cdn/domains/{domainId}/follow302-switch

setReferer(domainId, **attrs,**params)

PUT /v1.0/cdn/domains/{domain_id}/referer

getReferer(domainId,**params)

GET /v1.0/cdn/domains/{domain_id}/referer

getIpAcl(domainId) GET /v1.0/cdn/domains/{domainId}/ip-acl

setIpAcl(domainId, **attrs) PUT /v1.0/cdn/domains/{domainId}/ip-acl

setCacheConfig(domainId,**attrs, **params)

PUT /v1.0/cdn/domains/{domain_id}/cache

getCacheConfig(domainId,**params)

GET /v1.0/cdn/domains/{domain_id}/cache

setHttpsInfo(domainId,**attrs, **params)

PUT /v1.0/cdn/domains/{domain_id}/https-info

getHttpsInfo(domainId,**params)

GET /v1.0/cdn/domains/{domain_id}/https-info

queryCdnIPs(**attrs) GET /v1.0/cdn/ip-info

setResponseHead-er(domainId, **attrs)

PUT /v1.0/cdn/domains/{domainId}/response-header

getResponseHead-er(domainId)

GET /v1.0/cdn/domains/{domainId}/response-header

createRefreshTask(**attrs,**params)

POST /v1.0/cdn/refreshtasks

createPreheatingTask(**attrs,**params)

POST /v1.0/cdn/preheatingtasks

queryTasks(**params) GET /v1.0/cdn/historytasks

getTaskDetail(taskId,**params)

GET /v1.0/cdn/historytasks/{task_id}/detail

StatisticService

queryTopUrl(**query) GET /v1.0/cdn/statistics/top-url

queryDomainItemDe-tails(**query)

GET /v1.0/cdn/statistics/domain-item-details

queryDomainItemLocationDe-tails(**query)

GET /v1.0/cdn/statistics/domain-item-location-details

queryTotalNetworkTraf-fic(**query)

GET /v1.0/cdn/statistics/flux

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 85

Page 91: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

queryDetailsOfNetworkTraf-fic(**query)

GET /v1.0/cdn/statistics/flux-detail

queryPeakBandwidth(**query) GET /v1.0/cdn/statistics/bandwidth

queryDetailsOfNetworkBand-width(**query)

GET /v1.0/cdn/statistics/bandwidth-detail

queryConsumptionSumma-ry(**query)

GET /v1.0/cdn/statistics/domain-summary

queryConsumptionSummary-Details(**query)

GET /v1.0/cdn/statistics/domain-summary-detail

queryDomainConsump-tions(**query)

GET /v1.0/cdn/statistics/domain

queryRegionDetailSumm-ry(**query)

GET /v1.0/cdn/statistics/region-detail-summary

queryCarrierDetailSumm-ry(**query)

GET /v1.0/cdn/statistics/carrier-detail-summary

queryRegionCarrierDo-main(**query)

GET /v1.0/cdn/statistics/region-carrier-domain

queryRegionCarrierDe-tail(**query)

GET /v1.0/cdn/statistics/region-carrier-detail

LogService queryLogs(domainName,queryDate, pageSize,pageNumber,enterpriseProjectId)

GET /v1.0/cdn/logs

A.1.11 BSSThe SDK interfaces based on the BSS are as follows. For details about the invokingmethods, see the sample codes.

NO TE

The following API links are provided for partners and customers. If the link is PartnerOperation Capability, the link is provided for partners. If the link is Customer OperationCapability, the link is provided for customers.

Interface Method API

CustomerManagement

CheckUserRspcheckUser(String domainID,CheckUserReq req)

POST /v1.0/{partner_id}/partner/customer-mgr/check-userLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 86

Page 92: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

CreateCustomerRspcreateCustomer(StringdomainID, CreateCustomerReqreq)

POST /v1.0/{partner_id}/partner/customer-mgr/customerLink (Partner OperationCapability)

QueryCustomerInfoListRspqueryCustomerInfoList(StringdomainID, QueryCustomerIn-foListReq req)

POST /v1.0/{partner_id}/partner/customer-mgr/queryLink (Partner OperationCapability)

SetCustomersFrozenRspsetCustomersFrozen(StringdomainID, SetCustomersFro-zenReq req)

POST /v1.0/{partner_id}/partner/customer-mgr/frozensLink (Partner OperationCapability)

SetCustomersFrozenRspsetCustomersUnfrozen(StringdomainID, SetCustomersFro-zenReq req)

POST /v1.0/{partner_id}/partner/customer-mgr/unfrozensLink (Partner OperationCapability)

RealnameAuth

RealnameAuthRspindividualRealna-meAuth(String domainID,RealnameAuthReq req)

POST /v1.0/{partner_id}/partner/customer-mgr/realname-auth/individualLink (Partner OperationCapability)

RealnameAuthRspenterpriseRealna-meAuth(String domainID,EnterpriseRealnameAuthReqreq)

POST /v1.0/{partner_id}/partner/customer-mgr/realname-auth/enterpriseLink (Partner OperationCapability)

RealnameAuthRspenterpriseRealnameAuth-Change(String domainID,EnterpriseRealnameAuthChan-geReq req)

PUT /v1.0/{partner_id}/partner/customer-mgr/realname-auth/enterpriseLink (Partner OperationCapability)

QueryRealnameAuthRevie-wResultRspqueryRealnameAuthReviewRe-sult(String domainID,Map<String, String>filteringParams)

GET /v1.0/{partner_id}/partner/customer-mgr/realname-auth/resultLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 87

Page 93: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Enquiry QueryRatingRspqueryRating(String domainID,QueryRatingReq req)

POST /v1.0/{domain_id}/customer/product-mgr/query-ratingLink (Partner OperationCapability)Link (Customer OperationCapability)

PeriodOrder

QueryOrdersListRspqueryOrdersList(StringdomainID, Map<String,String> filteringParams)

GET /v1.0/{domain_id}/common/order-mgr/orders/detailLink (Partner OperationCapability)Link (Customer OperationCapability)

QueryOrderDetailRspqueryOrderDetail(StringdomainID, String orderId,Map<String, String>filteringParams)

GET /v1.0/{domain_id}/common/order-mgr/orders/{order_id}Link (Partner OperationCapability)Link (Customer OperationCapability)

OrderPayRsp orderPay(StringdomainID, OrderPayReq req)

POST /v1.0/{domain_id}/customer/order-mgr/order/payLink (Partner OperationCapability)

UnsubscribeOrderRspunsubscribeOrder(StringdomainID, String orderId,Map<String, String>filteringParams)

DELETE /v1.0/{domain_id}/customer/order-mgr/orders/{order_id}Link (Partner OperationCapability)

OrderActionsRsporderActions(String domainID,Map<String, String>filteringParams,OrderActionsReq req)

PUT /v1.0/{domain_id}/customer/order-mgr/orders/actionsLink (Partner OperationCapability)

QueryRefundOrderRspqueryRefundOrder(StringdomainID, Map<String,String> filteringParams)

GET /v1.0/{domain_id}/common/order-mgr/orders/refund-orderLink (Partner OperationCapability)

QueryResourcesRspqueryResources(StringdomainID, String orderId,Map<String, String>filteringParams)

GET /v1.0/{domain_id}/common/order-mgr/orders-resource/{order_id}Link (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 88

Page 94: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

PeriodResource

queryResourcesList(StringdomainID, Map<String,String> filteringParams)

GET /v1.0/{domain_id}/common/order-mgr/resources/detailLink (Partner OperationCapability)Link (Customer OperationCapability)

OrderRenewByResourceIdRsporderRenewByResour-ceId(OrderRenewByResourceI-dReq req, String domainID)

POST /v1.0/{domain_id}/common/order-mgr/resources/renewLink (Partner OperationCapability)

OrderDeleteByResourceIdRsporderDeleteByResour-ceId(String domainID,OrderDeleteByResourceIdReqreq)

POST /v1.0/{domain_id}/common/order-mgr/resources/deleteLink (Partner OperationCapability)

AutoRenewRspautoRenew(String domainID,String resourceId, Map<String,String> filteringParams)

POST /v1.0/{domain_id}/common/order-mgr/resources/{resource_id}/actionsLink (Partner OperationCapability)

CancelAutoRenewRspcancelAutoRenew(StringdomainID, String resourceId,Map<String, String>filteringParams)

DELETE /v1.0/{domain_id}/common/order-mgr/resources/{resource_id}/actionsLink (Partner OperationCapability)

Credit QueryCreditRspqueryCredit(String domainID,Map<String, String>filteringParams)

GET /v1.0/{partner_id}/partner/account-mgr/creditLink (Partner OperationCapability)

ActionResponsesetCredit(String domainID,SetCreditReq req)

POST /v1.0/{partner_id}/partner/account-mgr/creditLink (Partner OperationCapability)

Pay-Per-UseResource

QueryCustomerResourceRspqueryCustomerRe-source(String domainID,QueryCustomerResourceReqreq)

POST /v1.0/{partner_id}/partner/customer-mgr/customer-resource/query-resourcesLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 89

Page 95: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Bill QueryPostpaidBillRspqueryPostpaidBill(StringdomainID, Map<String,String> filteringParams)

GET /v1.0/{partner_id}/partner/account-mgr/postpaid-bill-summaryLink (Partner OperationCapability)

QueryMonthlySumRspqueryMonthlySum(StringdomainID, Map<String,String> filteringParams)

GET /v1.0/{domain_id}/customer/account-mgr/bill/monthly-sumLink (Customer OperationCapability)

QueryResRecordRspqueryResRecord(StringdomainID, Map<String,String> filteringParams)

GET /v1.0/{domain_id}/customer/account-mgr/bill/res-recordsLink (Customer OperationCapability)

QueryResFeeRecordRspqueryResFeeRecord(StringdomainID, Map<String,String> filteringParams)

GET /v1.0/{domain_id}/customer/account-mgr/bill/res-fee-recordsLink (Customer OperationCapability)

Utilities SendVerificationCodeRspsendVerificationCode(StringdomainID, SendVerificationCo-deReq req)

POST /v1.0/{partner_id}/partner/common-mgr/verificationcodeLink (Partner OperationCapability)

A.1.12 TMSThe SDK interfaces based on TMS v1.0 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

TagService Stringcreate(List<PredefineTagRequest> tagList)

POST /v1.0/predefine_tags/actionLink

Stringdekete(List<PredefineTagRequest> tagList)

POST/v1.0/predefine_tags/actionLink

PredefineTags list() GET/v1.0/predefine_tagsLink

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 90

Page 96: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

PredefineTagslist(TagFilterOption option)

GET/v1.0/predefine_tagsLink

ActionResponsemodify(PredefineTagRequestoldTag, PredefineTagRequestnewTag)

PUT/v1.0/predefine_tagsLink

A.1.13 EPSThe SDK interfaces based on EPS v1.0 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

EPService EPCreateResponsecreate(EPCreateRequestcreateRequest)

POST/v1.0/enterprise-projects

EPListResponse list() GET/v1.0/enterprise-projects

EPListResponselist(Map<String, String>queryParams)

GET/v1.0/enterprise-projects

EPQueryResponse get(StringepID)

GET/v1.0/enterprise-projects/{id}

EPQueryResponsemodify(String epID,EPModifyRequestmodifyRequest)

PUT/v1.0/enterprise-projects/{id}

EPQuotaResponse quotas() GET/v1.0//enterprise-projects/quotas

ActionResponse action(StringepID, EPActionRequestactionRequest)

POST/v1.0/enterprise-projects/{id}/action

EPResourceFilterResponsefilterResource(String epID,EPResourceFilterRequestfilterRequest)

POST/v1.0/enterprise-projects/{id}/resources/filter

ActionResponsemigrateResource(String epID,EPResourceActionRequestactionRequest)

POST/v1.0/enterprise-projects/{id} /resources-migrate

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 91

Page 97: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

A.1.14 RDSThe SDK interfaces based on the RDS v3 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

InstanceManageService

CreateInstanceResponsecreate(CreateInstanceRequestcreateRequest)

POST /v3/{project_id}/instancesLink

ListInstanceResponse list() GET/v3/{project_id}/instancesLink

ListInstanceResponselist(Map<String, String>queryParams)

GET/v3/{project_id}/instancesLink

ActionResponse delete(StringinstanceId)

DELETE /v3/{project_id}/instances/{instanceId}Link

InstanceCommonResponserestart(RestartInstanceRe-quest request, StringinstanceId)

PUT/v3/{project_id}/instances/{instanceId}/actionLink

InstanceCommonResponsesingleToHa(SingleToHaRdsRe-quest request, StringinstanceId)

GET/v3/{project_id}/instances/{instanceId}/actionLink

InstanceCommonResponseresizeFlavor(ResizeFlavorRequest request, String instanceId)

POST/v3/{project_id}/instances/{instanceId}/actionLink

InstanceCommonResponseenlargeVolume(EnlargeVolumeRequest request, StringinstanceId)

POST/v3/{project_id}/instances/{instanceId}/actionLink

ErrorLogResponselistErrorLog(Map<String,String> queryParams, StringinstanceId)

GET/v3/{project_id}/instances/{instanceId} /errorlogLink

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 92

Page 98: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

SlowLogListResponselistSlowLog(Map<String,String> queryParams, StringinstanceId)

GET/v3/{project_id}/instances/{instanceId}/slowlogLink

FlavorListlistFlavors(Map<String,String> filteringParams, StringengineName)

GET/v3/{project_id}/flavors/{engineName}Link

BackupsAndRestoreService

ManualBackupResponsecreate(ManualBackupRequestrequest)

POST/v3/{project_id}/backupsLink

BackupsResponse list(StringinstanceId, Map<String,String> filterParams)

GET/v3/{project_id}/backupsLink

ActionResponse delete(StringbackupId)

DELETE/v3/{project_id}/backups/{backupId}Link

A.2 Python

A.2.1 IAMThe SDK interfaces based on the IAM API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

AuthTokenOperations

create_authtoken(self, attr,nocatalog=None)

POST /v3/auth/tokens

validate_authtoken(self,x_subject_token,nocatalog=None):

GET /v3/auth/tokens

SecuritytokenOperations

create_securitytoken(self,**attrs)

POST /v3.0/OS-CREDENTIAL/securitytokens

CredentialOperations

create_credential(self, **attrs) POST /v3.0/OS-CREDENTIAL/credentials

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 93

Page 99: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

credentials(self, **query) GET /v3.0/OS-CREDENTIAL/credentials

get_credential(self,access_key)

GET /v3.0/OS-CREDENTIAL/credentials/{access_key}

update_credential(self,access_key, **attrs)

PUT /v3.0/OS-CREDENTIAL/credentials/{access_key}

delete_credential(self,access_key)

DELETE /v3.0/OS-CREDENTIAL/credentials/{access_key}

RegionOperations

regions(self, **query) GET /v3/regions

get_region(self, region) GET /v3/regions/{region_id}

ProjectOperations

projects(self, **query) GET /v3/projects

list_user_projects(self, user_id) GET /v3/users/{user_id}/projects

get_project_scopes(self) GET /v3/auth/projects

create_project(self, **attrs) POST /v3/projects

update_project(self, project,**attrs)

PATCH /v3/projects/{project_id}

get_project(self, project) GET /v3/projects/{project_id}

ProjectOperations(iam)

update_project_status(self,project_id, attrs)

PUT /v3-ext/projects/{project_id}

get_project_details_and_status(self, project_id)

GET /v3-ext/projects/{project_id}

DomainOperations

get_domain_scopes(self) GET /v3/auth/domains

PasswordConfigOperations

get_password_config(self,domain_id)

GET /v3/domains/{domain_id}/config/security_compliance

get_password_config_by_option(self, domain_id, option)

GET /v3/domains/{domain_id}/config/security_compliance/{option}

UserOperations(identity)

users(self, **query) GET /v3/users

get_user(self, user) GET /v3/users/{user_id}

list_group_users(self,group_id)

GET /v3/groups/{group_id}/users

create_user(self, **attrs) POST /v3/users

change_password(self,user_id, **attrs)

POST /v3/users/{user_id}/password

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 94

Page 100: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

update_user(self, user, **attrs) PATCH /v3/users/{user_id}

delete_user(self, user,ignore_missing=True)

DELETE /v3/users/{user_id}

remove_user_from_group(self,group_id, user_id)

DELETE /v3/groups/{group_id}/users/{user_id}

UserOperations(iam)

query_user_details(self,user_id)

GET /v3.0/OS-USER/users/{user_id}

create_user(self, **user) POST /v3.0/OS-USER/users

update_user_information(self,user_id, **user)

PUT /v3.0/OS-USER/users/{user_id}/info

update_user_information_by_admin(self, user_id, **user)

PUT /v3.0/OS-USER/users/{user_id}

GroupOperations

groups(self, **query) GET /v3/groups

get_group(self, group) GET /v3/groups/{group_id}

create_group(self, **attrs) POST /v3/groups

update_group(self, group,**attrs)

PATCH /v3/groups/{group_id}

delete_group(self, group,ignore_missing=True)

DELETE /v3/groups/{group_id}

check_group_user(self,group_id, user_id)

HEAD /v3/groups/{group_id}/users/{user_id}

add_user_to_group(self,group_id, user_id)

PUT /v3/groups/{group_id}/users/{user_id}

list_user_groups(self, user_id) GET /v3/users/{user_id}/groups

RoleOperations

roles(self, **query) GET /v3/roles

get_role(self, role) GET /v3/roles/{role_id}

list_domain_user_group_role(self, domain_id, group_id)

GET /v3/domains/{domain_id}/groups/{group_id}/roles

list_project_user_group_role(self, project_id, group_id)

GET /v3/projects/{project_id}/groups/{group_id}/roles

grant_domain_group_role(self,domain_id, group_id, role_id)

PUT /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id}

grant_project_group_role(self,project_id, group_id, role_id)

PUT /v3/projects/{project_id}/groups/{group_id}/roles/{role_id}

check_domain_group_role(self, domain_id, group_id, role_id)

HEAD /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 95

Page 101: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

check_project_group_role(self,project_id, group_id, role_id)

HEAD /v3/projects/{project_id}/groups/{group_id}/roles/{role_id}

delete_domain_group_role(self, domain_id, group_id,role_id)

DELETE /v3/domains/{domain_id}/groups/{group_id}/roles/{role_id}

delete_project_group_role(self,project_id, group_id, role_id)

DELETE /v3/projects/{project_id}/groups/{group_id}/roles/{role_id}

grant_all_projects_group_role(self, domain_id, group_id,role_id)

PUT /v3/OS-INHERIT/domains/{domain_id}/groups/{group_id}/roles/{role_id}/inherited_to_projects

CustomroleOperations

custom_roles(self) GET /v3.0/OS-ROLE/roles

get_custom_role(self, role_id) GET /v3.0/OS-ROLE/roles/{role_id}

create_custom_role(self,**attrs)

POST /v3.0/OS-ROLE/roles

update_custom_role(self,role_id, **attrs)

PATCH /v3.0/OS-ROLE/roles/{role_id}

delete_custom_role(self,role_id, ignore_missing=True)

DELETE /v3.0/OS-ROLE/roles/{role_id}

AgencyOperations

agencies(self, **query) GET /v3.0/OS-AGENCY/agencies

get_agency(self, agency_id) GET /v3.0/OS-AGENCY/agencies/{agency_id}

create_agency(self, **attrs) POST /v3.0/OS-AGENCY/agencies

update_agency(self,agency_id, **attrs)

PUT /v3.0/OS-AGENCY/agencies/{agency_id}

delete_agency(self, agency_id) DELETE /v3.0/OS-AGENCY/agencies/{agency_id}

list_domain_agency_role(self,domain_id, agency_id)

GET /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles

list_project_agency_role(self,project_id, agency_id)

GET /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles

grant_domain_agency_role(self, domain_id, agency_id,role_id)

PUT /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 96

Page 102: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

grant_project_agency_role(self, project_id, agency_id,role_id)

PUT /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id}

check_domain_agency_role(self, domain_id, agency_id,role_id)

HEAD /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id}

check_project_agency_role(self, project_id, agency_id,role_id)

HEAD /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id}

delete_domain_agency_role(self, domain_id, agency_id,role_id)

DELETE /v3.0/OS-AGENCY/domains/{domain_id}/agencies/{agency_id}/roles/{role_id}

delete_project_agency_role(self, project_id, agency_id,role_id)

DELETE /v3.0/OS-AGENCY/projects/{project_id}/agencies/{agency_id}/roles/{role_id}

VersionOperations

get_version_of_keystone(self) GET /

get_version3_of_keystone(self)

GET /v3

ServiceOperations

services(self, **query) GET /v3/services

get_service(self, service) GET /v3/services/{service_id}

get_service_catalog(self) GET /v3/auth/catalog

EndpointOperations

endpoints(self, **query) GET /v3/endpoints

get_endpoint(self, endpoint) GET /v3/endpoints/{endpoint_id}

A.2.2 IMSThe SDK interfaces based on the Glance v2 API are as follows. Invocation example:conn.image.upload_image()

Interface Method API

ImageOperations

upload_image(self,container_format=None,disk_format=None, data=None,**attrs)

POST /v2/imagesPUT /v2/images/{image_id}/file

delete_image(self, image,ignore_missing=True)

DELETE /v2/images/{image_id}

find_image(self, name_or_id,ignore_missing=True)

GET /v2/images

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 97

Page 103: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

get_image(self, image) GET /v2/images/{image_id}

images(self, **query) GET /v2/images

add_tag(self, image, tag) PUT /v2/images/{image_id}/tags/{tag}

remove_tag(self, image, tag) DELETE /v2/images/{image_id}/tags/{tag}

MemberOperations

add_member(self, image, **attrs) POST /v2/images/{image_id}/members

remove_member(self, member,image, ignore_missing=True)

DELETE /v2/images/{image_id}/members/{member_id}

find_member(self, name_or_id,image, ignore_missing=True)

GET /v2/images/{image_id}/members

get_member(self, member, image) GET /v2/images/{image_id}/members/{member_id}

members(self, image) GET /v2/images/{image_id}/members

update_member(self, member,image, **attrs)

PUT /v2/images/{image_id}/members/{member_id}

The SDK interfaces based on the IMS v2 API are as follows. Invocation example:conn.ims.create_cloudimage()

Interface Method API

CloudimageOperations

cloudimages(self, **query) GET /v2/cloudimages

update_cloudimage(self,cloudimage_id, **data)

PATCH /v2/cloudimages/{image_id}

create_cloudimage(self, **data) POST /v2/cloudimages/action

get_job(self, job_id): GET /v1/{project_id}/jobs/{job_id}

A.2.3 VPCThe SDK interfaces based on the VPC v1 API are as follows. Invocation example:conn.vpc.create_network().

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 98

Page 104: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

vpc vpcs(self, **query) GET /v1/{project_id}/vpcs

get_vpc(self, vpc) GET /v1/{project_id}/vpcs/{vpc_id}

create_vpc(self, **attrs) POST /v1/{project_id}/vpcs

update_vpc(self, vpc, **attrs) PUT /v1/{project_id}/vpcs/{vpc_id}

delete_vpc(self, vpc,ignore_missing=True)

DELETE /v1/{project_id}/vpcs/{vpc_id}

find_vpc(self, name_or_id,ignore_missing=True)

● GET /v1/{project_id}/vpcs/{vpc_id}

● GET /v1/{project_id}/vpcs

subnet subnets(self, **query) GET /v1/{project_id}/subnets

get_subnet(self, subnet) GET /v1/{project_id}/subnets/{subnet_id}

create_subnet(self, **attrs) POST /v1/{project_id}/subnets

update_subnet(self, subnet,vpc_id, **attrs)

PUT /v1/{project_id}/vpcs/{vpc_id}/subnets/{subnet_id}

delete_subnet(self, subnet,vpc_id, ignore_missing=True)

DELETE /v1/{project_id}/vpcs/{vpc_id}/subnets/{subnet_id}

find_subnet(self, name_or_id,ignore_missing=True)

● GET /v1/{project_id}/subnets/{subnet_id}

● GET /v1/{project_id}/subnets

public_ip public_ips(self, **query) GET /v1/{project_id}/publicips

get_public_ip(self, public_ip) GET /v1/{project_id}/publicips/{publicip_id}

create_public_ip(self, **attrs) POST /v1/{project_id}/publicips

update_public_ip(self,public_ip, **attrs)

PUT /v1/{project_id}/publicips/{publicip_id}

delete_public_ip(self, public_ip,ignore_missing=True)

DELETE /v1/{project_id}/publicips/{publicip_id}

find_public_ip(self,name_or_id,ignore_missing=True)

● GET /v1/{project_id}/publicips/{publicip_id}

● GET /v1/{project_id}/publicips

private_ip private_ips(self, subnet,**query)

GET /v1/{project_id}/subnets/{subnet_id}/privateips

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 99

Page 105: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

get_private_ip(self, private_ip) GET /v1/{project_id}/privateips/{privateip_id}

create_private_ip(self, **attrs) POST /v1/{project_id}/privateips

create_private_ips(self,*private_ips)

POST /v1/{project_id}/privateips

delete_private_ip(self,private_ip,ignore_missing=True)

DELETE /v1/{project_id}/privateips/{privateip_id}

find_private_ip(self,name_or_id, subnet_id,ignore_missing=True)

● GET /v1/{project_id}/privateips/{privateip_id}

● GET /v1/{project_id}/subnets/{subnet_id}/privateips

port ports(self, **query) GET /v1/{project_id}/ports

get_port(self, port) GET /v1/{project_id}/ports/{port_id}

create_port(self, **attrs) POST /v1/{project_id}/ports

update_port(self, port, **attrs) PUT /v1/{project_id}/ports/{port_id}

delete_port(self, port,ignore_missing=True)

DELETE /v1/{project_id}/ports/{port_id}

find_port(self, name_or_id,ignore_missing=True)

● GET /v1/{project_id}/ports/{port_id}

● GET /v1/{project_id}/ports

bandwidth bandwidths(self, **query) GET /v1/{project_id}/bandwidths

get_bandwidth(self,bandwidth)

GET /v1/{project_id}/bandwidths/{bandwidth_id}

update_bandwidth(self,bandwidth, **attrs)

PUT /v1/{project_id}/bandwidths/{bandwidth_id}

find_bandwidth(self,name_or_id,ignore_missing=True)

● GET /v1/{project_id}/bandwidths/{bandwidth_id

● GET /v1/{project_id}/bandwidths

security_group

security_groups(self, **query) GET /v1/{project_id}/security-groups

create_security_group(self,**attrs)

POST /v1/{project_id}/security-groups

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 100

Page 106: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

delete_security_group(self,security_group,ignore_missing=True)

DELETE /v1/{project_id}/security-groups/{security_group_id}

get_security_group(self,security_group)

GET /v1/{project_id}/security-groups/{security_group_id}

find_security_group(self,name_or_id,ignore_missing=True)

● GET /v1/{project_id}/security-groups/{security_group_id}

● GET /v1/{project_id}/security-groups

security_group_rule

create_security_group_rule(self, **attrs)

POST /v1/{project_id}/security-group-rules

delete_security_group_rule(self, security_group_rule,ignore_missing=True)

DELETE /v1/{project_id}/security-group-rules/{rules_security_groups_id}

get_security_group_rule(self,security_group_rule)

GET /v1/{project_id}/security-group-rules/{rules_security_groups_id}

security_group_rules(self,**query)

GET /v1/{project_id}/security-group-rules

find_security_group_rule(self,name_or_id,ignore_missing=True)

● GET /v1/{project_id}/security-group-rules/{rules_security_groups_id}

● GET /v1/{project_id}/security-group-rules

quota quotas(self, **query) GET /v1/{project_id}/quotas

The SDK interfaces based on the Neutron v2.0 API are as follows.

Invocation example: conn.network.create_network ()

Interface Method API

Floating IPOperations

create_ip(self, **attrs) POST /v2.0/floatingips

delete_ip(self, floating_ip,ignore_missing=True)

DELETE /v2.0/floatingips/{floatingip_id}

find_available_ip(self) GET /v2.0/floatingips

find_ip(self, name_or_id,ignore_missing=True)

GET /v2.0/floatingips

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 101

Page 107: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

get_ip(self, floating_ip) GET /v2.0/floatingips/{floatingip_id}

ips(self, **query) GET /v2.0/floatingips

update_ip(self, floating_ip, **attrs) PUT /v2.0/floatingips/{floatingip_id}

NetworkOperations

create_network(self, **attrs) POST /v2.0/networks

delete_network(self, network,ignore_missing=True)

DELETE /v2.0/networks/{network_id}

find_network(self, name_or_id,ignore_missing=True)

GET /v2.0/networks

get_network(self, network) GET /v2.0/networks/{network_id}

networks(self, **query) GET /v2.0/networks

update_network(self, network,**attrs)

PUT /v2.0/networks/{network_id}

PortOperations

create_port(self, **attrs) POST /v2.0/ports

delete_port(self, port,ignore_missing=True)

DELETE /v2.0/ports/{port_id}

find_port(self, name_or_id,ignore_missing=True)

GET /v2.0/ports

get_port(self, port) GET /v2.0/ports/{port_id}

ports(self, **query) GET /v2.0/ports

update_port(self, port, **attrs) PUT /v2.0/ports/{port_id}

RouterOperations

create_router(self, **attrs) POST /v2.0/router

delete_router(self, router,ignore_missing=True)

DELETE /v2.0/routers/{router_id}

find_router(self, name_or_id,ignore_missing=True)

GET /v2.0/routers

get_router(self, router) GET /v2.0/routers/{router_id}

routers(self, **query) GET /v2.0/routers

update_router(self, router, **attrs) PUT /v2.0/routers/{router_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 102

Page 108: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

add_interface_to_router(self, router,subnet_id=None, port_id=None)

PUT /v2.0/routers/{router_id}/add_router_interface

remove_interface_from_router(self,router, subnet_id=None,port_id=None)

PUT /v2.0/routers/{router_id}/remove_router_interface

SecurityGroupOperations

create_security_group(self, **attrs) POST /v2.0/security-groups

delete_security_group(self,security_group, ignore_missing=True)

DELETE /v2.0/security-groups/{security_group_id}

find_security_group(self, name_or_id,ignore_missing=True)

GET /v2.0/security-groups

get_security_group(self,security_group)

GET /v2.0/security-groups/{security_group_id}

security_groups(self, **query) GET /v2.0/security-groups

update_security_group(self,security_group, **attrs)

PUT /v2.0/security-groups/{security_group_id}

security_group_open_port(self, sgid,port, protocol='tcp')

POST /v2.0/security-group-rules

security_group_allow_ping(self, sgid) POST /v2.0/security-group-rules

create_security_group_rule(self,**attrs)

POST /v2.0/security-group-rules

delete_security_group_rule(self,security_group_rule,ignore_missing=True)

DELETE /v2.0/security-group-rules/{security_group_rule_id}

find_security_group_rule(self,name_or_id, ignore_missing=True)

GET /v2.0/security-group-rules

get_security_group_rule(self,security_group_rule)

GET /v2.0/security-group-rules/{security_group_rule_id}

security_group_rules(self, **query) GET /v2.0/security-group-rules

SubnetOperations

create_subnet(self, **attrs) POST /v2.0/subnets

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 103

Page 109: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

delete_subnet(self, subnet,ignore_missing=True)

DELETE /v2.0/subnets/{subnet_id}

find_subnet(self, name_or_id,ignore_missing=True)

GET /v2.0/subnets

get_subnet(self, subnet) GET /v2.0/subnets/{subnet_id}

subnets(self, **query) GET /v2.0/subnets

get_subnet_ports(self, subnet_id) GET /v2.0/ports

update_subnet(self, subnet, **attrs) PUT /v2.0/subnets/{subnet_id}

A.2.4 ECSThe SDK interfaces based on the Nova v2 API are as follows. Invocation example:conn.compute.create_server()

Interface Method API

FlavorOperations

find_flavor(self, name_or_id,ignore_missing=True)

● name:GET /v2/{project_id}/flavors

● id:GET /v2/{project_id}/flavors/{flavor_id}

get_flavor(self, flavor) GET /v2/{project_id}/flavors/{flavor_id}

query_flavor_extra_specs(self,flavor_id)

GET /v2/{project_id}/flavors/{flavors_id}/os-extra_specs

flavors(self, details=True,paginated=True, **query)

GET /v2/{project_id}/flavors/detail

ImageOperations

delete_image(self, image,ignore_missing=True)

DELETE /v2/{project_id}/images/{image_id}

find_image(self, name_or_id,ignore_missing=True)

name:GET /v2/{project_id}/imagesImage_id:GET /v2/{project_id}/images/{image_id}

get_image(self, image) GET /v2/{project_id}/images/{image_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 104

Page 110: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

images(self, details=True, **query) GET /v2/{project_id}/images/detail

get_image_metadata(self, image) GET /v2/{project_id}/images/{image_id}/metadata

KeypairOperations

create_keypair(self, **attrs) POST /v2/{project_id}/os-keypairs

delete_keypair(self, keypair,ignore_missing=True)

DELETE /v2/{project_id}/os-keypairs/{keypair_name}

get_keypair(self, keypair) GET /v2/{project_id}/os-keypairs/{keypair_name}

find_keypair(self, name,ignore_missing=True)

Keypair_name:GET /v2/{project_id}/os-keypairs/{keypair_name}Name:GET /v2/{project_id}/os-keypairs

keypairs(self) GET /v2/{project_id}/os-keypairs

ServerOperations

create_server(self, **attrs) POST /v2/{project_id}/servers

delete_server(self, server,ignore_missing=True, force=False)

DELETE /v2/{project_id}/servers/{server_id}

find_server(self, name_or_id,ignore_missing=True)

Name:GET /v2/{project_id}/serversServer_id:GET /v2/{project_id}/servers/{server_id}

get_server(self, server) GET /v2/{project_id}/servers/{server_id}

servers_list(self, details=True,paginated=True, headers=None,**query)

● details=True:GET /v2/{project_id}/servers/detail

● details=False:GET /v2/{project_id}/servers

create_server_image(self, server,name, metadata=None)

POST /v2/{project_id}/servers/{server_id}/action

add_floating_ip_to_server(self,server, address,fixed_address=None)

POST /v2/{project_id}/servers/{server_id}/action

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 105

Page 111: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

remove_floating_ip_from_server(self, server, address)

POST /v2/{project_id}/servers/{server_id}/action

lock_server(self, server) POST /v2/{project_id}/servers/{server_id}/action

unlock_server(self, server) POST /v2/{project_id}/servers/{server_id}/action

start_server(self, server) POST /v2/{project_id}/servers/{server_id}/action

stop_server(self, server) POST /v2/{project_id}/servers/{server_id}/action

wait_for_server(self, server,status='ACTIVE',failures=['ERROR'], interval=2,wait=120)

GET /v2/{project_id}/servers/{server_id}

instance_actions(self, server_id) GET /v2/{project_id}/servers/{server_id}/os-instance-actions

get_instance_action(self,server_id, request_id)

GET /v2/{project_id}/servers/{server_id}/os-instance-actions/{request_id}

get_server_console_output(self,server_id, lines)

POST /v2/{project_id}/servers/{server_id}/action

ServerInterfaceOperations

create_server_interface(self,server, **attrs)

POST /v2/{project_id}/servers/{server_id}/os-interface

delete_server_interface(self,server_interface, server=None,ignore_missing=True)

DELETE /v2/{project_id}/servers/{server_id}/os-interface/{port_id}

get_server_interface(self,server_interface, server=None)

GET /v2/{project_id}/servers/{server_id}/os-interface/{port_id}

server_interfaces(self, server) GET /v2/{project_id}/servers/{server_id}/os-interface

Server IPsOperations

server_ips(self, server,network_label=None)

GET /v2/{project_id}/servers/{server_id}/ips

AvailabilityZoneOperations

availability_zones(self,details=False)

GET /v2/{project_id}/os-availability-zone

ServerGroupOperations

create_server_group(self, **attrs) POST /v2/{project_id}/os-server-groups

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 106

Page 112: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

delete_server_group(self,server_group,ignore_missing=True)

DELETE /v2/{project_id}/os-server-groups/{server_group_id}

find_server_group(self,name_or_id, ignore_missing=True)

Name:GET /v2/{project_id}/os-server-groupsServer_group_id:GET /v2/{project_id}/os-server-groups/{server_group_id}

get_server_group(self,server_group)

GET /v2/{project_id}/os-server-groups/{server_group_id}

QuotaOperations

get_limits(self) GET /v2/{project_id}/limits

query_quota(self, project_id) GET /v2/{project_id}/os-quota-sets/{project_id}

query_quota_default(self,project_id)

GET /v2/{project_id}/os-quota-sets/{project_id}/defaults

VolumeAttachmentOperations

delete_volume_attachment(self,volume_attachment, server,force_del=False,ignore_missing=True)

DELETE /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

volume_attachments(self, server) GET /v2/{project_id}/servers/{server_id}/os-volume_attachments

get_volume_attachment(self,volume_attachment, server)

GET /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

create_volume_attachment(self,server, **attrs)

POST /v2/{project_id}/servers/{server_id}/os-volume_attachments

MetadataOperations

get_server_metadata(self, server,key=None)

● Key=None:GET /v2/{project_id}/servers/{server_id}/metadata

● Key !=None:GET /v2/{project_id}/servers/{server_id}/metadata/{key}

update_server_metadata(self,server, key, value)

PUT /v2/{project_id}/servers/{server_id}/metadata/{key}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 107

Page 113: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

set_server_metadata(self, server,**metadata)

POST /v2/{project_id}/servers/{server_id}/metadata

delete_server_metadata(self,server, keys)

DELETE /v2/{project_id}/servers/{server_id}/metadata/{key}

The SDK interfaces based on the ECS v1 API are as follows. Invocation example:conn.ecs.get_server()

Interface Method API

ServerOperations

get_server(self, server_id) GET /v1/{project_id}/cloudservers/{server_id}

servers(self, paginated=True,**query)

GET /v1/{project_id}/cloudservers/detail{?flavor,name,status,limit,offset,not-tags,reservation_id,enterprise_project_id}

def batch_change_os_server(self,**data)

POST/v1/{project_id}/cloudservers/{server_id}/changeos(Currently, no API link isavailable.)

get_autorecovery(self, server_id) GET /v1/{project_id}/cloudservers/{server_id}/autorecovery

config_autorecovery(self,server_id, autorecovery)

PUT /v1/{project_id}/cloudservers/{server_id}/autorecovery

reset_password(self, server_id,**data)

PUT /v1/{project_id}/cloudservers/{server_id}/os-reset-password

FlavorOperations

flavors(self, **query) GET /v1/{project_id}/cloudservers/flavors{?availability_zone}

QuotaOperations

quotas(self) GET /v1/{project_id}/cloudservers/limits

Server TagOperations

create_server_tags(self, server_id,**data)

POST /v1/{project_id}/cloudservers/{server_id}/tags/action

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 108

Page 114: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

delete_server_tags(self, server_id,**data)

POST /v1/{project_id}/cloudservers/{server_id}/tags/action

get_server_tags(self, server_id) GET /v1/{project_id}/cloudservers/{server_id}/tags

get_project_tags(self) GET /v1/{project_id}/cloudservers/tags

A.2.5 EVSThe SDK interfaces based on the EVS v2 API are as follows. Invocation example:conn.evs.create_volume_()

Interface Method API

VolumeOperations

create_volume(**data) POST /v2/{project_id}/cloudvolumes

update_volume(volume_id, **data) PUT /v2/{project_id}/cloudvolumes/{volume_id}

get_volume(volume_id) GET /v2/{project_id}/cloudvolumes/{volume_id}

resize_volume(self, volume_id,**data)

POST /v2/{project_id}/cloudvolumes/{volume_id}/action

volumes(self, **query) GET /v2/{project_id}/cloudvolumes/detail

JobOperations

get_job(self, job_id) GET /v1/{project_id}/jobs/{job_id}

The SDK interfaces based on the Cinder v2 API are as follows.

Invocation example: conn.block_store.create_volume()

Interface Method API

SnapshotOperations

get_snapshot(self, snapshot) GET /v2/{project_id}/snapshots/{snapshot_id}

snapshots(self, details=True,**query)

GET /v2/{project_id}/snapshots/detail

create_snapshot(self, **attrs) POST /v2/{project_id}/snapshots

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 109

Page 115: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

delete_snapshot(self, snapshot,ignore_missing=True)

DELETE /v2/{project_id}/snapshots/{snapshot_id}

TypeOperations

get_type(self, type) GET /v2/{project_id}/types/{volume_type_id}

types(self) GET /v2/{project_id}/types

VolumeOperations

get_volume(self, volume) GET /v2/{project_id}/volumes/{volume_id}

volumes(self, details=True, **query) GET /v2/{project_id}/volumes/detail

create_volume(self, **attrs) POST /v2/{project_id}/volumes

delete_volume(self, volume,ignore_missing=True, cascade=False)

DELETE /v2/{project_id}/volumes/{volume_id}

A.2.6 ASThe SDK interfaces based on the AS v1 API are as follows. Invocation example:conn.auto_scaling.create_group()

Interface Method API

GroupOperations

create_group(self, **attrs) POST /autoscaling-api/v1/{project_id}/scaling_group

groups(self, **query) GET /autoscaling-api/v1/{project_id}/scaling_group

get_group(self, group) GET /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}

update_group(self, group,**attrs)

PUT /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}

delete_group(self, group,ignore_missing=True)

DELETE /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}

resume_group(self, group) POST /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}/action

pause_group(self, group) POST /autoscaling-api/v1/{project_id}/scaling_group/{scaling_group_id}/action

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 110

Page 116: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ConfigOperations

create_config(self, name, **attrs) POST /autoscaling-api/v1/{project_id}/scaling_configuration

configs(self, **query) GET /autoscaling-api/v1/{project_id}/scaling_configuration

get_config(self, config) GET /autoscaling-api/v1/{project_id}/scaling_configuration/{scaling_configuration_id}

delete_config(self, config,ignore_missing=True)

DELETE /autoscaling-api/v1/{project_id}/scaling_configuration/{scaling_configuration_id}

batch_delete_configs(self,configs)

POST /autoscaling-api/v1/{project_id}/scaling_configurations

InstanceOperations

instances(self, group, **query) GET /autoscaling-api/v1/{project_id}/scaling_group_instance/{scaling_group_id}/list

remove_instance(self, instance,delete_instance=False,ignore_missing=True)

DELETE /autoscaling-api/v1/{project_id}/scaling_group_instance/{instance_id}

batch_add_instances(self, group,instances)

POST /autoscaling-api/v1/{project_id}/scaling_group_instance/{scaling_group_id}/action

batch_remove_instances(self,group, instances,delete_instance=False)

POST /autoscaling-api/v1/{project_id}/scaling_group_instance/{scaling_group_id}/action

PolicyOperations

create_policy(self, **attrs) POST /autoscaling-api/v1/{project_id}/scaling_policy

update_policy(self, policy, **attrs) PUT /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}

policies(self, group, **query) GET /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_group_id}/list

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 111

Page 117: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

get_policy(self, policy) GET /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}

execute_policy(self, policy) POST /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}/action

resume_policy(self, policy) POST /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}/action

pause_policy(self, policy) POST /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}/action

delete_policy(self, policy,ignore_missing=True)

DELETE /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}

ActivityOperations

activities(self, group, **query) GET /autoscaling-api/v1/{project_id}/scaling_activity_log/{scaling_group_id}

QuotaOperations

quotas(self, group=None) GET /autoscaling-api/v1/{project_id}/quotas

quotas(self, group=None) GET /autoscaling-api/v1/{project_id}/quotas/{scaling_group_id}

Lifecycle_hookOperations

create_lifecycle_hook(self, group,**attrs)

POST /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}

lifecycle_hooks(self, group) GET /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}/list

get_lifecycle_hook(self, group,lifecycle_hook)

GET /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

update_lifecycle_hook(self,group, lifecycle_hook, **attrs)

PUT /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 112

Page 118: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

delete_lifecycle_hook(self, group,lifecycle_hook)

DELETE /autoscaling-api/v1/{project_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

call_back_instance(self, group,**attrs)

PUT /autoscaling-api/v1/{project_id}/scaling_instance_hook/{scaling_group_id}/callback

get_group_hanging_instance(self,group, **query)

GET /autoscaling-api/v1/{project_id}/scaling_instance_hook/{scaling_group_id}/list{?instance_id}

NotificationOperations

create_notification(self, group,**data)

PUT /autoscaling-api/v1/{project_id}/scaling_notification/{scaling_group_id}

notifications(self, group) GET /autoscaling-api/v1/{project_id}/scaling_notification/{scaling_group_id}

delete_notification(self, group,topic)

DELETE /autoscaling-api/v1/{project_id}/scaling_notification/{scaling_group_id}/{topic_urn}

A.2.7 CESThe SDK interfaces based on the CES v1.0 API are as follows. Invocation example:conn.cloud_eye.metrics()

Interface Method API

MetricOperations

metrics(self, **query) GET /V1.0/{project_id}/metrics

AlarmOperations

alarms(self, **query) GET /V1.0/{project_id}/alarms

get_alarm(self, alarm) GET /V1.0/{project_id}/alarms/{alarm_id}

enable_alarm(self, alarm)disable_alarm(self, alarm)

PUT /V1.0/{project_id}/alarms/{alarm_id}/action

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 113

Page 119: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

delete_alarm(self, alarm,ignore_missing=True)

DELETE /V1.0/{project_id}/alarms/{alarm_id}

MetricDataOperations

metric_aggregations(self, **query) GET /V1.0/{project_id}/metric-data

add_metric_data(self, data) POST /V1.0/{project_id}/metric-data

QuotaOperations

quotas(self) GET /V1.0/{project_id}/quotas

A.2.8 ELBThe SDK interfaces based on the ELB v2.0 API are as follows. Invocation example:conn.network.loadbalancers()

Interface Method API

LoadbalancerOperations

loadbalancers(self,**query)

GET /v2.0/lbaas/loadbalancers

get_loadbalancer(self,lb)

GET /v2.0/lbaas/loadbalancers/{loadbalancer_id}

create_loadbalancer(self,**attrs)

POST /v2.0/lbaas/loadbalancers

update_loadbalancer(self, lb, **attrs)

PUT /v2.0/lbaas/loadbalancers/{loadbalancer_id}

delete_loadbalancer(self,lb, ignore_missing=True)

DELETE /v2.0/lbaas/loadbalancers/{loadbalancer_id}

get_loadbalancer_status_stree(self, lb)

GET /v2.0/lbaas/loadbalancers/{loadbalancer_id}/statuses

ListenerOperations

listeners(self, **query) GET /v2.0/lbaas/listeners

get_listener(self, lsn) GET /v2.0/lbaas/listeners/{listener_id}

create_listener(self,**attrs)

POST /v2.0/lbaas/listeners

update_listener(self, lsn,**attrs)

PUT /v2.0/lbaas/listeners/{listener_id}

delete_listener(self, lsn,ignore_missing=True)

DELETE /v2.0/lbaas/listeners/{listener_id}

PoolOperations

pools(self, **query) GET /v2.0/lbaas/pools

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 114

Page 120: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

get_pool(self, pol) GET /v2.0/lbaas/pools/{pool_id}

create_pool(self, **attrs) POST /v2.0/lbaas/pools

update_pool(self, pol,**attrs)

PUT /v2.0/lbaas/pools/{pool_id}

delete_pool(self, pol,ignore_missing=True)

DELETE /v2.0/lbaas/pools/{pool_id}

MemberOperations

members(self, **query) GET /v2.0/lbaas/pools/{pool_id}/members

get_member(self, mem,pool = None)

GET /v2.0/lbaas/pools/{pool_id}/members/{member_id}

create_member(self,**attrs)

POST /v2.0/lbaas/pools/{pool_id}/members

update_member(self,mem, **attrs)

PUT /v2.0/lbaas/pools/{pool_id}/members/{member_id}

delete_member(self,mem, pool = None,ignore_missing=True)

DELETE /v2.0/lbaas/pools/{pool_id}/members/{member_id}

HealthmonitorOperations

healthmonitors(self,**query)

GET /v2.0/lbaas/healthmonitors

get_healthmonitor(self,hlth)

GET /v2.0/lbaas/healthmonitors/{healthmonitor_id}

create_healthmonitor(self, **attrs)

POST /v2.0/lbaas/healthmonitors

update_healthmonitor(self, hlth, **attrs)

PUT /v2.0/lbaas/healthmonitors/{healthmonitor_id}

delete_healthmonitor(self, hlth,ignore_missing=True)

DELETE /v2.0/lbaas/healthmonitors/{healthmonitor_id}

PolicyOperations

poliycies(self, **query) GET /v2.0/lbaas/l7policies

get_policy(self, plc) GET /v2.0/lbaas/l7policies/{l7policy_id}

create_policy(self,**attrs)

POST /v2.0/lbaas/l7policies

update_policy(self, plc,**attrs)

PUT /v2.0/lbaas/l7policies/{l7policy_id}

delete_policy(self, plc,ignore_missing=True)

DELETE /v2.0/lbaas/l7policies/{l7policy_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 115

Page 121: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

RuleOperations

rules(self, **query) GET /v2.0/lbaas/l7policies/{l7policy_id}/rules

get_rule(self, rul, policy) GET /v2.0/lbaas/l7policies/{l7policy_id}/rules/{l7rule_id}

create_rule(self, **attrs) POST /v2.0/lbaas/l7policies/{l7policy_id}/rules

update_rule(self, rul,**attrs)

PUT /v2.0/lbaas/l7policies/{l7policy_id}/rules/{l7rule_id}

delete_rule(self, rul,policy,ignore_missing=True)

DELETE /v2.0/lbaas/l7policies/{l7policy_id}/rules/{l7rule_id}

WhitelistOperations

whitelists(self, **query) GET /v2.0/lbaas/whitelists

get_whitelist(self, wl) GET /v2.0/lbaas/whitelists/{whitelist_id}

create_whitelist(self,**attrs)

POST /v2.0/lbaas/whitelists

update_whitelist(self, wl,**attrs)

PUT /v2.0/lbaas/whitelists/{whitelist_id}

delete_whitelist(self, wl,ignore_missing=True)

DELETE /v2.0/lbaas/whitelists/{whitelist_id}

CertificateOperations

certificates(self, **query) GET /v2.0/lbaas/certificates

get_certificate(self, cf) GET /v2.0/lbaas/certificates/{certificate_id}

create_certificate(self,**attrs)

POST /v2.0/lbaas/certificates

update_certificate(self,cf, **attrs)

PUT /v2.0/lbaas/certificates/{certificate_id}

delete_certificate(self, cf,ignore_missing=True)

DELETE /v2.0/lbaas/certificates/{certificate_id}

A.2.9 RDSThe SDK interfaces based on the RDS v3 API are as follows. Invocation example:conn.rds_v3.create_instance().

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 116

Page 122: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

InstanceOperations

create_instance(self,**kwargs)

POST /v3/{project_id}/instancesLink

instances(self) GET /v3/{project_id}/instances?id={id}&name={name}&type={type}&datastore_type={datastore_type}&vpc_id={vpc_id}&subnet_id={subnet_id}&offset={offset}&limit={limit}Link

delete_instance(self,**kwargs)

DELETE /v3/{project_id}/instances/{instance_id}Link

resize_instance(self,instance, flavorRef)

POST /v3/{project_id}/instances/{instance_id}/actionLink

resize_instance_volume(instance, size)

POST /v3/{project_id}/instances/{instance_id}/actionLink

restart_instance(instance) POST /v3/{project_id}/instances/{instance_id}/actionLink

single_to_ha(instance,**single_to_ha_param)

POST /v3/{project_id}/instances/{instance_id}/actionLink

BackupOperations

create_backup(self,**kwarg)

POST /v3/{project_id}/backupsLink

backups(self, **kwarg) GET /v3/{project_id}/backups?instance_id={instance_id}&backup_id={backup_id}&backup_type={backup_type}&offset={offset}&limit={limit}&begin_time={begin_time}&end_time={end_time}Link

restore_time(self, **kwarg) GET v3/{project_id}/instances/{instance_id}/restore-timeLink

delete_backup(self, id) DELETE /v3/{project_id}/backups/{backup_id}Link

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 117

Page 123: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

backup_files(**query) GET /v3/{project_id}/backup-files?backup_id={backup_id}Link

recovery_instance(**recovery_point)

POST /v3/{project_id}/instancesLink

BackupPolicyOperations

create_backup_policy(self,**kwargs)

PUT /v3/{project_id}/instances/{instance_id}/backups/policyLink

get_backup_policy(self,**kwargs)

GET /v3/{project_id}/instances/{instance_id}/backups/policyLink

FlavorOperations

flavors(self, **kwargs) GET /v3/{project_id}/flavors/{database_name}?version_name={version_name}Link

DatastoreOperations

datastore_versions(self,dbname)

GET /v3/{project_id}/datastores/{database_name}Link

Configuration Operations

configurations(self,**kwargs)

GET /v3/{project_id}/configurationsLink

LogOperations

list_instance_errorlog(**query)

GET instances/{instance_id}/errorlog?start_date={start_date}&end_date={end_date}Link

list_instance_slowlog(**query)

GET /v3/{project_id}/instances/{instance_id}/slowlog?start_date={start_date}&end_date={end_date}Link

A.2.10 CDNThe SDK interfaces based on the CDN v1.0 API are as follows. Invocation example:conn.cdn.domains()

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 118

Page 124: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Acceleration domainname Operations

domains(enterprise_project_id='ALL',page_size=100,page_number=1,**query)

GET /v1.0/cdn/domains

create_domain(**attrs) POST /v1.0/cdn/domains

get_domain(domain_id) GET /v1.0/cdn/domains/{domain_id}/detail

get_domain_detail_by_enterprise_project_id(domain_id,enterprise_project_id)

GET /v1.0/cdn/domains/{domain_id}/detail

delete_domain(domain_id), ignore_missing=True)

DELETE /v1.0/cdn/domains/{domain_id}

delete_domain_by_enterprise_project_id(domain_id, enterprise_project_id)

DELETE /v1.0/cdn/domains/{domain_id}

enable_domain(domain_id)

PUT /v1.0/cdn/domains/{domain_id}/enable

enable_domain_by_enterprise_project_id(domain_id, enterprise_project_id)

PUT /v1.0/cdn/domains/{domain_id}/enable

disable_domain(domain_id)

PUT /v1.0/cdn/domains/{domain_id}/disable

disable_domain_by_enterprise_project_id(domain_id, enterprise_project_id)

PUT /v1.0/cdn/domains/{domain_id}/disable

set_domain_sources(domain_id, **attrs)

PUT /v1.0/cdn/domains/{domain_id}/origin

set_domain_sources_by_enterprise_project_id(domain_id,enterprise_project_id,**attrs)

PUT /v1.0/cdn/domains/{domain_id}/origin

set_domain_origin_host(domain_id, **attrs)

PUT /v1.0/cdn/domains/{domain_id}/originhost

set_domain_origin_host_by_enterprise_project_id(domain_id,enterprise_project_id,**attrs)

PUT /v1.0/cdn/domains/{domain_id}/originhost

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 119

Page 125: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

get_domain_origin_host(domain_id)

GET /v1.0/cdn/domains/{domain_id}/originhost

get_domain_origin_host_by_enterprise_project_id(domain_id,enterprise_project_id)

GET /v1.0/cdn/domains/{domain_id}/originhost

set_domain_range_status(domain_id,**attrs)

PUT /v1.0/cdn/domains/{domainId}/range-switch

set_domain_follow302_switch(domain_id,**attrs)

PUT /v1.0/cdn/domains/{domainId}/follow302-switch

set_domain_referer(domain_id, **attrs)

PUT /v1.0/cdn/domains/{domain_id}/referer

set_domain_referer_by_enterprise_project_id(domain_id,enterprise_project_id,**attrs)

PUT /v1.0/cdn/domains/{domain_id}/referer

get_domain_referer(domain_id)

GET /v1.0/cdn/domains/{domain_id}/referer

get_domain_referer_by_enterprise_project_id(domain_id,enterprise_project_id)

GET /v1.0/cdn/domains/{domain_id}/referer

get_domain_ip_acl(domain_id)

GET /v1.0/cdn/domains/{domainId}/ip-acl

set_domain_ip_acl(domain_id,**attrs)

PUT /v1.0/cdn/domains/{domainId}/ip-acl

set_domain_cache_rules(domain_id, **attrs)

PUT /v1.0/cdn/domains/{domain_id}/cache

set_domain_cache_rules_by_enterprise_project_id(domain_id,enterprise_project_id,**attrs)

PUT /v1.0/cdn/domains/{domain_id}/cache

get_domain_cache_rules(domain_id)

GET /v1.0/cdn/domains/{domain_id}/cache

get_domain_cache_rules_by_enterprise_project_id(domain_id,enterprise_project_id)

GET /v1.0/cdn/domains/{domain_id}/cache

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 120

Page 126: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

set_domain_https(domain_id, **attrs)

PUT /v1.0/cdn/domains/{domain_id}/https-info

set_domain_https_by_enterprise_project_id(domain_id,enterprise_project_id,**attrs)

PUT /v1.0/cdn/domains/{domain_id}/https-info

get_domain_https(domain_id)

GET /v1.0/cdn/domains/{domain_id}/https-info

get_domain_https_by_enterprise_project_id(domain_id,enterprise_project_id)

GET /v1.0/cdn/domains/{domain_id}/https-info

get_cdn_ips(ips) GET /v1.0/cdn/ip-info

get_cdn_ips_enterprise(ips, enterprise_project_id)

GET /v1.0/cdn/ip-info

set_domain_response_header(domain_id,**attrs)

PUT /v1.0/cdn/domains/{domainId}/response-header

set_domain_response_header_enterprise(domain_id,enterprise_project_id,**attrs)

PUT /v1.0/cdn/domains/{domainId}/response-header

get_domain_response_header(domain_id)

GET /v1.0/cdn/domains/{domainId}/response-header

get_domain_response_header_enterprise(domain_id, enterprise_project_id)

GET /v1.0/cdn/domains/{domainId}/response-header

Statistic Operations query_top_url(**query) GET /v1.0/cdn/statistics/top-url

query_domain_item_details(**query)

GET /v1.0/cdn/statistics/domain-item-details

query_domain_item_location_details(**query)

GET /v1.0/cdn/statistics/domain-item-location-details

query_network_traffic(**query)

GET /v1.0/cdn/statistics/flux

query_network_traffic_detail(**query)

GET /v1.0/cdn/statistics/flux-detail

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 121

Page 127: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

query_bandwidth_peak(**query)

GET /v1.0/cdn/statistics/bandwidth

query_bandwidth(**query)

GET /v1.0/cdn/statistics/bandwidth-detail

query_summary(**query) GET /v1.0/cdn/statistics/domain-summary

query_summary_detail(**query)

GET /v1.0/cdn/statistics/domain-summary-detail

summaries(**query) GET /v1.0/cdn/statistics/domain

query_region_detail_summary(**query)

GET /v1.0/cdn/statistics/region-detail-summary

query_carrier_detail_summary(**query)

GET /v1.0/cdn/statistics/carrier-detail-summary

query_region_carrier_domain(**query)

GET /v1.0/cdn/statistics/region-carrier-domain

query_region_carrier_detail(**query)

GET /v1.0/cdn/statistics/region-carrier-detail

Log Operations logs(domain_name,query_date,page_size=100,page_number=1)

GET /v1.0/cdn/logs

logs_by_enterprise_project_id (domain_name,query_date,page_size=100,page_number=1,enterprise_project_id)

GET /v1.0/cdn/logs

Preheating taskOperations

create_preheat_task(**attrs)

POST /v1.0/cdn/preheatingtasks

Refreshing taskOperations

create_refresh_task(**attrs)

POST /v1.0/cdn/refreshtasks

Query task Operations tasks(page_size=100,page_number=1,**query)

GET /v1.0/cdn/historytasks

get_task(task_id) GET /v1.0/cdn/historytasks/{task_id}/detail

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 122

Page 128: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

A.2.11 BSSThe SDK interfaces based on the BSS v1.0 API are as follows. For details about theinvoking methods, see the sample codes.

NO TE

The following API links are provided for partners and customers. If the link is PartnerOperation Capability, the link is provided for partners. If the link is Customer OperationCapability, the link is provided for customers.

Interface Method API

CustomerManagement

check_customer_register_info(userDomainId, **data)

POST /v1.0/{partner_id}/partner/customer-mgr/check-userLink (Partner OperationCapability)

create_customer(userDomainId, **data)

POST /v1.0/{partner_id}/partner/customer-mgr/customerLink (Partner OperationCapability)

query_customer_list(userDomainId, **data)

POST /v1.0/{partner_id}/partner/customer-mgr/queryLink (Partner OperationCapability)

freeze_customer(userDomainId, **data)

POST /v1.0/{partner_id}/partner/customer-mgr/frozensLink (Partner OperationCapability)

unfreeze_customer(userDomainId, **data)

POST /v1.0/{partner_id}/partner/customer-mgr/unfrozensLink (Partner OperationCapability)

RealnameAuth

individual_realname_auth(userDomainId, **data)

POST /v1.0/{partner_id}/partner/customer-mgr/realname-auth/individualLink (Partner OperationCapability)

enterprise_realname_auth(userDomainId, **data)

POST /v1.0/{partner_id}/partner/customer-mgr/realname-auth/enterpriseLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 123

Page 129: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

change_enterprise_realname_auth(userDomainId, **data)

PUT /v1.0/{partner_id}/partner/customer-mgr/realname-auth/enterpriseLink (Partner OperationCapability)

query_realname_auth(userDomainId, **data)

GET /v1.0/{partner_id}/partner/customer-mgr/realname-auth/resultLink (Partner OperationCapability)

Enquiry query_rating(userDomainId,**data)

POST /v1.0/{domain_id}/customer/product-mgr/query-ratingLink (Partner OperationCapability)Link (Customer OperationCapability)

PeriodOrder

query_order_list(userDomainId, **data)

GET /v1.0/{domain_id}/common/order-mgr/orders/detailLink (Partner OperationCapability)Link (Customer OperationCapability)

query_order_detail(userDomainId, **data)

GET /v1.0/{domain_id}/common/order-mgr/orders/{order_id}Link (Partner OperationCapability)Link (Customer OperationCapability)

pay_period_order(userDomainId, **data)

POST /v1.0/{domain_id}/customer/order-mgr/order/payLink (Partner OperationCapability)

unsubscribe_period_order(userDomainId, **data)

DELETE /v1.0/{domain_id}/customer/order-mgr/orders/{order_id}Link (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 124

Page 130: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

cancel_order(userDomainId,orderId="xxxxxxxxxxxxx",action_id="cancel")

PUT /v1.0/{domain_id}/customer/order-mgr/orders/actionsLink (Partner OperationCapability)

query_refund_order_amount(domain_id=userDomainId,order_id='xxxxxxxxxx')

GET /v1.0/{domain_id}/common/order-mgr/orders/refund-orderLink (Partner OperationCapability)

query_resource_status_by_orderId(userDomainId,order_id="xxxxxxx")

GET /v1.0/{domain_id}/common/order-mgr/orders-resource/{order_id}Link (Partner OperationCapability)

PeriodResourse

query_customer_period_resources_list(userDomainId, **data)

GET /v1.0/{domain_id}/common/order-mgr/resources/detailLink (Partner OperationCapability)Link (Customer OperationCapability)

renew_subscription_by_resourceId(userDomainId, **data)

POST /v1.0/{domain_id}/common/order-mgr/resources/renewLink (Partner OperationCapability)

unsubscribe_by_resourceId(userDomainId, **data)

POST /v1.0/{domain_id}/common/order-mgr/resources/deleteLink (Partner OperationCapability)

enable_auto_renew(userDomainId,resource_id="xxxxxxxxxxxxx",action_id="autorenew")

POST /v1.0/{domain_id}/common/order-mgr/resources/{resource_id}/actionsLink (Partner OperationCapability)

disable_auto_renew(userDomainId, resource_id="xxxxxxxxxxxxx ",action_id="autorenew")

DELETE /v1.0/{domain_id}/common/order-mgr/resources/{resource_id}/actionsLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 125

Page 131: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Credit query_credit(userDomainId,**data)

GET /v1.0/{partner_id}/partner/account-mgr/creditLink (Partner OperationCapability)

set_credit(userDomainId,**data)

POST /v1.0/{partner_id}/partner/account-mgr/creditLink (Partner OperationCapability)

Pay-Per-UseResource

query_customer_resource(userDomainId, **data)

POST /v1.0/{partner_id}/partner/customer-mgr/customer-resource/query-resourcesLink (Partner OperationCapability)

Bill query_partner_monthly_bills(userDomainId, **data)

GET /v1.0/{partner_id}/partner/account-mgr/postpaid-bill-summaryLink (Partner OperationCapability)

query_monthly_expenditure_summary(userDomainId,**data)

GET /v1.0/{domain_id}/customer/account-mgr/bill/monthly-sumLink (Customer OperationCapability)

query_resource_usage_details(userDomainId, **data)

GET /v1.0/{domain_id}/customer/account-mgr/bill/res-recordsLink (Customer OperationCapability)

query_resource_usage_record(userDomainId, **data)

GET /v1.0/{domain_id}/customer/account-mgr/bill/res-fee-recordsLink (Customer OperationCapability)

Utilities send_verification_code(userDomainId, **data)

POST /v1.0/{partner_id}/partner/common-mgr/verificationcodeLink (Partner OperationCapability)

A.2.12 TMSThe SDK interfaces based on TMS v1.0 API are as follows. For details about theinvoking methods, see the sample codes.

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 126

Page 132: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

PredefineTag

create_predefine_tag (**attrs) POST /v1.0/predefine_tags/actionLink

list_predefine_tags(**query) GET/v1.0/predefine_tagsLink

update_predefine_tag (**attrs) PUT /v1.0/predefine_tagsLink

A.2.13 EPSThe SDK interfaces based on EPS v1.0 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

EnterpriseProject

create_enterprise_project(**attrs) POST /v1.0/enterprise-projects

list_enterprise_projects(**query) GET /v1.0/enterprise-projects

get_enterprise_project(enterpriseProjectId)

GET /v1.0/enterprise-projects/{id}

update_enterprise_project( enterpriseProjectId, **attrs)

PUT /v1.0/enterprise-projects/{id}

enterprise_project_quotas GET /v1.0//enterprise-projects/quotas

operate_enterprise_project(enterpriseProjectId, **attrs)

POST/v1.0/enterprise-projects/{id}/action

filter_resource_enterprise_project(enterpriseProjectId, **attrs)

POST /v1.0/enterprise-projects/{id}/resources/filter

migrate_resource_enterprise_project(enterpriseProjectId, **attrs)

POST /v1.0/enterprise-projects/{id} /resources-migrate

A.3 Go

A.3.1 ECSThe SDK interfaces based on the ECS v1 API are as follows. For details about theinvoking methods, see the sample codes.

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 127

Page 133: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

CloudServers GetJobResult(client*gophercloud.ServiceClient, id string)

GET /v1/{project_id}/jobs/{job_id}

GetServerRecoverySta-tus(client*gophercloud.ServiceClient, serverID string)

GET /v1/{project_id}/cloudservers/{server_id}/autorecovery

ConfigServerRecov-ery(client*gophercloud.ServiceClient, serverID string, optsstring)

PUT /v1/{project_id}/cloudservers/{server_id}/autorecovery

Get(client*gophercloud.ServiceClient, serverID string)

GET /v1/{project_id}/cloudservers/{server_id}

ListDetail(client*gophercloud.ServiceClient, opts ListOptsBuilder)

GET /v1/{project_id}/cloudservers/detail{?flavor,name,status,limit,offset,not-tags,reservation_id,enterprise_project_id,tags}

BatchStart(client*gophercloud.ServiceClient, opts BatchStartOpts)

POST /v1/{project_id}/cloudservers/action

BatchReboot(client*gophercloud.ServiceClient, optsBatchRebootOpts)

POST /v1/{project_id}/cloudservers/action

BatchStop(client*gophercloud.ServiceClient, opts BatchStopOpts)

POST /v1/{project_id}/cloudservers/action

BatchUpdate(client*gophercloud.ServiceClient, optsBatchUpdateOpts)

PUT /v1/{project_id}/cloudservers/server-name

Tags BatchCreateServer-Tags(client*gophercloud.ServiceClient, serverID string, optsBatchTagCreateOpts-Builder)

POST /v1/{project_id}/cloudservers/{server_id}/tags/action

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 128

Page 134: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

BatchDeleteServer-Tags(client*gophercloud.ServiceClient, serverID string, optsBatchTagDeleteOpts-Builder)

POST /v1/{project_id}/cloudservers/{server_id}/tags/action

ListProjectTags(client*gophercloud.ServiceClient)

GET /v1/{project_id}/cloudservers/tags

ListServerTags(client*gophercloud.ServiceClient, serverID string)

GET /v1/{project_id}/cloudservers/{server_id}/tags

The SDK interfaces based on the ECS v2 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

CloudServers

ReinstallOS(client*gophercloud.ServiceClient,serverID string, optsReinstallOptsBuilder)

POST /v2/{project_id}/cloudservers/{server_id}/reinstallos

The SDK interfaces based on the Nova v2 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

Servers Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2/{project_id}/servers

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v2/{project_id}/servers/detail

Get(client*gophercloud.ServiceClient, idstring)

GET /v2/{project_id}/servers/{server_id}

Update(client*gophercloud.ServiceClient, idstring, opts UpdateOptsBuilder)

PUT /v2/{project_id}/servers/{server_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 129

Page 135: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Delete(client*gophercloud.ServiceClient, idstring)

DELETE /v2/{project_id}/servers/{server_id}

Resize(client*gophercloud.ServiceClient, idstring, opts ResizeOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/action

ConfirmResize(client*gophercloud.ServiceClient, idstring)

POST /v2/{project_id}/servers/{server_id}/action

RevertResize(client*gophercloud.ServiceClient, idstring)

POST /v2/{project_id}/servers/{server_id}/action

Start(client*gophercloud.ServiceClient, idstring)

POST /v2/{project_id}/servers/{server_id}/action

Stop(client*gophercloud.ServiceClient, idstring)

POST /v2/{project_id}/servers/{server_id}/action

Create(client*gophercloud.ServiceClient, optsservers.CreateOptsBuilder)

POST /v2/{project_id}/os-volumes_boot

Reboot(client*gophercloud.ServiceClient, idstring, opts RebootOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/action

ResetMetadata(client*gophercloud.ServiceClient, idstring, opts ResetMetadataOpts-Builder)

PUT /v2/{project_id}/servers/{server_id}/metadata

Metadata(client*gophercloud.ServiceClient, idstring)

GET /v2/{project_id}/servers/{server_id}/metadata

UpdateMetadata(client*gophercloud.ServiceClient, idstring, opts UpdateMetadataOpts-Builder)

POST /v2/{project_id}/servers/{server_id}/metadata

Metadatum(client*gophercloud.ServiceClient, id, keystring)

GET /v2/{project_id}/servers/{server_id}/metadata/{key}

DeleteMetadatum(client*gophercloud.ServiceClient, id, keystring)

DELETE /v2/{project_id}/servers/{server_id}/metadata/{key}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 130

Page 136: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

ListInstanceActions(client*gophercloud.ServiceClient, serverIDstring)

GET /v2/{project_id}/servers/{server_id}/os-instance-actions

GetInstanceActions(client*gophercloud.ServiceClient, serverIDstring, RequestID string)

GET /v2/{project_id}/servers/{server_id}/os-instance-actions/{request_id}

GetConsoleLog(client*gophercloud.ServiceClient, idstring, length string)

POST /v2/{project_id}/servers/{server_id}/action

Interface List(client*gophercloud.ServiceClient, serverIDstring)

GET /v2/{project_id}/servers/{server_id}/os-interface

Get(client*gophercloud.ServiceClient,serverID, portID string)

GET /v2/{project_id}/servers/{server_id}/os-interface/{id}

Create(client*gophercloud.ServiceClient, serverIDstring, opts CreateOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/os-interface

Delete(client*gophercloud.ServiceClient,serverID, portID string)

DELETE /v2/{project_id}/servers/{server_id}/os-interface/{id}

Flavors ListDetail(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v2/{project_id}/flavors/detail

Get(client*gophercloud.ServiceClient, idstring)

GET /v2/{project_id}/flavors/{flavor_id}

Images ListDetail(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v2/{project_id}/images/detail

Delete(client*gophercloud.ServiceClient, idstring)

DELETE /v2/{project_id}/images/{image_id}

Get(client*gophercloud.ServiceClient, idstring)

GET /v2/{project_id}/images/{image_id}

Key Pairs Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2/{project_id}/os-keypairs

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 131

Page 137: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Get(client*gophercloud.ServiceClient, namestring)

GET /v2/{project_id}/os-keypairs/{keypair_name}

Delete(client*gophercloud.ServiceClient, namestring)

DELETE /v2/{project_id}/os-keypairs/{keypair_name}

List(client*gophercloud.ServiceClient)

GET /v2/{project_id}/os-keypairs

Quotas GetLimits(client*gophercloud.ServiceClient)

GET /v2/{project_id}/limits

Get(client*gophercloud.ServiceClient,tenantID string)

GET /v2/{project_id}/os-quota-sets/{project_id}

GetDefault(client*gophercloud.ServiceClient,ProjectID string)

GET /v2/{project_id}/os-quota-sets/{project_id}/defaults

Volumeattach

List(client*gophercloud.ServiceClient, serverIDstring)

GET /v2/{project_id}/servers/{server_id}/os-volume_attachments

Create(client*gophercloud.ServiceClient, serverIDstring, opts CreateOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/os-volume_attachments

Get(client*gophercloud.ServiceClient,serverID, attachmentID string)

GET /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

Delete(client*gophercloud.ServiceClient,serverID, attachmentID string)

DELETE /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

DeleteWithFlag(client*gophercloud.ServiceClient,serverID, volumeID string,deleteFlag int)

DELETE /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}?delete_flag={delete_flag}

A.3.2 EVSThe SDK interfaces based on the Cinder v2 API are as follows. For details aboutthe invoking methods, see the sample codes.

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 132

Page 138: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Volumes List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v2/{project_id}/volumes/detail

Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2/{project_id}/volumes

Get(client*gophercloud.ServiceClient, idstring)

GET /v2/{project_id}/volumes/{volume_id}

Delete(client*gophercloud.ServiceClient, idstring)

DELETE /v2/{project_id}/volumes/{volume_id}

Update(client*gophercloud.ServiceClient, idstring, opts UpdateOptsBuilder)

PUT /v2/{project_id}/volumes/{volume_id}

A.3.3 VPCThe SDK interfaces based on the VPC v1 API are as follows. For details about theinvoking methods, see the sample codes.

Interface Method API

Bandwidths Get(client*gophercloud.ServiceClient,bandwidthId string)

GET /v1/{project_id}/bandwidths/{bandwidth_id}

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v1/{project_id}/bandwidths

Update(client*gophercloud.ServiceClient,bandwidthId string, optsUpdateOptsBuilder)

PUT /v1/{project_id}/bandwidths/{bandwidth_id}

Ports Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v1/{project_id}/ports

Delete(client*gophercloud.ServiceClient, portIdstring)

DELETE /v1/{project_id}/ports/{port_id}

Get(client*gophercloud.ServiceClient, portIdstring)

GET /v1/{project_id}/ports/{port_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 133

Page 139: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v1/{project_id}/ports

Update(client*gophercloud.ServiceClient, portIdstring, opts UpdateOptsBuilder)

PUT /v1/{project_id}/ports/{port_id}

PrivateIps Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v1/{project_id}/privateips

Delete(client*gophercloud.ServiceClient,privateipId string)

DELETE /v1/{project_id}/privateips/{privateip_id}

Get(client*gophercloud.ServiceClient,privateipId string)

GET /v1/{project_id}/privateips/{privateip_id}

List(client*gophercloud.ServiceClient,subnetId string, optsListOptsBuilder)

GET /v1/{project_id}/subnets/{subnet_id}/privateips

PublicIps Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v1/{project_id}/publicips

Delete(client*gophercloud.ServiceClient,publicipId string)

DELETE /v1/{project_id}/publicips/{publicip_id}

Get(client*gophercloud.ServiceClient,publicipId string)

GET /v1/{project_id}/publicips/{publicip_id}

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v1/{project_id}/publicips

Update(client*gophercloud.ServiceClient,publicipId string, optsUpdateOptsBuilder)

PUT /v1/{project_id}/publicips/{publicip_id}

Quotas List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v1/{project_id}/quotas

SecurityGroupRules

Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v1/security-group-rules

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 134

Page 140: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Delete(client*gophercloud.ServiceClient,securityGroupsRulesId string)

DELETE /v1/security-group-rules/{security-groups-rules-id}

Get(client*gophercloud.ServiceClient,securityGroupsRulesId string)

GET /v1/security-group-rules/{security-groups-rules-id}

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v1/security-group-rules

SecurityGroups

Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v1/{project_id}/security-groups

Delete(client*gophercloud.ServiceClient,securityGroupId string)

DELETE /v1/{project_id}/security-groups/{security_group_id}

Get(client*gophercloud.ServiceClient,securityGroupId string)

GET /v1/{project_id}/security-groups/{security_group_id}

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v1/{project_id}/security-groups

Subnets Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v1/{project_id}/subnets

Delete(client*gophercloud.ServiceClient, vpcIdstring, subnetId string)

DELETE /v1/{project_id}/vpcs/{vpc_id}/subnets/{subnet_id}

Get(client*gophercloud.ServiceClient,subnetId string)

GET /v1/{project_id}/subnets/{subnet_id}

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v1/{project_id}/subnets

Update(client*gophercloud.ServiceClient, vpcIdstring, subnetId string, optsUpdateOptsBuilder)

PUT /v1/{project_id}/vpcs/{vpc_id}/subnets/{subnet_id}

Vpcs Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v1/{project_id}/vpcs

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 135

Page 141: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Delete(client*gophercloud.ServiceClient, vpcIdstring)

DELETE /v1/{project_id}/vpcs/{vpc_id}

Get(client*gophercloud.ServiceClient, vpcIdstring)

GET /v1/{project_id}/vpcs/{vpc_id}

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v1/{project_id}/vpcs

Update(client*gophercloud.ServiceClient, vpcIdstring, opts UpdateOptsBuilder)

PUT /v1/{project_id}/vpcs/{vpc_id}

The SDK interfaces based on the Neutron v2.0 API are as follows. For details aboutthe invoking methods, see the sample codes.

Interface Method API

Networks Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2.0/networks

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v2.0/networks

Get(client*gophercloud.ServiceClient,networkId string)

GET /v2.0/networks/{network_id}

Update(client*gophercloud.ServiceClient,networkId string, optsUpdateOptsBuilder)

PUT /v2.0/networks/{network_id)

Delete(client*gophercloud.ServiceClient,networkId string)

DELETE /v2.0/networks/{network_id}

Subnets Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2.0/subnets

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v2.0/subnets

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 136

Page 142: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Get(client*gophercloud.ServiceClient,subnetId string)

GET /v2.0/subnets/{subnet_id}

Update(client*gophercloud.ServiceClient,subnetId string, optsUpdateOptsBuilder)

PUT /v2.0/subnets/{subnet_id}

Delete(client*gophercloud.ServiceClient,subnetId string)

DELETE /v2.0/subnets/{subnet_id}

Ports Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2.0/ports

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v2.0/ports

Get(client*gophercloud.ServiceClient, portIdstring)

GET /v2.0/ports/{port_id}

Update(client*gophercloud.ServiceClient, portIdstring, opts UpdateOptsBuilder)

PUT /v2.0/ports/{port_id}

Delete(client*gophercloud.ServiceClient, portIdstring)

DELETE /v2.0/ports/{port_id}

SecurityGroup

Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2.0/security-groups

Update(client*gophercloud.ServiceClient,securityGroupId string, optsUpdateOptsBuilder)

PUT /v2.0/security-groups/{security_group_id}

List(client*gophercloud.ServiceClient, optsListOpts)

GET /v2.0/security-groups

Get(client*gophercloud.ServiceClient,securityGroupId string)

GET /v2.0/security-groups/{security_group_id}

SecurityGroupRules

Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2.0/security-group-rules

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 137

Page 143: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Delete(client*gophercloud.ServiceClient,securityGroupsRulesId string)

DELETE /v2.0/security-group-rules/{security-groups-rules-id}

List(client*gophercloud.ServiceClient, optsListOpts)

GET /v2.0/security-group-rules

Get(client*gophercloud.ServiceClient,securityGroupsRulesId string)

GET /v2.0/security-group-rules/{security-groups-rules-id}

Routers Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2.0/routers

Delete(client*gophercloud.ServiceClient, routerIdstring)

DELETE /v2.0/routers/{router_id}

Update(client*gophercloud.ServiceClient, routerIdstring, opts UpdateOptsBuilder)

PUT /v2.0/routers/{router_id}

List(client*gophercloud.ServiceClient, optsListOpts)

GET /v2.0/routers

Get(client*gophercloud.ServiceClient, routerIdstring)

GET /v2.0/routers/{router_id}

AddInterface(client*gophercloud.ServiceClient, routerIdstring, opts AddInterfaceOptsBuild-er)

PUT /v2.0/routers/{router_id}/add_router_interface

RemoveInterface(client*gophercloud.ServiceClient, routerIdstring, opts RemoveInterfaceOpts-Builder)

PUT /v2.0/routers/{router_id}/remove_router_interface

FloatingIps Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2.0/floatingips

Delete(client*gophercloud.ServiceClient,floatingipId string)

DELETE /v2.0/floatingips/{floatingip_id}

Update(client*gophercloud.ServiceClient,floatingipId string, optsUpdateOptsBuilder)

PUT /v2.0/floatingips/{floatingip_id}

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 138

Page 144: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

List(client*gophercloud.ServiceClient, optsListOpts)

GET /v2.0/floatingips

Get(client*gophercloud.ServiceClient,floatingipId string)

GET /v2.0/floatingips/{floatingip_id}

A.3.4 IAMThe SDK interfaces based on the Keystone v3 API are as follows. For details aboutthe invoking methods, see the sample codes.

Interface Method API

Tokens Create(c*gophercloud.ServiceClient, optsAuthOptionsBuilder)

POST /v3/auth/tokens

Validate(c*gophercloud.ServiceClient, tokenstring)

GET /v3/auth/tokens

Servicecatalog

List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v3/services

Get(client*gophercloud.ServiceClient,serviceID string)

GET /v3/services/{service_id}

Endpoints List(client*gophercloud.ServiceClient, optsListOptsBuilder)

GET /v3/endpoints

A.3.5 IMSThe SDK interfaces based on the Glance v2 API are as follows. For details aboutthe invoking methods, see the sample codes.

Interface Method API

images Create(client*gophercloud.ServiceClient, optsCreateOptsBuilder)

POST /v2/images

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 139

Page 145: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Delete(client*gophercloud.ServiceClient, idstring)

DELETE /v2/images/{image_id}

List(c *gophercloud.ServiceClient,opts ListOptsBuilder)

GET /v2/images

Update(client*gophercloud.ServiceClient, idstring, opts UpdateOptsBuilder)

PATCH /v2/images/{image_id}

Get(client*gophercloud.ServiceClient, idstring)

GET /v2/images/{image_id}

A.3.6 RDSThe SDK interfaces based on the RDS v3 Go SDK are as follows. For details aboutthe invoking methods, see the sample codes.

Interface Method API

Datastores func listURL(sc*gophercloud.ServiceClient,databasename string)

GET /v3/{project_id}/datastores/{database_name}Link

Instances func createURL(sc*gophercloud.ServiceClient)

POST /v3/{project_id}/instancesLink

func resizeURL(sc*gophercloud.ServiceClient,instancesId string)

POST /v3/{project_id}/instances/{instance_id}/actionLink

func enlargeURL(sc*gophercloud.ServiceClient,instancesId string)

POST /v3/{project_id}/instances/{instance_id}/actionLink

func singletohaURL(sc*gophercloud.ServiceClient,instancesId string)

POST /v3/{project_id}/instances/{instance_id}/actionLink

func restartURL(sc*gophercloud.ServiceClient,instancesId string)

POST /v3/{project_id}/instances/{instance_id}/actionLink

func deleteURL(sc*gophercloud.ServiceClient,serverID string)

DELETE /v3/{project_id}/instances/{instance_id}Link

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 140

Page 146: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

func listURL(sc*gophercloud.ServiceClient)

GET /v3/{project_id}/instancesLink

func listerrorlogURL(sc*gophercloud.ServiceClient,instanceID string)

GET /v3/{project_id}/instances/{instance_id}/errorlogLink

func listslowlogURL(sc*gophercloud.ServiceClient,instanceID string)

GET /v3/{project_id}/instances/{instance_id}/slowlogLink

Configurations

func listURL(sc*gophercloud.ServiceClient)

GET /v3/{project_id}/configurationsLink

func createURL(sc*gophercloud.ServiceClient)

POST /v3/{project_id}/configurationsLink

Backups func updatepolicyURL(sc*gophercloud.ServiceClient,instanceId string)

PUT /v3/{project_id}/instances/{instance_id}/backups/policyLink

func getpolicyURL(sc*gophercloud.ServiceClient,instanceID string)

GET /v3/{project_id}/instances/{instance_id}/backups/policyLink

func createURL(sc*gophercloud.ServiceClient)

POST /v3/{project_id}/backupsLink

func listURL(sc*gophercloud.ServiceClient)

GET /v3/{project_id}/backupsLink

func listfilesURL(sc*gophercloud.ServiceClient)

GET /v3/{project_id}/backup-filesLink

func deleteURL(sc*gophercloud.ServiceClient,backupId string)

DELETE /v3/{project_id}/backups/{backup_id}Link

func getrestoretimeURL(sc*gophercloud.ServiceClient,instanceId string)

GET /v3/{project_id}/instances/{instance_id}/restore-timeLink

func restoreURL(sc*gophercloud.ServiceClient)

POST /v3/{project_id}/instancesLink

func recoveryURL(sc*gophercloud.ServiceClient)

GET /v3/{project_id}/instances/recoveryLink

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 141

Page 147: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

Database func createURL(sc*gophercloud.ServiceClient,instanceID string)

POST /v3/{project_id}/instances/{instance_id}/databaseLink

func listURL(sc*gophercloud.ServiceClient,instanceID string)

GET /v3/{project_id}/instances/{instance_id}/database/detailLink

func deleteURL(sc*gophercloud.ServiceClient,instanceID string,dbNamestring)

DELETE/v3/{project_id}/instances/{instance_id}/database/{db_name}Link

func createURL(sc*gophercloud.ServiceClient,instanceID string)

POST /v3/{project_id}/instances/{instance_id}/db_privilegeLink

func deleteURL(sc*gophercloud.ServiceClient,instanceID string)

DELETE /v3/{project_id}/instances/{instance_id}/db_privilegeLink

DbUser func createURL(sc*gophercloud.ServiceClient,instanceID string)

POST /v3/{project_id}/instances/{instance_id}/db_userLink

func listURL(sc*gophercloud.ServiceClient,instanceID string)

GET /v3/{project_id}/instances/{instance_id}/db_user/detailLink

func deleteURL(sc*gophercloud.ServiceClient,instanceID string, dbuserstring)

DELETE v3/{project_id}/instances/{instance_id}/db_user/{user_name}Link

Flavors func listURL(sc*gophercloud.ServiceClient,databasename string)

GET /v3/{project_id}/flavors/{database_name}Link

StorageType func listURL(sc*gophercloud.ServiceClient,databasename string)

GET/v3/{project_id}/storage-type/{database_name}Link

A.3.7 BSSThe SDK interfaces based on the BSS v1.0 API are as follows. For details about theinvoking methods, see the sample codes.

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 142

Page 148: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

NO TE

The following API links are provided for partners and customers. If the link is PartnerOperation Capability, the link is provided for partners. If the link is Customer OperationCapability, the link is provided for customers.

Interface Method API

CustomerManagement

func CheckCustomerRegister-Info(client*gophercloud.ServiceClient,opts CheckCustomerRegister-InfoOptsBuilder)

POST /v1.0/{partner_id}/partner/customer-mgr/check-userLink (Partner OperationCapability)

func CreateCustomer(client*gophercloud.ServiceClient,opts CreateCustomerOpts-Builder)

POST /v1.0/{partner_id}/partner/customer-mgr/customerLink (Partner OperationCapability)

func QueryCustomer(client*gophercloud.ServiceClient,opts QueryCustomerOpts-Builder)

POST /v1.0/{partner_id}/partner/customer-mgr/queryLink (Partner OperationCapability)

func FrozenCustomer(client*gophercloud.ServiceClient,opts FrozenCustomerOpts-Builder)

POST /v1.0/{partner_id}/partner/customer-mgr/frozensLink (Partner OperationCapability)

func UnFrozenCustomer(client*gophercloud.ServiceClient,opts UnFrozenCustomerOpts-Builder)

POST /v1.0/{partner_id}/partner/customer-mgr/unfrozensLink (Partner OperationCapability)

RealnameAuth

func IndividualRealNa-meAuth(client*gophercloud.ServiceClient,opts IndividualRealNameAu-thOptsBuilder)

POST /v1.0/{partner_id}/partner/customer-mgr/realname-auth/individualLink (Partner OperationCapability)

func EnterpriseRealNa-meAuth(client*gophercloud.ServiceClient,opts EnterpriseRealNameAu-thOptsBuilder)

POST /v1.0/{partner_id}/partner/customer-mgr/realname-auth/enterpriseLink (Partner OperationCapability)

func ChangeEnterpriseRealNa-meAuth(client*gophercloud.ServiceClient,opts ChangeEnterpriseRealNa-meAuthOptsBuilder)

PUT /v1.0/{partner_id}/partner/customer-mgr/realname-auth/enterpriseLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 143

Page 149: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

funcQueryRealNameAuth(client*gophercloud.ServiceClient,opts QueryRealNameAu-thOptsBuilder)

GET /v1.0/{partner_id}/partner/customer-mgr/realname-auth/resultLink (Partner OperationCapability)

Enquiry func QueryRating(client*gophercloud.ServiceClient,opts QueryRatingOptsBuilder)

POST /v1.0/{domain_id}/customer/product-mgr/query-ratingLink (Partner OperationCapability)Link (Customer OperationCapability)

PeriodOrder

func QueryOrderList(client*gophercloud.ServiceClient,opts QueryOrderListBuilder)

GET /v1.0/{domain_id}/common/order-mgr/orders/detailLink (Partner OperationCapability)Link (Customer OperationCapability)

func QueryOrderDetail(client*gophercloud.ServiceClient,opts QueryOrderDetailBuilder,orderId string)

GET /v1.0/{domain_id}/common/order-mgr/orders/{order_id}Link (Partner OperationCapability)Link (Customer OperationCapability)

func PayPeriodOrder(client*gophercloud.ServiceClient,opts PayPeriodOrderBuilder)

POST /v1.0/{domain_id}/customer/order-mgr/order/payLink (Partner OperationCapability)

func UnsubscribePeriodOr-der(client*gophercloud.ServiceClient,opts UnsubscribePeriodOrder-Builder, orderId string)

DELETE /v1.0/{domain_id}/customer/order-mgr/orders/{order_id}Link (Partner OperationCapability)

func CancelOrder(client*gophercloud.ServiceClient,opts CancelOrderBuild-er,actionId string)

PUT /v1.0/{domain_id}/customer/order-mgr/orders/actionsLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 144

Page 150: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

func QueryResourceStatus-ByOrderId(client*gophercloud.ServiceClient,opts QueryResourceStatus-ByOrderIdBuilder, orderIdstring)

GET /v1.0/{domain_id}/common/order-mgr/orders/refund-orderLink (Partner OperationCapability)

QueryResourcesRspqueryResources(StringdomainID, String orderId,Map<String, String>filteringParams)

GET /v1.0/{domain_id}/common/order-mgr/orders-resource/{order_id}Link (Partner OperationCapability)

PeriodResource

func QueryCustomerPeriodRe-sourcesList(client*gophercloud.ServiceClient,opts QueryCustomerPeriodRe-sourcesListOptsBuilder)

GET /v1.0/{domain_id}/common/order-mgr/resources/detailLink (Partner OperationCapability)Link (Customer OperationCapability)

func RenewSubscriptionByRe-sourceId(client*gophercloud.ServiceClient,opts RenewSubscriptionByRe-sourceIdOptsBuilder)

POST /v1.0/{domain_id}/common/order-mgr/resources/renewLink (Partner OperationCapability)

func UnsubscribeByResour-ceId(client*gophercloud.ServiceClient,opts UnsubscribeByResourceI-dOptsBuilder)

POST /v1.0/{domain_id}/common/order-mgr/resources/deleteLink (Partner OperationCapability)

func EnableAutoRenew(client*gophercloud.ServiceClient,opts EnableAutoRenewOpts-Builder,resourceId string)

POST /v1.0/{domain_id}/common/order-mgr/resources/{resource_id}/actionsLink (Partner OperationCapability)

func getDisableAutoRene-wURL(client*gophercloud.ServiceClient,domainId string,resourceIdstring,actionId string)

DELETE /v1.0/{domain_id}/common/order-mgr/resources/{resource_id}/actionsLink (Partner OperationCapability)

CustomerCredit

func QueryCredit(client*gophercloud.ServiceClient,opts QueryCreditOptsBuilder)

GET /v1.0/{partner_id}/partner/account-mgr/creditLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 145

Page 151: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

Interface Method API

func SetCredit(client*gophercloud.ServiceClient,opts SetCreditOptsBuilder)

POST /v1.0/{partner_id}/partner/account-mgr/creditLink (Partner OperationCapability)

Pay-Per-UseResource

func QueryCustomerRe-source(client*gophercloud.ServiceClient,opts QueryCustomerResour-ceOptsBuilder)

POST /v1.0/{partner_id}/partner/customer-mgr/customer-resource/query-resourcesLink (Partner OperationCapability)

Bill func QueryPartnerMonthly-Bills(client*gophercloud.ServiceClient,opts QueryPartnerMonthlyBill-sOptsBuilder)

GET /v1.0/{partner_id}/partner/account-mgr/postpaid-bill-summaryLink (Partner OperationCapability)

func QueryMonthlyExpendi-tureSummary(client*gophercloud.ServiceClient,opts QueryMonthlyExpendi-tureSummaryOptsBuilder)

GET /v1.0/{domain_id}/customer/account-mgr/bill/monthly-sumLink (Customer OperationCapability)

func QueryResourceUsageDe-tails(client*gophercloud.ServiceClient,opts QueryResourceUsageDe-tailsOptsBuilder)

GET /v1.0/{domain_id}/customer/account-mgr/bill/res-recordsLink (Customer OperationCapability)

func QueryResourceUsageRe-cord(client*gophercloud.ServiceClient,opts QueryResourceUsageRe-cordOptsBuilder)

GET /v1.0/{domain_id}/customer/account-mgr/bill/res-fee-recordsLink (Customer OperationCapability)

Utilities func SendVerification-Code(client*gophercloud.ServiceClient,opts SendVerificationCo-deOptsBuilder)

POST /v1.0/{partner_id}/partner/common-mgr/verificationcodeLink (Partner OperationCapability)

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 146

Page 152: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

A.3.8 CESInterface Method API

MetricService

List(client*gophercloud.ServiceClient,opts ListOptsBuilder)pagination.Pager

GET /V1.0/{project_id}/metricsLink

AlarmService List(client*gophercloud.ServiceClient,opts ListOpts)pagination.Pager

GET /V1.0/{project_id}/alarmsLink

Get(client*gophercloud.ServiceClient,alarmId string) (r GetResult)

GET /V1.0/{project_id}/alarms/{alarm_id}Link

Update(client*gophercloud.ServiceClient,alarmId string, optsUpdateOptsBuilder)

PUT /V1.0/{project_id}/alarms/{alarm_id}/actionLink

Update(client*gophercloud.ServiceClient,alarmId string, optsUpdateOptsBuilder)

PUT /V1.0/{project_id}/alarms/{alarm_id}/actionLink

Delete(client*gophercloud.ServiceClient,alarmId string) (rDeleteResult)

DELETE /V1.0/{project_id}/alarms/{alarm_id}Link

MetricDataService

Get(client*gophercloud.ServiceClient,opts GetOpts)

GET /V1.0/{project_id}/metric-dataLink

AddMetricData(client*gophercloud.ServiceClient,opts AddMetricDataOpts-Builder)

POST /V1.0/{project_id}/metric-dataLink

QuotaService

Get(client*gophercloud.ServiceClient)(r GetResult)

GET /V1.0/{project_id}/quotasLink

SDKDeveloper Guide A Mappings Between APIs and SDKs

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 147

Page 153: Developer Guide - HUAWEI CLOUD · SDK Acquisition and Installation Add the following Maven dependency to the pom.xml file to install the Java SDK:  com.huawei

B Change History

ReleasedOn

Description

2020-05-18 This issue is the fifth official release, which incorporates thefollowing change:● Added the RDS Java SDK.● Added CDN Java and Python SDKs.

2020-04-21 This issue is the fourth official release, which incorporates thefollowing changes:● Updated IAM Python SDK.● Updated the links of TMS and EPS APIs.

2019-11-25 This issue is the third official release, which incorporates thefollowing change:Added SDK of Python language for RDS v3.

2019-06-17 This issue is the second official release, which incorporates thefollowing change:● Modified short descriptions in Getting Started with Java SDK,

Getting Started with Python SDK, and Getting Started withGo SDK. Added supported cloud services.

● Updated examples of IAM Java SDK, IAM Python SDK, and ASPython SDK, and modified the display mode.

2019-04-04 This issue is the first official release.

SDKDeveloper Guide B Change History

Issue 05 (2020-05-18) Copyright © Huawei Technologies Co., Ltd. 148