API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add...

200
Auto Scaling API Reference Issue 08 Date 2018-08-30 HUAWEI TECHNOLOGIES CO., LTD.

Transcript of API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add...

Page 1: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Auto Scaling

API Reference

Issue 08

Date 2018-08-30

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Copyright © Huawei Technologies Co., Ltd. 2018. All rights reserved.No part of this document may be reproduced or transmitted in any form or by any means without prior writtenconsent 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 and thecustomer. All or part of the products, services and features described in this document may not be within thepurchase 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, guarantees orrepresentations 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.

Huawei Technologies Co., Ltd.Address: Huawei Industrial Base

Bantian, LonggangShenzhen 518129People's Republic of China

Website: http://www.huawei.com

Email: [email protected]

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. i

Page 3: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Contents

1 API Calling..................................................................................................................................... 11.1 Service Usage................................................................................................................................................................. 11.2 Request Methods............................................................................................................................................................ 11.3 Request Authentication Methods....................................................................................................................................21.4 Token Authentication......................................................................................................................................................21.5 AK/SK Authentication................................................................................................................................................... 31.5.1 AK and SK Generation................................................................................................................................................31.5.2 Request Signing Procedure..........................................................................................................................................41.5.3 Sample Code................................................................................................................................................................41.6 Obtaining the Project ID or Tenant ID......................................................................................................................... 12

2 Common Message Headers....................................................................................................... 132.1 Common Request Headers........................................................................................................................................... 132.2 Common Response Headers.........................................................................................................................................15

3 AS Groups.....................................................................................................................................163.1 Creating an AS Group.................................................................................................................................................. 163.2 Querying AS Groups.................................................................................................................................................... 223.3 Querying AS Group Details......................................................................................................................................... 263.4 Modifying an AS Group............................................................................................................................................... 303.5 Deleting an AS Group.................................................................................................................................................. 373.6 Enabling or Disabling an AS Group.............................................................................................................................39

4 AS Configurations.......................................................................................................................414.1 Creating an AS Configuration...................................................................................................................................... 414.2 Querying AS Configurations........................................................................................................................................ 494.3 Querying AS Configuration Details............................................................................................................................. 544.4 Deleting an AS Configuration...................................................................................................................................... 594.5 Batch Deleting AS Configurations............................................................................................................................... 60

5 Instances in an AS Group.......................................................................................................... 635.1 Querying Instances in an AS Group............................................................................................................................. 635.2 Removing Instances from an AS Group.......................................................................................................................675.3 Performing Operations on Instances in Batches...........................................................................................................68

6 AS Policies.................................................................................................................................... 72

Auto ScalingAPI Reference Contents

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. ii

Page 4: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

6.1 Creating an AS Policy.................................................................................................................................................. 726.2 Creating an AS Policy (V2)..........................................................................................................................................786.3 Modifying an AS Policy............................................................................................................................................... 856.4 Modifying an AS Policy (V2)...................................................................................................................................... 916.5 Querying AS Policies................................................................................................................................................... 976.6 Querying AS Policies (V2).........................................................................................................................................1026.7 Querying AS Policy Details....................................................................................................................................... 1086.8 Querying Details of an AS Policy (V2)...................................................................................................................... 1126.9 Executing, Enabling, or Disabling an AS Policy........................................................................................................1176.10 Deleting an AS Policy...............................................................................................................................................1196.11 Performing Operations on AS Policies in Batches................................................................................................... 121

7 AS Policy Execution Logs.........................................................................................................1237.1 Querying AS Policy Execution Logs..........................................................................................................................123

8 Scaling Action Logs...................................................................................................................1298.1 Querying Scaling Action Logs................................................................................................................................... 129

9 Quotas.......................................................................................................................................... 1339.1 Querying AS Quotas...................................................................................................................................................1339.2 Querying Quotas for AS Policies and AS Instances...................................................................................................136

10 Notifications............................................................................................................................. 13910.1 Enabling Notification for an AS Group....................................................................................................................13910.2 Querying an AS Group Notification List................................................................................................................. 14210.3 Deleting a Notification for an AS Group..................................................................................................................144

11 Lifecycle Hook......................................................................................................................... 14711.1 Creating a Lifecycle Hook........................................................................................................................................14711.2 Querying Lifecycle Hooks........................................................................................................................................15111.3 Querying Lifecycle Hook Details............................................................................................................................. 15411.4 Modifying a Lifecycle Hook.....................................................................................................................................15611.5 Calling Back an Instance Lifecycle Hook................................................................................................................ 16011.6 Querying Instance Suspension..................................................................................................................................16211.7 Deleting a Lifecycle Hook........................................................................................................................................165

A Appendix....................................................................................................................................167A.1 Error Codes................................................................................................................................................................167A.2 AS Metrics................................................................................................................................................................. 193

B Change History..........................................................................................................................195

Auto ScalingAPI Reference Contents

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. iii

Page 5: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

1 API Calling

API requests sent by third-party applications to the public cloud service must be authenticatedusing signatures.

This chapter describes the overall method of using signatures and provides sample codes todetail how to use the default signer to sign requests and how to use an HTTP client to sendrequests.

1.1 Service UsagePublic cloud services provide RESTful APIs.

Representational State Transfer (REST) allocates Uniform Resource Identifiers (URIs) todispersed resources so that resources can be located. Applications on clients use UniformResource Locators (URLs) to obtain resources.

The URL is in the following format: https://Endpoint/uri

Table 1-1 describes the parameters in a URL.

Table 1-1 Parameter description

Parameter Description

Endpoint Specifies the URL that is the entry point for a web service. Obtainthe value from Regions and Endpoints.

URI Specifies the API access path for performing a specified operation.Obtain the value from the URI of the API, for example, v3/auth/tokens.

1.2 Request MethodsThe HTTP protocol defines request methods, such as GET, PUT, POST, DELETE, andPATCH, to indicate the desired action to be performed on the identified resource. Thefollowing table describes the HTTP methods supported by the RESTful APIs.

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 1

Page 6: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Table 1-2 HTTPS methods

Method Description

GET The GET method requests a representation of the specified resource.

PUT The PUT method requests that the enclosed entity be stored under thesupplied URI.

POST The POST method requests that the server accept the entity enclosed in therequest as a new subordinate of the web resource identified by the URI.

DELETE The DELETE method deletes the specified resource, for example, anobject.

PATCH The PATCH method applies partial modifications to a resource.If the resource does not exist, the PATCH method creates a resource.

1.3 Request Authentication MethodsYou can use either of the following two authentication methods to call APIs:

l Token authentication: Requests are authenticated using Tokens.l AK/SK authentication: Requests are encrypted using the access key (AK) and secret key

(SK) to provide higher security.

1.4 Token Authentication

ScenariosIf you use a token for authentication, you must obtain the token and add X-Auth-Token to therequest header of the IMS API when making an API call.

This section describes how to make an API call for token authentication.

Make an API Call1. Send POST https://Endpoint of IAM/v3/auth/tokens to obtain the endpoint of IAM and

the region name in the message body.See Regions and Endpoints.An example request message is as follows:

NOTE

Replace the items in italic in the following example with actual ones. For details, see the Identityand Access Management API Reference.

{ "auth": { "identity": { "methods": [ "password" ], "password": { "user": {

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 2

Page 7: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"name": "username", "password": "password", "domain": { "name": "domainname" } } } }, "scope": { "project": { "id": "0215ef11e49d4743be23dd97a1561e91" //This ID is used as an example. } } }}

2. Obtain the token. For details, see section "Obtaining the User Token" in the Identity andAccess Management API Reference.

3. Make a call to a service API, add X-Auth-Token to the request header, and set the valueof X-Auth-Token to the token obtained in 2.

1.5 AK/SK AuthenticationWhen you use API Gateway to send requests to underlying services, the requests are signedusing the AK and SK.

NOTE

AK: indicates the ID of the access key. AK is used together with SK to obtain an encrypted signature fora request.

SK: indicates the secret access key together used with the access key ID to sign requests. AK and SKcan be used together to identify a request sender to prevent the request from being modified.

1.5.1 AK and SK Generation1. Log in to the management console.2. Hover the mouse over the username and select Basic Information from the drop-down

list.3. On the Account Info page, click Manage after Security Credentials.4. On the My Credential page, click Access Keys.5. Click Add Access Key.6. Enter the current login password.7. Enter the authentication code received in the email or mobile phone.

NOTE

For users created in Identity and Access Management (IAM), if no email address or mobile phoneis filled during user creation, you only need to authenticate the login password.

8. Click OK to download the access key.

NOTE

To prevent the access key from being leaked, keep it secure.

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 3

Page 8: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

1.5.2 Request Signing Procedure

Preparations1. Download the API Gateway signature tool from the following link:

http://esdk.huawei.com/ilink/esdk/download/HW_4567062. Extract the package.3. Create a Java project, and reference the extracted JAR to the dependency path.

Sign a Request1. Create a request com.cloud.sdk.DefaultRequest (JAVA) used for signing.2. Set the target API URL, HTTPS method, and content of request

com.cloud.sdk.DefaultRequest (JAVA).3. Sign request com.cloud.sdk.DefaultRequest (JAVA).

a. Call SignerFactory.getSigner(String serviceName, String regionName) to obtaina signing tool.

b. Call Signer.sign(Request<?> request, Credentials credentials) to sign the requestcreated in step 1.The following code shows the details://Select an algorithm for request signing.Signer signer = SignerFactory.getSigner(serviceName, region);//Sign the request. The request will change after the signing.signer.sign(request, new BasicCredentials(this.ak, this.sk));

4. Convert the request signed in the previous step to a new request that can be used to makean API call and copy the header of the signed request to the new request.For example, if Apache HttpClient is used, convert DefaultRequest to HttpRequestBaseand copy the header of the signed DefaultRequest to HttpRequestBase.For details, see descriptions of AccessServiceImpl.java in section 1.5.3 Sample Code.

1.5.3 Sample CodeThe following three types of code show how to sign a request and use an HTTP client to sendan HTTPS request:

AccessService: indicates the abstract class that converts the GET, POST, PUT, and DELETEmethods in to the access method.

Demo: indicates the execution entry used to simulate GET, POST, PUT, and DELETE requestsending.

AccessServiceImpl: indicates the implementation of the access method. Code required forAPI gateway communication is in the access method.

For details about region and serviceName in the following code, see Regions andEndpoints.

AccessService.java:

package com.cloud.apigateway.sdk.demo;

import java.io.InputStream;import java.net.URL;

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 4

Page 9: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

import java.util.Map;

import org.apache.http.HttpResponse;

import com.cloud.sdk.http.HttpMethodName;

public abstract class AccessService { protected String serviceName = null; protected String region = null; protected String ak = null; protected String sk = null; public AccessService(String serviceName, String region, String ak, String sk) { this.region = region; this.serviceName = serviceName; this.ak = ak; this.sk = sk; } public abstract HttpResponse access(URL url, Map<String, String> header, InputStream content, Long contentLength, HttpMethodName httpMethod) throws Exception; public HttpResponse access(URL url, Map<String, String> header, HttpMethodName httpMethod) throws Exception { return this.access(url, header, null, 0l, httpMethod); } public HttpResponse access(URL url, InputStream content, Long contentLength, HttpMethodName httpMethod) throws Exception { return this.access(url, null, content, contentLength, httpMethod); } public HttpResponse access(URL url, HttpMethodName httpMethod) throws Exception { return this.access(url, null, null, 0l, httpMethod); } public abstract void close(); public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public String getRegion() { return region; } public void setRegion(String region) { this.region = region; } public String getAk() { return ak; } public void setAk(String ak) { this.ak = ak; }

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 5

Page 10: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

public String getSk() { return sk; } public void setSk(String sk) { this.sk = sk; } }

AccessServiceImpl.java:

package com.cloud.apigateway.sdk.demo;

import java.io.IOException;import java.io.InputStream;import java.net.URISyntaxException;import java.net.URL;import java.util.HashMap;import java.util.Map;

import javax.net.ssl.SSLContext;

import org.apache.http.Header;import org.apache.http.HttpHeaders;import org.apache.http.HttpResponse;import org.apache.http.client.methods.HttpDelete;import org.apache.http.client.methods.HttpGet;import org.apache.http.client.methods.HttpHead;import org.apache.http.client.methods.HttpPatch;import org.apache.http.client.methods.HttpPost;import org.apache.http.client.methods.HttpPut;import org.apache.http.client.methods.HttpRequestBase;import org.apache.http.conn.ssl.AllowAllHostnameVerifier;import org.apache.http.conn.ssl.SSLConnectionSocketFactory;import org.apache.http.conn.ssl.SSLContexts;import org.apache.http.conn.ssl.TrustSelfSignedStrategy;import org.apache.http.entity.InputStreamEntity;import org.apache.http.impl.client.CloseableHttpClient;import org.apache.http.impl.client.HttpClients;

import com.cloud.sdk.DefaultRequest;import com.cloud.sdk.Request;import com.cloud.sdk.auth.credentials.BasicCredentials;import com.cloud.sdk.auth.signer.Signer;import com.cloud.sdk.auth.signer.SignerFactory;import com.cloud.sdk.http.HttpMethodName;

public class AccessServiceImpl extends AccessService {

private CloseableHttpClient client = null;

public AccessServiceImpl(String serviceName, String region, String ak, String sk) { super(serviceName, region, ak, sk); }

/** {@inheritDoc} */

public HttpResponse access(URL url, Map<String, String> headers, InputStream content, Long contentLength, HttpMethodName httpMethod) throws Exception {

// Make a request for signing. Request request = new DefaultRequest(this.serviceName); try { // Set the request address. request.setEndpoint(url.toURI());

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 6

Page 11: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

String urlString = url.toString();

String parameters = null;

if (urlString.contains("?")) { parameters = urlString.substring(urlString.indexOf("?") + 1); Map parametersmap = new HashMap<String, String>(); if (null != parameters && !"".equals(parameters)) { String[] parameterarray = parameters.split("&"); for (String p : parameterarray) { String key = p.split("=")[0]; String value = p.split("=")[1]; parametersmap.put(key, value); } request.setParameters(parametersmap); } }

} catch (URISyntaxException e) { // It is recommended to add logs in this place. e.printStackTrace(); } // Set the request method. request.setHttpMethod(httpMethod); if (headers != null) { // Add request header information if required. request.setHeaders(headers); } // Configure the request content. request.setContent(content);

// Select an algorithm for request signing. Signer signer = SignerFactory.getSigner(serviceName, region); // Sign the request, and the request will change after the signing. signer.sign(request, new BasicCredentials(this.ak, this.sk));

// Make a request that can be sent by the HTTP client. HttpRequestBase httpRequestBase = createRequest(url, null, request.getContent(), contentLength, httpMethod); Map<String, String> requestHeaders = request.getHeaders(); // Put the header of the signed request to the new request. for (String key : requestHeaders.keySet()) { if (key.equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH.toString())) { continue; } httpRequestBase.addHeader(key, requestHeaders.get(key)); }

HttpResponse response = null; SSLContext sslContext = SSLContexts.custom() .loadTrustMaterial(null, new TrustSelfSignedStrategy()) .useTLS().build(); SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory( sslContext, new AllowAllHostnameVerifier());

client = HttpClients.custom().setSSLSocketFactory(sslSocketFactory) .build(); // Send the request, and a response will be returned. response = client.execute(httpRequestBase); return response; }

/** * Make a request that can be sent by the HTTP client. * * @param url

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 7

Page 12: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

* specifies the API access path. * @param header * specifies the header information to be added. * @param content * specifies the body content to be sent in the API call. * @param contentLength * specifies the length of the content. This parameter is optional. * @param httpMethod * specifies the HTTP method to be used. * @return specifies the request that can be sent by an HTTP client. */ private static HttpRequestBase createRequest(URL url, Header header, InputStream content, Long contentLength, HttpMethodName httpMethod) {

HttpRequestBase httpRequest; if (httpMethod == HttpMethodName.POST) { HttpPost postMethod = new HttpPost(url.toString());

if (content != null) { InputStreamEntity entity = new InputStreamEntity(content, contentLength); postMethod.setEntity(entity); } httpRequest = postMethod; } else if (httpMethod == HttpMethodName.PUT) { HttpPut putMethod = new HttpPut(url.toString()); httpRequest = putMethod;

if (content != null) { InputStreamEntity entity = new InputStreamEntity(content, contentLength); putMethod.setEntity(entity); } } else if (httpMethod == HttpMethodName.PATCH) { HttpPatch patchMethod = new HttpPatch(url.toString()); httpRequest = patchMethod;

if (content != null) { InputStreamEntity entity = new InputStreamEntity(content, contentLength); patchMethod.setEntity(entity); } } else if (httpMethod == HttpMethodName.GET) { httpRequest = new HttpGet(url.toString()); } else if (httpMethod == HttpMethodName.DELETE) { httpRequest = new HttpDelete(url.toString()); } else if (httpMethod == HttpMethodName.HEAD) { httpRequest = new HttpHead(url.toString()); } else { throw new RuntimeException("Unknown HTTP method name: " + httpMethod); }

httpRequest.addHeader(header); return httpRequest; }

@Override public void close() { try { if (client != null) { client.close(); } } catch (IOException e) { // It is recommended to add logs in this place. e.printStackTrace(); } }

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 8

Page 13: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

}

Demo.java:

package com.cloud.apigateway.sdk.demo;

import java.io.BufferedReader;import java.io.ByteArrayInputStream;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.net.MalformedURLException;import java.net.URL;

import org.apache.http.HttpResponse;

import com.cloud.sdk.http.HttpMethodName;

public class Demo {

//replace real region private static final String region = "regionName";

//replace real service name private static final String serviceName = "serviceName";

public static void main(String[] args) {

//replace real AK String ak = "akString"; //replace real SK String sk = "skString";

// get method //replace real url String url = "urlString"; get(ak, sk, url);

// post method //replace real url String postUrl = "urlString"; //replace real body String postbody = "bodyString"; post(ak, sk, postUrl, postbody);

// put method //replace real body String putbody = "bodyString"; //replace real url String putUrl = "urlString"; put(ak, sk, putUrl, putbody);

// delete method //replace real url String deleteUrl = "urlString"; delete(ak, sk, deleteUrl); }

public static void put(String ak, String sk, String requestUrl, String putBody) {

AccessService accessService = null; try { accessService = new AccessServiceImpl(serviceName, region, ak, sk); URL url = new URL(requestUrl); HttpMethodName httpMethod = HttpMethodName.PUT;

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 9

Page 14: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

InputStream content = new ByteArrayInputStream(putBody.getBytes()); HttpResponse response = accessService.access(url, content, (long) putBody.getBytes().length, httpMethod); System.out.println(response.getStatusLine().getStatusCode()); } catch (Exception e) { e.printStackTrace(); } finally { accessService.close(); }

} public static void patch(String ak, String sk, String requestUrl, String putBody) {

AccessService accessService = null; try { accessService = new AccessServiceImpl(serviceName, region, ak, sk); URL url = new URL(requestUrl); HttpMethodName httpMethod = HttpMethodName.PATCH; InputStream content = new ByteArrayInputStream(putBody.getBytes()); HttpResponse response = accessService.access(url, content, (long) putBody.getBytes().length, httpMethod); System.out.println(convertStreamToString(response.getEntity() .getContent())); } catch (Exception e) { e.printStackTrace(); } finally { accessService.close(); }

}

public static void delete(String ak, String sk, String requestUrl) {

AccessService accessService = null;

try { accessService = new AccessServiceImpl(serviceName, region, ak, sk); URL url = new URL(requestUrl); HttpMethodName httpMethod = HttpMethodName.DELETE;

HttpResponse response = accessService.access(url, httpMethod); System.out.println(convertStreamToString(response.getEntity() .getContent())); } catch (Exception e) { e.printStackTrace(); } finally { accessService.close(); }

}

public static void get(String ak, String sk, String requestUrl) {

AccessService accessService = null;

try { accessService = new AccessServiceImpl(serviceName, region, ak, sk); URL url = new URL(requestUrl); HttpMethodName httpMethod = HttpMethodName.GET; HttpResponse response; response = accessService.access(url, httpMethod); System.out.println(convertStreamToString(response.getEntity() .getContent()));

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 10

Page 15: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

} catch (Exception e) { e.printStackTrace(); } finally { accessService.close(); }

}

public static void post(String ak, String sk, String requestUrl, String postbody) {

AccessService accessService = new AccessServiceImpl(serviceName, region, ak, sk); URL url = null; try { url = new URL(requestUrl); } catch (MalformedURLException e) { e.printStackTrace(); } InputStream content = new ByteArrayInputStream(postbody.getBytes()); HttpMethodName httpMethod = HttpMethodName.POST; HttpResponse response;

try { response = accessService.access(url, content, (long) postbody.getBytes().length, httpMethod); System.out.println(convertStreamToString(response.getEntity() .getContent())); } catch (Exception e) { e.printStackTrace(); } finally { accessService.close(); } }

private static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder();

String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } }

return sb.toString(); }

}

NOTE

1. Parameters URI, AK, SK, and HTTP METHOD are mandatory.

2. You can use the request.addHeader() method to add header information.

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 11

Page 16: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

1.6 Obtaining the Project ID or Tenant IDA project ID is required for some URLs when an API is called. It can be project_id ortenant_id because project_id has the same meaning as tenant_id in this document. Beforecalling an API, you need to obtain a project ID on the console. The steps are as follows:

1. Log in to the management console.2. Hover the mouse over the username and select Basic Information from the drop-down

list.3. On the Account Info page, click Manage after Security Credentials.

On the My Credential page, view the project ID in the project list.

Figure 1-1 Viewing the project ID

Auto ScalingAPI Reference 1 API Calling

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 12

Page 17: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

2 Common Message Headers

This chapter describes common request and response REST message headers.

2.1 Common Request Headers

Table 2-1 Common request headers

Parameter Description Mandatory Example Value

x-sdk-date Specifies the time when therequest is sent. The time is inYYYYMMDD'T'HHMMSS'Z' format.The value is the currentGMT time of the system.

NoThis field ismandatory forAK/SKauthentication.

20150907T101459Z

Authorization Specifies the authenticationinformation.The value can be obtainedfrom the request signingresult.For details, see section 1.5.2Request SigningProcedure.

NoThis field ismandatory forAK/SKauthentication.

SDK-HMAC-SHA256Credential=ZIRRKMTWPTQFQI1WKNKB/20150907//ec2/sdk_request,SignedHeaders=content-type;host;x-sdk-date,Signature=55741b610f3c9fa3ae40b5a8021ebf7ebc2a28a603fc62d25cb3bfe6608e1994

Auto ScalingAPI Reference 2 Common Message Headers

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 13

Page 18: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Description Mandatory Example Value

Host Specifies the server domainname and port number of theresources being requested.The value can be obtainedfrom the URL of the serviceAPI. The value ishostname[:port]. If the portnumber is not specified, thedefault port is used. Thedefault port number forhttps is 443.

NoThis field ismandatory forAK/SKauthentication.

code.test.comorcode.test.com:443

Content-Type Specifies the request bodyMIME type. You are advisedto use the default valueapplication/json. Forinterfaces used to uploadobjects or images, the valuecan vary depending on theflow type.

Yes application/json

Content-Length

Specifies the length of therequest body. The unit isbyte.

No 3495

X-Project-Id Specifies the project ID.Obtain the project ID byfollowing the instructions insection 1.6 Obtaining theProject ID or Tenant ID.This parameter is mandatoryfor a request from a DeC ormulti-project user.

NoThis field ismandatory forrequests that useAK/SKauthentication inthe DedicatedCloud (DeC)scenario or multi-project scenario.

e9993fc787d94b6c886cbaa340f9c0f4

X-Auth-Token Specifies the user token.For details about how toobtain the token, see section"Obtaining the User Token"in the Identity and AccessManagement API Reference.After the request isprocessed, the value of X-Subject-Token in the headeris the token value.

NoThis field ismandatory fortokenauthentication.

The following is partof an example token:MIIPAgYJKoZIhvc-NAQcCoIIO8zCCDu8CAQExDTALBglghkgBZQMEAgEwgg1QBgkqhkiG9w0BBwGggg1BBIINPXsidG9rZ.

NOTE

For details about other parameters in the header, see the HTTP protocol documentation.

Auto ScalingAPI Reference 2 Common Message Headers

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 14

Page 19: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

2.2 Common Response Headers

Table 2-2 Common response headers

Name Description Example Value

Content-Length Specifies the length of the response body.The unit is byte.

-

Date Specifies the GMT time when a requestresponse is returned.

Wed, 27 Dec 201606:49:46 GMT

Content-Type Specifies the response body MIME type. application/json

Auto ScalingAPI Reference 2 Common Message Headers

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 15

Page 20: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

3 AS Groups

3.1 Creating an AS Group

Function

This interface is used to create an AS group. An AS group is a set of ECS instances with thesame application scenario configurations. An AS group defines the minimum and maximumnumbers of ECS instances.

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_groupl Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

Requestl Parameter description

Parameter Mandatory Type Description

scaling_group_name

Yes String Specifies the AS group name. Thename can contain letters, digits,underscores (_), and hyphens (-), andcannot exceed 64 characters.

scaling_configuration_id

No String Specifies the AS configuration ID.You can obtain its value from the APIused to query AS configurations. Fordetails, see section 4.2 Querying ASConfigurations.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 16

Page 21: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

desire_instance_number

No Integer Specifies the expected number ofinstances. The default value is theminimum number of instances.The value ranges from the minimumnumber of instances to the maximumnumber of instances.

min_instance_number

No Integer Specifies the minimum number ofinstances. The default value is 0.

max_instance_number

No Integer Specifies the maximum number ofinstances. The default value is 0.

cool_down_time

No Integer Specifies the cooldown period (inseconds). The value ranges from 0 to86400 and is 300 by default.The cooldown period takes effect onlyfor scaling actions triggered byalarms. Scaling actions executedmanually as well as those triggeredperiodically or at a particular time willnot be affected.

lb_listener_id No String Specifies the ID of a typical ELBlistener. The system supports thebinding of up to three ELB listeners,the IDs of which are separated using acomma (,). You can use vpc_id toobtain a load balancer ID from theAPI used to query an ELB list. Fordetails, see section "Querying LoadBalancers" in Elastic Load BalanceAPI Reference. Then, use the loadbalancer ID to query the ELB listenerlist to obtain the ELB listener ID. Fordetails, see section "QueryingListeners" in Elastic Load BalanceAPI Reference.

available_zones No List<String>

Specifies the AZ information. TheECS associated with the scalingaction will be created in the specifiedAZ. If you do not specify an AZ, thesystem automatically specifies one.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 17

Page 22: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

networks Yes List datastructure

Specifies network information. Thesystem supports up to five subnets.The first subnet transferred serves asthe primary NIC of the ECS bydefault. You can use vpc_id to obtainthe parameter value from the APIused to query VPC subnets. Fordetails, see section Subnet >Querying Subnets in the VirtualPrivate Cloud API Reference.

security_groups No List datastructure

Specifies the security group. Amaximum of one security group canbe selected. You can use vpc_id toobtain the parameter value from theAPI used to query VPC securitygroups. For details, see section"Querying Security Groups" in theVirtual Private Cloud API Reference.If the security group is specified bothin the AS configuration and ASgroup, the security group specified inthe AS configuration prevails. If thesecurity group is not specified ineither of them, the default securitygroup is used. For your convenience,you are advised to specify the securitygroup in the AS configuration.

vpc_id Yes String Specifies the VPC information. Youcan obtain its value from the API usedto query VPCs. For details, seesection "Querying VPCs" in theVirtual Private Cloud API Reference.

health_periodic_audit_method

No String Specifies the health check method forinstances in the AS group. The healthcheck methods include ELB_AUDITand NOVA_AUDIT. If loadbalancing is configured, the defaultvalue of this parameter isELB_AUDIT. Otherwise, the defaultvalue is NOVA_AUDIT.l ELB_AUDIT refers to the ELB

health check, which takes effect inan AS group that has a listener.

l NOVA_AUDIT refers to thehealth check delivered with AS.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 18

Page 23: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

health_periodic_audit_time

No Integer Specifies the instance health checkperiod. The value can be 1, 5, 15, 60,or 180 min. If this parameter is notspecified, the default value is 5.If the value is set to 0, health check isperformed every 10 seconds.

health_periodic_audit_grace_period

No Integer Specifies the grace period for instancehealth check. The unit is second andvalue range is 0-86400.The health check grace period startsafter an instance is added to an ASgroup and is enabled. The AS groupwill start checking status of theinstance only after the grace periodends.This parameter is valid when thehealth check method is ELB_AUDIT.If this parameter is not specified, thedefault value is 600.

instance_terminate_policy

No String Specifies the instance removal policy.l (Default)

OLD_CONFIG_OLD_INSTANCE: The earlier-created instancesthat were selected from theinstances created based on earlier-created configurations areremoved first.

l OLD_CONFIG_NEW_INSTANCE: The later-created instancesthat were selected from theinstances created based on earlier-created configurations areremoved first.

l OLD_INSTANCE: The earlier-created instances are removedfirst.

l NEW_INSTANCE: The later-created instances are removedfirst.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 19

Page 24: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

notifications No List<String>

Specifies the notification mode.EMAIL refers to notification byemail.This notification mode is going to becanceled. You are advised toconfigure the notification function forthe AS group. For details, see section10 Notifications.

delete_publicip No Boolean Specifies whether to delete the EIPbound to the ECS when deleting theECS. The value can be true or false.The default value is false.l true: deletes the EIP bound to the

ECS when deleting the ECS.When the ECS is charged inYearly/Monthly mode, the EIPbound to the ECS will not bedeleted when the ECS is deleted.

l false: only unbinds the EIP boundto the ECS when deleting the ECS.

l networks field data structure description

Parameter Mandatory Type Description

id Yes String Specifies the network ID.

l security_groups field data structure description

Parameter Mandatory Type Description

id Yes String Specifies the ID of the security group.

l Example request{ "scaling_group_name": "GroupNameTest", "scaling_configuration_id": "47683a91-93ee-462a-a7d7-484c006f4440", "desire_instance_number": 0, "min_instance_number": 0, "max_instance_number": 0, "cool_down_time": 200, "health_periodic_audit_method": "NOVA_AUDIT", "health_periodic_audit_time": 5, "instance_terminate_policy": "OLD_CONFIG_OLD_INSTANCE", "vpc_id": "a8327883-6b07-4497-9c61-68d03ee193a", "networks": [ { "id": "3cd35bca-5a10-416f-8994-f79169559870" } ], "notifications": [

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 20

Page 25: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"EMAIL" ], "security_groups": [ { "id": "23b7b999-0a30-4b48-ae8f-ee201a88a6ab" } ]}

Responsel Parameter description

Parameter Type Description

scaling_group_id String Specifies the AS group ID.

l Example response{ "scaling_group_id": "a8327883-6b07-4497-9c61-68d03ee193a1"}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password to accessthe requested page.

403 Forbidden You are forbidden to access the requested page.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the method specified in therequest.

406 Not Acceptable The response generated by the server could not beaccepted by the client.

407 Proxy AuthenticationRequired

You must use the proxy server for authentication so thatthe request can be processed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to a conflict.

500 Internal Server Error Failed to complete the request because of an internalservice error.

501 Not Implemented Failed to complete the request because the server doesnot support the requested function.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 21

Page 26: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

502 Bad Gateway Failed to complete the request because the request isinvalid.

503 Service Unavailable Failed to complete the request because the system isunavailable.

504 Gateway Timeout A gateway timeout error occurred.

3.2 Querying AS Groups

Function

This interface is used to query AS groups based on conditions you input. The results aredisplayed by page.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_group{?scaling_group_name,scaling_configuration_id,scaling_group_status,start_number,limit}

NOTE

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiple searchcriteria. You can filter all non-mandatory parameters in the parameter description.

l Parameter description

Parameter Mandatory

Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_name No String Specifies the name of the ASgroup.

scaling_configuration_id No String Specifies the AS configurationID. You can obtain its valuefrom the API used to query ASconfigurations. For details, see4.2 Querying ASConfigurations.

scaling_group_status No String Specifies the AS group status.The value can be INSERVICE,PAUSED, ERROR, orDELETING.

start_number No Integer Specifies the start line number.The default value is 0.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 22

Page 27: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

limit No Integer Specifies the number of queryrecords. The default value is 20.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

total_number Integer Specifies the total number ofquery records.

start_number Integer Specifies the start number ofquery records.

limit Integer Specifies the number of queryrecords.

scaling_groups List data structure Specifies the scaling group list.

l scaling_groups field data structure description

Parameter Type Description

scaling_group_name String Specifies the name of the ASgroup.

scaling_group_id String Specifies the AS group ID.

scaling_group_status String Specifies the status of the ASgroup.

scaling_configuration_id String Specifies the AS configurationID.

scaling_configuration_name

String Specifies the AS configurationname.

current_instance_number Integer Specifies the number of currentinstances in the AS group.

desire_instance_number Integer Specifies the expected numberof instances in the AS group.

min_instance_number Integer Specifies the minimum numberof instances in the AS group.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 23

Page 28: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

max_instance_number Integer Specifies the maximum numberof instances in the AS group.

cool_down_time Integer Specifies the cooldown period(s).

lb_listener_id String Specifies the ID of a typicalELB listener. ELB listener IDsare separated using a comma(,).

lbaas_listeners List data structure This field is reserved.

available_zones List<String> Specifies the AZ information.

networks List data structure Specifies network information.

security_groups List data structure Specifies the security groupinformation.

create_time String Specifies the time when an ASgroup was created. The timeformat complies with UTC.

vpc_id String Specifies the ID of the VPC towhich the AS group belongs.

detail String Specifies details about the ASgroup.

is_scaling Boolean Specifies the scaling flag of theAS group.

health_periodic_audit_method

String Specifies the health checkmethod.

health_periodic_audit_time

Integer Specifies the health checkinterval.

health_periodic_audit_grace_period

Integer Specifies the grace period forhealth check.

instance_terminate_policy String Specifies the instance removalpolicy.

notifications List<String> Specifies the notification mode.EMAIL refers to notificationby email.

delete_publicip Boolean Specifies whether to delete theEIP bound to the ECS whendeleting the ECS.

cloud_location_id String This field is reserved.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 24

Page 29: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l networks field data structure description

Parameter Type Description

id String Specifies the network ID.

l security_groups field data structure description

Parameter Type Description

id String Specifies the ID of the securitygroup.

l Example response{ "limit": 20, "scaling_groups": [ { "networks": [ { "id": " a8327883-6b07-4497-9c61-68d03ee193a " } ], "detail": null, "scaling_group_name": "healthCheck", "scaling_group_id": "77a7a397-7d2f-4e79-9da9-6a35e2709150", "scaling_group_status": "INSERVICE", "scaling_configuration_id": "1d281494-6085-4579-b817-c1f813be835f", "scaling_configuration_name": "healthCheck", "current_instance_number": 0, "desire_instance_number": 1, "min_instance_number": 0, "max_instance_number": 500, "cool_down_time": 300, "lb_listener_id": "f06c0112570743b51c0e8fbe1f235bab", "security_groups": [ { "id": "8a4b1d5b-0054-419f-84b1-5c8a59ebc829" } ], "create_time": "2015-07-23T02:46:29Z", "vpc_id": "863ccae2-ee85-4d27-bc5b-3ba2a198a9e2", "health_periodic_audit_method": "ELB_AUDIT", "health_periodic_audit_time": 5, "health_periodic_audit_grace_period": 600, "instance_terminate_policy": "OLD_CONFIG_OLD_INSTANCE", "is_scaling": false, "delete_publicip": false, "notifications": [ "EMAIL" ] } ], "total_number": 1, "start_number": 0}

Returned Valuel Normal

200

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 25

Page 30: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

3.3 Querying AS Group Details

Function

This interface is used to query details about a specified AS group.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_group/{scaling_group_id}

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 26

Page 31: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_id Yes String Specifies the AS group ID.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

scaling_group Dictionary datastructure

Specifies details about the ASgroup.

l scaling_group field data structure description

Parameter Type Description

scaling_group_name String Specifies the name of the ASgroup.

scaling_group_id String Specifies the AS group ID.

scaling_group_status String Specifies the status of the ASgroup.

scaling_configuration_id String Specifies the AS configurationID.

scaling_configuration_name

String Specifies the AS configurationname.

current_instance_number Integer Specifies the number of currentinstances in the AS group.

desire_instance_number Integer Specifies the expected numberof instances in the AS group.

min_instance_number Integer Specifies the minimum numberof instances in the AS group.

max_instance_number Integer Specifies the maximum numberof instances in the AS group.

cool_down_time Integer Specifies the cooldown period(s).

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 27

Page 32: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

lb_listener_id String Specifies the ID of a typicalELB listener. ELB listener IDsare separated using a comma(,).

lbaas_listeners List data structure This field is reserved.

available_zones List<String> Specifies the AZ information.

networks List data structure Specifies network information.

security_groups List data structure Specifies the security groupinformation.

create_time String Specifies the time when an ASgroup was created. The timeformat complies with UTC.

vpc_id String Specifies the ID of the VPC towhich the AS group belongs.

detail String Specifies details about the ASgroup.

is_scaling Boolean Specifies the scaling flag of theAS group.

health_periodic_audit_method

String Specifies the health checkmethod.

health_periodic_audit_time

Integer Specifies the health checkinterval.

health_periodic_audit_grace_period

Integer Specifies the grace period forhealth check.

instance_terminate_policy String Specifies the instance removalpolicy.

notifications List<String> Specifies the notification mode.EMAIL refers to notificationby email.

delete_publicip Boolean Specifies whether to delete theEIP bound to the ECS whendeleting the ECS.

cloud_location_id String This field is reserved.

l networks field data structure description

Parameter Type Description

id String Specifies the network ID.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 28

Page 33: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l security_groups field data structure description

Parameter Type Description

id String Specifies the ID of the securitygroup.

l Example response{ "scaling_group": { "networks": [ { "id": "2daf6ba6-fb24-424a-b5b8-c554fab95f15" } ], "detail": null, "scaling_group_name": "api_gateway_modify", "scaling_group_id": "d4e50321-3777-4135-97f8-9f5e9714a4b0", "scaling_group_status": "INSERVICE", "scaling_configuration_id": "53579851-3841-418d-a97b-9cecdb663a90", "scaling_configuration_name": "press", "current_instance_number": 7, "desire_instance_number": 8, "min_instance_number": 0, "max_instance_number": 100, "cool_down_time": 900, "lb_listener_id": null, "security_groups": [ { "id": "23b7b999-0a30-4b48-ae8f-ee201a88a6ab" } ], "create_time": "2015-09-01T08:36:10Z", "vpc_id": "3e22f934-800d-4bb4-a588-0b9a76108190", "health_periodic_audit_method": "NOVA_AUDIT", "health_periodic_audit_time": 60, "health_periodic_audit_grace_period": 600, "instance_terminate_policy": "OLD_CONFIG_OLD_INSTANCE", "is_scaling": true, "delete_publicip": false, "notifications": [ "EMAIL" ] }}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 29

Page 34: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

3.4 Modifying an AS Group

FunctionThis interface is used to modify information about a specified AS group.

The ECSs created based on the original AS configuration will not be affected after the ASconfiguration of an AS group is modified.

URIl URI format

PUT /autoscaling-api/v1/{tenant_id}/scaling_group/{scaling_group_id}l Parameter description

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 30

Page 35: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_id Yes String Specifies the AS group ID.

Requestl Parameter description

Parameter Mandatory Type Description

scaling_group_name

No String Specifies the AS group name. Thename can contain letters, digits,underscores (_), and hyphens (-), andcannot exceed 64 characters.

desire_instance_number

No Integer Specifies the expected number ofinstances.The value ranges from the minimumnumber of instances to the maximumnumber of instances.

min_instance_number

No Integer Specifies the minimum number ofinstances.

max_instance_number

No Integer Specifies the maximum number ofinstances, which is greater than orequal to the minimum number ofinstances.

cool_down_time

No Integer Specifies the cooldown period (inseconds). The value ranges from 0 to86400.

availability_zones

No List<String>

Specifies the AZ information. TheECS associated with the scalingaction will be created in the specifiedAZ. If you do not specify an AZ, thesystem automatically specifies one.

The value of this parameter can bechanged only when all the followingconditions are met:l No scaling actions are triggered in

the AS group.l The number of instances in the

AS group is 0.l The AS group is not in service.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 31

Page 36: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

networks No List datastructure

Specifies network information. Thesystem supports up to five subnets.The first subnet transferred serves asthe primary NIC of the ECS bydefault. You can use vpc_id to obtainthe parameter value from the APIused to query VPC subnets. Fordetails, see section Subnet >Querying Subnets in the VirtualPrivate Cloud API Reference. Thevalue of this parameter can bechanged only when all the followingconditions are met:l No scaling actions are triggered in

the AS group.l The number of instances in the

AS group is 0.l The AS group is not in service.

security_groups No List datastructure

Specifies the security groupinformation. You can use vpc_id toobtain the parameter value from theAPI used to query VPC securitygroups. For details, see section"Querying Security Groups" in theVirtual Private Cloud API Reference.If the security group is specified bothin the AS configuration and ASgroup, the security group specified inthe AS configuration prevails. If thesecurity group is not specified ineither of them, the default securitygroup is used. For your convenience,you are advised to specify thesecurity group in the ASconfiguration. The value of thisparameter can be changed only whenall the following conditions are met:l No scaling actions are triggered in

the AS group.l The number of instances in the

AS group is 0.l The AS group is not in service.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 32

Page 37: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

lb_listener_id No String Specifies the ID of a typical ELBlistener. The system supports thebinding of up to three ELB listeners,the IDs of which are separated usinga comma (,). You can use vpc_id toobtain a load balancer ID from theAPI used to query an ELB list. Fordetails, see section "Querying LoadBalancers" in Elastic Load BalanceAPI Reference. Then, use the loadbalancer ID to query the ELB listenerlist to obtain the ELB listener ID. Fordetails, see section "QueryingListeners" in Elastic Load BalanceAPI Reference.The value of this parameter can bechanged only when all the followingconditions are met:l No scaling actions are triggered in

the AS group.l The number of instances in the

AS group is 0.l The AS group is not in service.

health_periodic_audit_method

No String Specifies the health check method forinstances in the AS group. The healthcheck methods include ELB_AUDITand NOVA_AUDIT.l ELB_AUDIT refers to the ELB

health check, which takes effect inan AS group that has a listener.

l NOVA_AUDIT refers to thehealth check delivered with AS.

health_periodic_audit_time

No Integer Specifies the health check period forthe instances in the AS group. Thevalue can be 1, 5, 15, 60, or 180 min.If the value is set to 0, health check isperformed every 10 seconds.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 33

Page 38: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

instance_terminate_policy

No String Specifies the instance removal policy.l (Default)

OLD_CONFIG_OLD_INSTANCE: The earlier-created instancesthat were selected from theinstances created based on earlier-created configurations areremoved first.

l OLD_CONFIG_NEW_INSTANCE: The later-created instancesthat were selected from theinstances created based on earlier-created configurations areremoved first.

l OLD_INSTANCE: The earlier-created instances are removedfirst.

l NEW_INSTANCE: The later-created instances are removedfirst.

health_periodic_audit_grace_period

No Integer Specifies the grace period forinstance health check. The unit issecond and value range is 0-86400.The health check grace period startsafter an instance is added to an ASgroup and is enabled. The AS groupwill start checking status of theinstance only after the grace periodends.This parameter is valid when thehealth check method isELB_AUDIT. If this parameter isnot specified, the default grace periodis 10 minutes.

scaling_configuration_id

No String Specifies the AS configuration ID.You can obtain its value from the APIused to query AS configurations. Fordetails, see 4.2 Querying ASConfigurations.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 34

Page 39: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

notifications No List<String>

Specifies the notification mode.EMAIL refers to notification byemail.This notification mode is going to becanceled. You are advised toconfigure the notification function forthe AS group. See 10 Notificationsfor details.

delete_publicip No Boolean Specifies whether to delete the EIPbound to the ECS when deleting theECS. If you do not want to delete theEIP, set this parameter to false. Then,the system only unbinds the EIP fromthe ECS and reserves the EIP.l true: deletes the EIP bound to the

ECS when deleting the ECS.When the ECS is charged inYearly/Monthly mode, the EIPbound to the ECS will not bedeleted when the ECS is deleted.

l false: only unbinds the EIP boundto the ECS when deleting theECS.

l networks field data structure description

Parameter Mandatory Type Description

id Yes String Specifies the network ID.

l security_groups field data structure description

Parameter Mandatory Type Description

id Yes String Specifies the ID of the securitygroup.

l Example request{ "scaling_group_name": "group_1", "scaling_configuration_id": "f8327883-6a07-4497-9a61-68c03e8e72a2", "desire_instance_number": 1, "min_instance_number": 1, "max_instance_number": 3, "cool_down_time": 200}

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 35

Page 40: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Responsel Parameter description

Parameter Type Description

scaling_group_id String Specifies the AS group ID.

l Example response{ "scaling_group_id": "a8327883-6b07-4497-9c61-68d03ee193a1"}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requested page.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 36

Page 41: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

504 Gateway Timeout A gateway timeout error occurred.

3.5 Deleting an AS Group

Function

This interface is used to delete a specified AS group.

force_delete specifies whether to forcibly delete an AS group, remove the ECS instances andrelease them when the AS group is running instances or performing scaling actions. Bydefault, its value is no, which means not to forcibly delete the AS group.

If the value of force_delete is set to no, the AS group can be deleted only when both thefollowing conditions are met:

The AS group is performing no scaling action.

The number of running ECS instances (current_instance_number) is 0.

If the value of force_delete is set to yes, the AS group enters the DELETING state, rejectingnew requests for scaling actions while completing the existing scaling actions. Then, all ECSinstances are removed from the AS group and the AS group is deleted. Note that the manuallyadded ECS instances will be removed from the AS group and the ECS instances automaticallycreated by AS will be automatically deleted.

URIl URI format

DELETE /autoscaling-api/v1/{tenant_id}/scaling_group/{scaling_group_id}?force_delete=no

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

force_delete No String Specifies whetherto forcibly deletean AS group. Thevalue can be yes orno (default).

Requestl Example request

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 37

Page 42: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

None

Responsel Example response

None

Returned Valuesl Normal

204l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requested page.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 38

Page 43: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

3.6 Enabling or Disabling an AS Group

FunctionThis interface is used to enable or disable a specified AS group.

If an AS group is disabled, AS actions will not be triggered based on the AS policy.

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_group/{scaling_group_id}/actionl Parameter description

Name Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

Requestl Parameter description

Parameter Mandatory Type Description

action Yes String Specifies a flag forenabling or disablingan AS group.l resume: enables

the AS group.l pause: disables the

AS group.

l Example request{ "action": "resume"}

Responsel Example response

None

Returned Valuel Normal

204

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 39

Page 44: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 3 AS Groups

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 40

Page 45: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

4 AS Configurations

4.1 Creating an AS Configuration

Function

This interface is used to create an AS configuration.

An AS configuration is a template of ECSs in an AS group. It defines the specifications of theinstances to be added to the AS group. The AS service automatically adds instances to an ASgroup based on the AS configuration.

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_configuration

l Parameter description

Parameter Mandatory

Type Description

tenant_id Yes String Specifies the tenant ID.

Requestl Parameter description

Parameter Mandatory

Type Description

scaling_configuration_name

Yes String Specifies the AS configurationname. The name can containletters, digits, underscores (_), andhyphens (-), and must be between1 and 64 characters in length.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 41

Page 46: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

instance_config Yes Dictionarydata structure

Specifies the information aboutinstance configurations.

l instance_config field data structure description

NOTE

l When you create an ECS using an image that supports Cloud-Init or Cloudbase-Init, onlykey_name can be configured. (Parameter adminPass is invalid.) For a Linux ECS, itspassword can be injected only using user_data. For a Windows ECS, its password can beinjected only using metadata admin_pass.

l When you create an ECS using an image that does not support Cloud-Init or Cloudbase-Init,both parameters adminPass and key_name are invalid. In such a case, use the password orcertificate of the image to log in to the ECS.

Parameter Mandatory Type Description

instance_id No String Specifies the ECS ID. When using theexisting ECS specifications as thetemplate to create AS configurations,specify this parameter. In this case,flavorRef, imageRef, and disk fieldsdo not take effect.If the instance_id field is notspecified, flavorRef, imageRef, anddisk fields are mandatory.

flavorRef No String Specifies the ECS flavor ID. You canobtain its value from the API used toquery specifications and expansiondetails about ECSs. For details, seesection "Querying Specifications andExpansion Details About ECSs" in theElastic Cloud Server API Reference.

imageRef No String Specifies the image ID. It is the sameas image_id. You can obtain its valuefrom the API used to query IMSimages. For details, see sectionQuerying Images in the ImageManagement Service API Reference.

disk No List datastructure

Specifies the disk group information.System disks are mandatory and datadisks are optional.

key_name Yes String Specifies the name of the SSH key pairused to log in to the ECS.NOTE

If both key_name and user_data arespecified, user_data only injects user data.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 42

Page 47: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

personality No List datastructure

Specifies information about theinjected file. Only text files can beinjected. A maximum of five files canbe injected at a time and the maximumsize of each file is 1 KB.

public_ip No Dictionarydatastructure

Specifies the EIP of the ECS. The EIPcan be configured in the following twoways:l Do not use an EIP. In this case, this

parameter is unavailable.l Automatically assign an EIP. You

need to specify the informationabout the new EIP.

user_data No String Specifies the Cloud-Init user data.Text, text files, and gzip files can beinjected. The file content must beencoded using Base64. The maximumsize of the injected file (beforeencoding) is 32 KB.

metadata No Dictionarydatastructure

Specifies the metadata of ECSs to becreated.NOTE

This parameter is mandatory when aWindows ECS with passwordauthentication is created.

This field does not allow users to writedata. It is mandatory when the ECS is to becreated using a Windows image.

security_groups

No List datastructure

Specifies the security groupinformation. You can use vpc_id toobtain the parameter value from theAPI used to query VPC securitygroups. For details, see section"Querying Security Groups" in theVirtual Private Cloud API Reference.If the security group is specified bothin the AS configuration and AS group,the security group specified in the ASconfiguration prevails. If the securitygroup is not specified in either of them,the default security group is used. Foryour convenience, you are advised tospecify the security group in the ASconfiguration.

l disk field data structure description

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 43

Page 48: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

size Yes Integer Specifies the disk size. The unit is GB.The system disk size ranges from 40 to32768 and must be greater than orequal to the minimum size (min_diskvalue) of the system disk specified inthe image.The data disk size ranges from 10 to32768.

volume_type Yes String Specifies the ECS system disk type,which must be the same as the disktype available in the system.Enumerated values of the disk type:l SATA: common I/O disk typel SAS: high I/O disk typel SSD: ultra-high I/O disk typel co-pl: high I/O (performance-

optimized I) disk typel uh-l1: ultra-high I/O (latency-

optimized) disk typeNOTE

For HANA and HL1 ECSs, use co-p1 oruh-l1 disks. For other ECSs, do not use co-p1 or uh-l1 disks.

disk_type Yes String Specifies whether the disk is a systemdisk or a data disk. DATA indicates adata disk. SYS indicates a system disk.

dedicated_storage_id

No String Specifies a DSS device ID for creatingan ECS disk.NOTE

Specify DSS devices for all disks in an ASconfiguration or not. If DSS devices arespecified, all the data stores must belong tothe same AZ, and the disk types supportedby a DSS device for a disk must be thesame as the volume_type value.

data_disk_image_id

No String Specifies the ID of a data disk imageused to export data disks of an ECS.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 44

Page 49: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

snapshot_id No String Specifies the disk backup snapshot IDfor restoring the system disk and datadisk at the ECS level when the ECS-level image is used.NOTE

You can obtain the disk backup snapshotID by using the mirrored ECS-level backupID to query backup details in CSBS.Regarding snapshot_id, each disk in anAS configuration must correspond to a diskbackup at the ECS-level.

l personality field data structure description

Parameter Mandatory Type Description

path Yes String Specifies the path of the injected file.1. For Linux OSs, specify the path, for

example, /etc/foo.txt, for storingthe injected file.

2. For Windows, the injected file isautomatically stored in the rootdirectory of drive C. You only needto specify the file name, forexample, foo. The file name cancontain only letters and digits.

content Yes String Specifies the content of the injectedfile.The value must be the informationafter the content of the injected file isencoded using Base64.

l public_ip field data structure description

Parameter Mandatory Type Description

eip Yes Dictionarydatastructure

Specifies the configuration parameterfor creating an EIP that will beautomatically assigned to the ECS.

l eip field data structure description

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 45

Page 50: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

ip_type Yes String Specifies the EIP type.Enumerated values of the IP addresstype:l 5_bgp: indicates the dynamic BGP.l 5_sbgp: indicates the static BGP.l 5_telcom: indicates China Telecom.l 5_union: indicates China Unicom.For details, see the publicip field insection "Assigning an EIP" in theVirtual Private Cloud API Reference.

bandwidth Yes Dictionarydatastructure

Specifies the bandwidth.

l bandwidth field data structure description

Parameter Mandatory Type Description

size Yes Integer Specifies the bandwidth (Mbit/s). Thevalue range for bandwidth billed basedon the duration is 1 to 2000 and thatfor bandwidth billed based on theamount of data used is 1 to 300NOTE

l The specific range may vary dependingon the configuration in each region.You can see the bandwidth range ofeach region on the managementconsole.

l The minimum unit for bandwidthvaries depending on the bandwidthrange.

l The minimum unit is 1 Mbit/s ifthe allowed bandwidth size rangesfrom 0 to 300 Mbit/s (with 300Mbit/s included).

l The minimum unit is 50 Mbit/s ifthe allowed bandwidth size ranges300 Mbit/s to 1000 Mbit/s (with1000 Mbit/s included).

l The minimum unit is 500 Mbit/s ifthe allowed bandwidth size isgreater than 1000 Mbit/s.

share_type Yes String Specifies the bandwidth sharing type.Enumerated value: PER (indicatesexclusive bandwidth)Only exclusive bandwidth is available.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 46

Page 51: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

charging_mode

Yes String Specifies the bandwidth chargingmode.l If the field value is bandwidth, the

bandwidth is billed based on theduration it is used.

l If the field value is traffic, thebandwidth is billed based on theamount of data used.

l If the field value is others, the ECScreation will fail.

l metadata field data structure description

Parameter Mandatory Type Description

User-definedfield keypair

No String The total length of the user-defineddata cannot be longer than 512 bytes.The user-defined key cannot be empty,contain symbol dot (.), or start withsymbol dollar ($).NOTE

Specifies the password of theAdministrator account for a WindowsECS.

An example is provided as follows:

Key (fixed): admin_pass

Value: cloud.1234

This parameter is mandatory when aWindows ECS with the passwordauthentication mode is created.

l security_groups field data structure description

Parameter Mandatory

Type Description

id Yes String Specifies the ID of the security group.

l Example request{ "scaling_configuration_name": "as-config-tlzq", "instance_config": { "flavorRef": "103", "imageRef": "627a1223-2ca3-46a7-8d5f-7aef22c74ee6", "disk": [ { "size": 40, "volume_type": "SATA", "disk_type": "SYS" } ],

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 47

Page 52: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"key_name": "100vm_key" , "security_groups": [{ "id": "6c22a6c0-b5d2-4a84-ac56-51090dcc33be" }] } }

Responsel Parameter description

Parameter Type Description

scaling_configuration_id String Specifies the AS configuration ID.

l Example response{ "scaling_configuration_id": "f8327883-6a07-4497-9a61-68c03e8e72a2"}

Returned Valuel Normal

200l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 48

Page 53: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

4.2 Querying AS Configurations

Function

This interface is used to query AS configurations based on the conditions you input anddisplay the results by page.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_configuration{?scaling_configuration_name,image_id,start_number,limit}

NOTE

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiplesearch criteria. You can filter all non-mandatory parameters in the parameter description.

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_configuration_name No String Specifies the ASconfigurationname.

image_id No String Specifies the imageID. It is same asimageRef.

start_number No Integer Specifies the startline number. Thedefault value is 0.

limit No Integer Specifies thenumber of queryrecords. Thedefault value is 20.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 49

Page 54: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

total_number Integer Specifies the total number of queryrecords.

start_number Integer Specifies the start line number.

limit Integer Specifies the number of queryrecords.

scaling_configurations List data structure Specifies the AS configuration list.

l scaling_configurations field data structure description

Parameter Type Description

scaling_configuration_id String Specifies the AS configuration ID.This parameter is globally unique.

tenant String Specifies the tenant ID.

scaling_configuration_name String Specifies the AS configurationname.

instance_config Dictionarydata structure

Specifies the information aboutinstance configurations.

create_time String Specifies the time when ASconfigurations are created. The timeformat complies with UTC.

l instance_config field data structure description

Parameter Type Description

flavorRef String Specifies the ECS flavor ID.

imageRef String Specifies the image ID. It is same asimage_id.

disk List data structure Specifies the disk group information.

key_name String Specifies the name of the SSH key pairused to log in to the ECS.

instance_name String This field is reserved.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 50

Page 55: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

instance_id String This field is reserved.

adminPass String This field is reserved.

personality List data structure Specifies information about the injectedfile.

public_ip Dictionary datastructure

Specifies the EIP of the ECS.

user_data String Specifies the Cloud-Init user data, whichis encoded using Base64.

metadata Dictionary datastructure

Specifies the metadata of ECSs to becreated.

security_groups List data structure Specifies the security group information.

l disk field data structure description

Parameter Type Description

size Integer Specifies the disk size. The unit is GB.

volume_type String Specifies the disk type.

disk_type String Specifies whether the disk is a systemdisk or a data disk. DATA indicates adata disk. SYS indicates a system disk.

dedicated_storage_id

String Specifies the ID of the DSS device forthe disk.

data_disk_image_id

String Specifies the ID of the data disk imagefor creating a data disk.

snapshot_id String Specifies the disk backup snapshot ID.

l personality field data structure description

Parameter Type Description

path String Specifies the path of the injected file.

content String Specifies the content of the file to beinjected. The file content is encodedusing Base64.

l public_ip field data structure description

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 51

Page 56: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

eip Dictionary datastructure

Specifies the configuration parameter forcreating an EIP that will be automaticallyassigned to the ECS.

l eip field data structure description

Parameter Type Description

ip_type String Specifies the IP address type.

bandwidth Dictionary datastructure

Specifies the bandwidth of the IPaddress.

l bandwidth field data structure description

Parameter Type Description

size Integer Specifies the bandwidth (Mbit/s).

share_type String Specifies the bandwidth sharing type.Enumerated value: PER (indicatesexclusive bandwidth)Only exclusive bandwidth is available.

charging_mode String Specifies the bandwidth charging mode.l If the field value is traffic, the ECS

service is charged by traffic.

l metadata field data structure description

Parameter Type Description

User-defined fieldkey pair

String Specifies the key and value of themetadata.

l security_groups field data structure description

Parameter Type Description

id String Specifies the ID of the security group.

l Example response{ "limit": 20, "total_number": 2, "start_number": 0, "scaling_configurations": [ { "tenant": "ce061903a53545dcaddb300093b477d2", "scaling_configuration_id": "6afe46f9-7d3d-4046-8748-3b2a1085ad86", "scaling_configuration_name": " config_name_1",

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 52

Page 57: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"instance_config": { "disk": [ { "size": 40, "volume_type": "SATA", "disk_type": "SYS" }, { "size": 100, "volume_type": "SATA", "disk_type": "DATA" } ], "personality": null, "instance_name": null, "instance_id": null, "flavorRef": "103", "imageRef": "37ca2b35-6fc7-47ab-93c7-900324809c5c", "key_name": "keypair01", "public_ip": null, "user_data": null, "metadate": {}, "security_groups": [{ "id": "6c22a6c0-b5d2-4a84-ac56-51090dcc33be" }], }, "create_time": "2015-07-23T01:04:07Z" }, { "tenant": "ce061903a53545dcaddb300093b477d2", "scaling_configuration_id": "24a8c5f3-c713-4aba-ac29-c17101009e5d", "scaling_configuration_name": "config_name_2", "instance_config": { "disk": [ { "size": 40, "volume_type": "SATA", "disk_type": "SYS" } ], "personality": null, "instance_name": null, "instance_id": null, "flavorRef": "103", "imageRef": "37ca2b35-6fc7-47ab-93c7-900324809c5c", "key_name": "keypair01", "public_ip": null, "user_data": null, "metadata": {}, "security_groups": [{ "id": "6c22a6c0-b5d2-4a84-ac56-51090dcc33be" }], }, "create_time": "2015-07-22T01:08:41Z" } ]}

Returned Valuel Normal

200l Abnormal

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 53

Page 58: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

4.3 Querying AS Configuration Details

Function

This interface is used to query details about an AS configuration.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_configuration/{scaling_configuration_id}

l Parameter description

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 54

Page 59: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_configuration_id Yes String Specifies the unique ID of anAS configuration.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

scaling_configuration Dictionary data structure Provides AS configurationdetails.

l scaling_configuration field data structure description

Parameter Type Description

scaling_configuration_id String Specifies the AS configuration ID.This parameter is globally unique.

tenant String Specifies the tenant ID.

scaling_configuration_name String Specifies the AS configurationname.

instance_config Dictionarydata structure

Specifies the information aboutinstance configurations.

create_time String Specifies the time when ASconfigurations are created. The timeformat complies with UTC.

l instance_config field data structure description

Parameter Type Description

flavorRef String Specifies the ECS flavor ID.

imageRef String Specifies the image ID. It is same asimage_id.

disk List data structure Specifies the disk group information.

key_name String Specifies the name of the SSH key pairused to log in to the ECS.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 55

Page 60: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

instance_name String This field is reserved.

instance_id String This field is reserved.

adminPass String This field is reserved.

personality List data structure Specifies information about the injectedfile.

public_ip Dictionary datastructure

Specifies the EIP of the ECS.

user_data String Specifies the Cloud-Init user data, whichis encoded using Base64.

metadata Dictionary datastructure

Specifies the metadata of ECSs to becreated.

security_groups List data structure Specifies the security group information.

l disk field data structure description

Parameter Type Description

size Integer Specifies the disk size. The unit is GB.

volume_type String Specifies the disk type.

disk_type String Specifies whether the disk is a systemdisk or a data disk. DATA indicates adata disk. SYS indicates a system disk.

dedicated_storage_id

String Specifies the ID of the DSS device forthe disk.

data_disk_image_id

String Specifies the ID of the data disk imagefor creating a data disk.

snapshot_id String Specifies the disk backup snapshot ID.

l personality field data structure description

Parameter Type Description

path String Specifies the path of the injected file.

content String Specifies the content of the file to beinjected. The file content is encodedusing Base64.

l public_ip field data structure description

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 56

Page 61: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

eip Dictionary datastructure

Specifies the configuration parameter forcreating an EIP that will be automaticallyassigned to the ECS.

l eip field data structure description

Parameter Type Description

ip_type String Specifies the IP address type.

bandwidth Dictionary datastructure

Specifies the bandwidth of the IP address.

l bandwidth field data structure description

Parameter Type Description

size Integer Specifies the bandwidth (Mbit/s).

share_type String Specifies the bandwidth sharing type.Enumerated value: PER (indicatesexclusive bandwidth)Only exclusive bandwidth is available.

charging_mode String Specifies the bandwidth charging mode.l If the field value is traffic, the ECS

service is charged by traffic.

l metadata field data structure description

Parameter Type Description

User-defined fieldkey pair

String Specifies the key and value of themetadata.

l security_groups field data structure description

Parameter Type Description

id String Specifies the ID of the security group.

l Example response{ "scaling_configuration": { "tenant": "ce061903a53545dcaddb300093b477d2", "scaling_configuration_id": "6afe46f9-7d3d-4046-8748-3b2a1085ad86", "scaling_configuration_name": " config_name_1", "instance_config": { "disk": [ { "size": 40,

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 57

Page 62: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"volume_type": "SATA", "disk_type": "SYS" }, { "size": 100, "volume_type": "SATA", "disk_type": "DATA" } ], "adminPass": "***", "personality": null, "instance_name": null, "instance_id": null, "flavorRef": "103", "imageRef": "37ca2b35-6fc7-47ab-93c7-900324809c5c", "key_name": "keypair01", "public_ip": null, "user_data": null, "metadata": {}, "security_groups": [{ "id": "6c22a6c0-b5d2-4a84-ac56-51090dcc33be" }] }, "create_time": "2015-07-23T01:04:07Z" }}

Returned Valuel Normal

200l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 58

Page 63: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

4.4 Deleting an AS Configuration

FunctionThis interface is used to delete a specified AS configuration. AS configurations used by ASgroups cannot be deleted.

URIl URI format

DELETE /autoscaling-api/v1/{tenant_id}/scaling_configuration/{scaling_configuration_id}

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_configuration_id

Yes String Specifies the ASconfiguration ID.

Requestl Example request

None

Responsel Example response

None

Returned Valuesl Normal

204

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 59

Page 64: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

4.5 Batch Deleting AS Configurations

FunctionThis interface is used to batch delete AS configurations. AS configurations used by ASgroups cannot be deleted.

A maximum of 50 AS configurations can be deleted at a time.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 60

Page 65: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_configurationsl Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

Requestl Parameter description

Parameter Mandatory

Type Description

scaling_configuration_id Yes List<String> Specifies the ASconfiguration ID.

l Example request{ "scaling_configuration_id": [ "config1", "config2" ]}

Responsel Example response

None

Returned Valuel Normal

204l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 61

Page 66: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 4 AS Configurations

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 62

Page 67: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

5 Instances in an AS Group

5.1 Querying Instances in an AS Group

FunctionThis interface is used to query information about instances in an AS group. The results arefiltered based on the conditions you input and displayed by page.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_group_instance/{scaling_group_id}/list{?life_cycle_state,health_status,start_number,limit}

NOTE

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiplesearch criteria. You can filter all non-mandatory parameters in the parameter description.

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_id Yes String Specifies the AS group ID.

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 63

Page 68: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

life_cycle_state No String Specifies the instance lifecycle statusin the AS group.l INSERVICE: The instance in the

AS group is in use.l PENDING: The instance is being

added to the AS group.l REMOVING: The instance is

being removed from the AS group.l PENDING_WAIT: The instance

is waiting to be added to the ASgroup.

l REMOVING_WAIT: Theinstance is waiting to be removedfrom the AS group.

health_status No String Specifies the instance health status.l INITIALIZING: The instance is

initializing.l NORMAL: The instance is

normal.l ERROR: The instance is

abnormal.

start_number No Integer Specifies the start line number. Thedefault value is 0.

limit No Integer Specifies the total number of queryrecords. The default is 20 and themaximum is 100.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

total_number Integer Specifies the total number of queryrecords.

start_number Integer Specifies the start line number.

limit Integer Specifies the number of queryrecords.

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 64

Page 69: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

scaling_group_instances

List data structure Specifies details about the instancesin the AS group.

l scaling_group_instances field data structure description

Parameter Type Description

instance_id String Specifies the instance ID.

instance_name String Specifies the instance name.

scaling_group_id String Specifies the ID of the AS group towhich the instance belongs.

scaling_group_name String Specifies the name of the AS group towhich the instance belongs.

life_cycle_state String Specifies the instance lifecycle status inthe AS group.l INSERVICE: The instance in the

AS group is in use.l PENDING: The instance is being

added to the AS group.l PENDING_WAIT: The instance is

waiting to be added to the AS group.l REMOVING: The instance is being

removed from the AS group.l REMOVING_WAIT: The instance

is waiting to be removed from theAS group.

health_status String Specifies the instance health status.The status can be NORMAL orERROR.

scaling_configuration_name String Specifies the AS configuration name.l If the AS configuration has been

deleted, no information is displayed.l If the instance is manually added to

the AS group, MANNUAL_ADD isreturned.

scaling_configuration_id String Specifies the AS configuration ID.

create_time String Specifies the time when the instance isadded to the AS group. The time formatcomplies with UTC.

protect_from_scaling_down Boolean Specifies the instance protection status.

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 65

Page 70: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Example response{ "limit": 10, "total_number": 1, "start_number": 0, "scaling_group_instances": [ { "instance_id": "b25c1589-c96c-465b-9fef-d06540d1945c", "scaling_group_id": "e5d27f5c-dd76-4a61-b4bc-a67c5686719a", "scaling_group_name": "discuz", "life_cycle_state": "INSERVICE", "health_status": "NORMAL", "scaling_configuration_name": "discuz", "scaling_configuration_id": "ca3dcd84-d197-4c4f-af2a-cf8ba39696ac", "create_time": "2015-07-23T06:47:33Z", "instance_name": "discuz_3D210808", "protect_from_scaling_down": false } ]}

Returned Valuel Normal

200l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 66

Page 71: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

5.2 Removing Instances from an AS Group

Function

This interface is used to remove instances from a specified AS group.

You can remove instances only in INSERVICE state and only when the number of instancesafter the removal is greater than or equal to the minimum number of instances allowed.

You can remove instances from an AS group only when no scaling action is in progress.

URIl URI format

DELETE /autoscaling-api/v1/{tenant_id}/scaling_group_instance/{instance_id}?instance_delete=yes

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

instance_id Yes String Specifies the instance ID.

instance_delete No String Specifies whether the instancesare deleted when they areremoved from the AS group. Thevalue can be yes or no (default).

Requestl Example request

None

Responsel Example response

None

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 67

Page 72: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Valuesl Normal

204l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

5.3 Performing Operations on Instances in Batches

FunctionThis interface is used to remove instances from an AS group or add instances to an AS groupin batches, or enable or disable instance protection on the instances in an AS group in batches.

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 68

Page 73: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

NOTE

l If the listener bound to the instance to be removed is the same as the listener in the AS group, thelistener will be unbound from the instance.

l If the listener bound to the instance to be removed is different from the listener in the AS group, thebinding relationship between the listener and instance will be reserved.

l When the capacity of an AS group is automatically decreased, the instances with instance protectionenabled will not be removed from the AS group.

l The instances are removable only when they are in INSERVICE state.

l Instance protection can be enabled or disabled only on INSERVICE instances.

l The number of instances after the removal must be greater than or equal to the minimum number ofinstances allowed.

l The number of instances after the adding must be less than or equal to the maximum number ofinstances allowed.

l Instances can be added to an AS group only when the AS group is in the INSERVICE state and hasno scaling action in progress.

l You can remove instances from an AS group only when no scaling action is in progress.

l To add instances to an AS group, ensure that the AZ of the instances must be within the AZ of theAS group.

l A batch operation can be performed on a maximum of 10 instances at a time.

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_group_instance/{scaling_group_id}/action

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_id Yes String Specifies the AS group ID.

Requestl Parameter description

Parameter Mandatory

Type Description

instances_id Yes List<String> Specifies the ECS ID.

instance_delete

No String Specifies whether to delete ECSinstances when they are removedfrom an AS group. The value can beno (default) or yes.This parameter takes effect onlywhen the action is set to REMOVE.

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 69

Page 74: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

action Yes String Specifies an action to be performedon instances in batches. The optionsare as follows:l ADD: adds instances to the AS

group.l REMOVE: removes instances

from the AS group.l PROTECT: enables instance

protection.l UNPROTECT: disables instance

protection.

l Example request{ "action": "REMOVE", "instances_id": [ "instance_id_1", "instance_id_2" ], "instance_delete": "yes"}

Responsel Example response

None

Returned Valuel Normal

204

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 70

Page 75: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 5 Instances in an AS Group

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 71

Page 76: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

6 AS Policies

6.1 Creating an AS Policy

FunctionThis interface is used to create an AS policy.

If you set scaling actions to be triggered by alarms, the selected or created alarm can associatewith only one AS group.

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_policyl Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

Requestl Parameter description

Parameter Mandatory

Type Description

scaling_policy_name Yes String Specifies the AS policy name.The name can contain letters,digits, underscores (_), andhyphens (-), and cannot exceed64 characters.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 72

Page 77: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

scaling_group_id Yes String Specifies the AS group ID. Youcan obtain its value from theAPI used to query AS groups.For details, see 3.2 QueryingAS Groups.

scaling_policy_type Yes String Specifies the AS policy type.l ALARM (corresponding to

alarm_id): indicates that thescaling action is triggered byan alarm.

l SCHEDULED(corresponding toscheduled_policy):indicates that the scalingaction is triggered asscheduled.

l RECURRENCE(corresponding toscheduled_policy):indicates that the scalingaction is triggeredperiodically.

alarm_id No String Specifies the alarm rule ID.This parameter is mandatorywhen scaling_policy_type isset to ALARM. After thisparameter is specified, the valueof scheduled_policy does nottake effect.After you create an alarmpolicy, the system automaticallyadds an alarm triggeringactivity of the autoscaling typeto the alarm_actions field inthe alarm rule specified by theparameter value.You can obtain the parametervalue by querying the CESalarm rule list. For details, seesection Querying Alarms inthe Cloud Eye API Reference.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 73

Page 78: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

scheduled_policy No Dictionarydatastructure

Specifies the periodic orscheduled AS policy. Thisparameter is mandatory whenscaling_policy_type is set toSCHEDULED orRECURRENCE. After thisparameter is specified, the valueof alarm_id does not takeeffect.

scaling_policy_action

No Dictionarydatastructure

Specifies the scaling action ofthe AS policy.

cool_down_time No Integer Specifies the cooldown period(in seconds). The value rangesfrom 0 to 86400 and is 300 bydefault.

l scheduled_policy field data structure description

Parameter Mandatory

Type Description

launch_time Yes String Specifies the time when thescaling action is triggered. Thetime format complies withUTC.l If scaling_policy_type is set

to SCHEDULED, the timeformat is YYYY-MM-DDThh:mmZ.

l If scaling_policy_type is setto RECURRENCE, thetime format is hh:mm.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 74

Page 79: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

recurrence_type No String Specifies the periodic triggeringtype. This parameter ismandatory whenscaling_policy_type is set toRECURRENCE.Daily: indicates that the scalingaction is triggered once a day.Weekly: indicates that thescaling action is triggered oncea week.Monthly indicates that thescaling action is triggered oncea month.

recurrence_value No String Specifies the day when aperiodic scaling action istriggered. This parameter ismandatory whenscaling_policy_type is set toRECURRENCE.l If recurrence_type is set to

Daily, the value is null,indicating that the scalingaction is triggered once aday.

l If recurrence_type is set toWeekly, the value rangesfrom 1 (Sunday) to 7(Saturday). The digits referto dates in each week andseparated by a comma, suchas 1,3,5.

l If recurrence_type is set toMonthly, the value rangesfrom 1 to 31. The digitsrefer to the dates in eachmonth and separated by acomma, such as 1,10,13,28.

start_time No String Specifies the start time of thescaling action triggeredperiodically. The time formatcomplies with UTC.The current time is used bydefault.The time format is YYYY-MM-DDThh:mmZ.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 75

Page 80: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

end_time No String Specifies the end time of thescaling action triggeredperiodically. The time formatcomplies with UTC. Thisparameter is mandatory whenscaling_policy_type is set toRECURRENCE.When the scaling action istriggered periodically, the endtime cannot be earlier than thecurrent and start time.The time format is YYYY-MM-DDThh:mmZ.

l scaling_policy_action field data structure description

Parameter Mandatory

Type Description

operation No String Specifies the operation to beperformed. The defaultoperation is ADD.ADD: adds specified number ofinstances to the AS group.REMOVE: removes specifiednumber of instances from theAS group.SET: sets the number ofinstances in the AS group.

instance_number No Integer Specifies the number ofinstances to be operated. Thedefault number is 1.Either instance_number orinstance_percentage isrequired.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 76

Page 81: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

instance_percentage No Integer Specifies the percentage ofinstances to be operated. Youcan increase/decrease or set thenumber of instances in an ASgroup to the specifiedpercentage of the currentnumber of instances. The valueranges from 0 to 20000.If neither instance_number norinstance_percentage isspecified, the number ofinstances to be operated is 1.Either instance_number orinstance_percentage isrequired.

l Example request{ "scaling_policy_name": "as-policy-7a75", "scaling_policy_action": { "operation": "ADD", "instance_number": 1 }, "cool_down_time": 900, "scheduled_policy": { "launch_time": "16:00", "recurrence_type": "Daily", "recurrence_value": null, "start_time": "2015-12-14T03:34Z", "end_time": "2015-12-27T03:34Z" }, "scaling_policy_type": "RECURRENCE", "scaling_group_id": "5bc3aa02-b83e-454c-aba1-4d2095c68f8b"}

Responsel Parameter description

Parameter Type Description

scaling_policy_id String Specifies the AS policyID.

l Example response{ "scaling_policy_id": "0h327883-324n-4dzd-9c61-68d03ee191dd"}

Returned Valuel Normal

200

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 77

Page 82: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

6.2 Creating an AS Policy (V2)

Function

This interface is used to create an AS policy for an AS group or bandwidth.

URIl URI format

POST /autoscaling-api/v2/{tenant_id}/scaling_policy

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 78

Page 83: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

Requestl Parameter description

Parameter Mandatory

Type Description

scaling_policy_name

Yes String Specifies the AS policy name. The namecan contain letters, digits, underscores(_), and hyphens (-), and cannot exceed64 characters.

scaling_resource_id

Yes String Specifies the scaling resource ID, whichis the unique ID of an AS group orbandwidth.l If scaling_resource_type is set to

SCALING_GROUP, this parameterindicates the unique ID of the ASgroup.

l If scaling_resource_type is set toBANDWIDTH, this parameterindicates the unique bandwidth ID.

scaling_resource_type

Yes string Specifies the scaling resource type.l AS group: SCALING_GROUPl Bandwidth: BANDWIDTH

scaling_policy_type

Yes String Specifies the AS policy type.l ALARM (corresponding to

alarm_id): indicates that the scalingaction is triggered by an alarm.

l SCHEDULED (corresponding toscheduled_policy): indicates that thescaling action is triggered asscheduled.

l RECURRENCE (corresponding toscheduled_policy): indicates that thescaling action is triggeredperiodically.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 79

Page 84: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

alarm_id No String Specifies the alarm rule ID. Thisparameter is mandatory whenscaling_policy_type is set to ALARM.After this parameter is specified, thevalue of scheduled_policy does not takeeffect.After you create an alarm policy, thesystem automatically adds an alarmtriggering activity of the autoscaling typeto the alarm_actions field in the alarmrule specified by the parameter value.You can obtain the parameter value byquerying the CES alarm rule list. Fordetails, see section Querying Alarms inthe Cloud Eye API Reference.

scheduled_policy

No Dictionarydatastructure

Specifies the periodic or scheduled ASpolicy. This parameter is mandatory whenscaling_policy_type is set toSCHEDULED or RECURRENCE.After this parameter is specified, thevalue of alarm_id does not take effect.

scaling_policy_action

No Dictionarydatastructure

Specifies the scaling action of the ASpolicy.

cool_down_time

No Integer Specifies the cooldown period (inseconds). The value ranges from 0 to86400 and is 300 by default.

l scheduled_policy field data structure description

Parameter Mandatory

Type Description

launch_time Yes String Specifies the time when the scalingaction is triggered. The time formatcomplies with UTC.l If scaling_policy_type is set to

SCHEDULED, the time format isYYYY-MM-DDThh:mmZ.

l If scaling_policy_type is set toRECURRENCE, the time format ishh:mm.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 80

Page 85: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

recurrence_type No String Specifies the periodic triggering type.This parameter is mandatory whenscaling_policy_type is set toRECURRENCE.Daily: indicates that the scaling action istriggered once a day.Weekly: indicates that the scaling actionis triggered once a week.Monthly: indicates that the scalingaction is triggered once a month.

recurrence_value

No String Specifies the day when a periodic scalingaction is triggered. This parameter ismandatory when scaling_policy_type isset to RECURRENCE.l If recurrence_type is set to Daily,

the value is null, indicating that thescaling action is triggered once a day.

l If recurrence_type is set to Weekly,the value ranges from 1 (Sunday) to 7(Saturday). The digits refer to dates ineach week and separated by a comma,such as 1,3,5.

l If recurrence_type is set toMonthly, the value ranges from 1 to31. The digits refer to the dates ineach month and separated by acomma, such as 1,10,13,28.NOTE

When recurrence_type is set to Daily,this parameter does not take effect.

start_time No String Specifies the start time of the scalingaction triggered periodically. The timeformat complies with UTC. The defaultvalue is the local time.The time format is YYYY-MM-DDThh:mmZ.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 81

Page 86: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

end_time No String Specifies the end time of the scalingaction triggered periodically. The timeformat complies with UTC. Thisparameter is mandatory whenscaling_policy_type is set toRECURRENCE. When the scalingaction is triggered periodically, the endtime cannot be earlier than the currentand start time.The time format is YYYY-MM-DDThh:mmZ.

l scaling_policy_action field data structure description

Parameter Mandatory

Type Description

operation No String Specifies the operation to be performed.The default operation is ADD.ADD: indicates adding instances.REDUCE: indicates reducing instances.SET: indicates setting the number ofinstances to a specified value.

size No Integer Specifies the operation size. The value isan integer from 0 to 300. The defaultvalue is 1.If scaling_resource_type is set toSCALING_GROUP, this parameterindicates the number of instances. Thevalue is an integer from 0 to 300 and thedefault value is 1.If scaling_resource_type is set toBANDWIDTH, this parameter indicatesthe bandwidth (Mbit/s). The value is aninteger from 1 to 300 and the defaultvalue is 1.When scaling_resource_type is set toSCALING_GROUP, either size orpercentage can be set.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 82

Page 87: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

percentage No Integer Specifies the operation percentage. Thevalue is an integer ranging from 0 to20,000.When scaling_resource_type is set toSCALING_GROUP, either size orpercentage can be set. If neither size norinstance_percentage is set, the defaultvalue of size is 1.If scaling_resource_type is set toBANDWIDTH, instance_percentage isnot configurable.

limits No Integer Specifies the operation restrictions.If scaling_resource_type is set toBANDWIDTH and operation is notSET, this parameter takes effect and theunit is Mbit/s.In this case:If operation is set to ADD, thisparameter indicates the maximumbandwidth allowed.If operation is set to REDUCE, thisparameter indicates the minimumbandwidth allowed.

l Example request{ "alarm_id": "al1513822380493GvlJKZwA8", "cool_down_time": 900, "scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6", "scaling_resource_type": "BANDWIDTH", "scaling_policy_action": { "size": 1, "operation": "ADD", "limits": 10 }, "scaling_policy_name": "hth_aspolicy_1", "scaling_policy_type": "ALARM", "scheduled_policy": { }}

Responsel Parameter description

Parameter Type Description

scaling_policy_id String Specifies the AS policyID.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 83

Page 88: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Example response{ "scaling_policy_id": "0h327883-324n-4dzd-9c61-68d03ee191dd" }

Returned Valuesl Normal

200l Abnormal

Returned Values Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username andpassword to access the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requestedpage.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the servercould not be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due toa conflict.

500 Internal Server Error Failed to complete the request because ofan internal service error.

501 Not Implemented Failed to complete the request becausethe server does not support the requestedfunction.

502 Bad Gateway Failed to complete the request becausethe request is invalid.

503 Service Unavailable Failed to complete the request becausethe system is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 84

Page 89: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

6.3 Modifying an AS Policy

Function

This interface is used to modify a specified AS policy.

URIl URI format

PUT /autoscaling-api/v1/{tenant_id}/scaling_policy/{scaling_policy_id}

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_policy_id Yes String Specifies the AS policy ID.

Requestl Parameter description

Parameter Mandatory

Type Description

scaling_policy_name No String Specifies the AS policy name.The name can contain letters,digits, underscores (_), andhyphens (-), and cannotexceed 64 characters.

scaling_policy_type No String Specifies the AS policy type.l ALARM (corresponding

to alarm_id): indicatesthat the scaling action istriggered by an alarm.

l SCHEDULED(corresponding toscheduled_policy):indicates that the scalingaction is triggered asscheduled.

l RECURRENCE(corresponding toscheduled_policy):indicates that the scalingaction is triggeredperiodically.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 85

Page 90: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

alarm_id No String Specifies the alarm rule ID.This parameter is mandatorywhen scaling_policy_type isset to ALARM. After thisparameter is specified, thevalue of scheduled_policydoes not take effect.After you modify an alarmpolicy, the systemautomatically adds an alarmtriggering activity of theautoscaling type to thealarm_actions field in thealarm rule specified by theparameter value.You can obtain the parametervalue by querying the CESalarm rule list. For details, seesection Querying Alarms inthe Cloud Eye API Reference.

scheduled_policy No Dictionarydatastructure

Specifies the periodic orscheduled AS policy. Thisparameter is mandatory whenscaling_policy_type is set toSCHEDULED orRECURRENCE. After thisparameter is specified, thevalue of alarm_id does nottake effect.

scaling_policy_action No Dictionarydatastructure

Specifies the scaling action ofthe AS policy.

cool_down_time No Integer Specifies the cooldown period(in seconds). The value rangesfrom 0 to 86400.

l scheduled_policy field data structure description

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 86

Page 91: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

launch_time No String Specifies the time when thescaling action is triggered.The time format complieswith UTC.l If scaling_policy_type is

set to SCHEDULED, thetime format is YYYY-MM-DDThh:mmZ.

l If scaling_policy_type isset to RECURRENCE,the time format is hh:mm.

recurrence_type No String Specifies the periodictriggering type. Thisparameter is mandatory whenscaling_policy_type is set toRECURRENCE.Daily: indicates that thescaling action is triggeredonce a day.Weekly: indicates that thescaling action is triggeredonce a week.Monthly indicates that thescaling action is triggeredonce a month.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 87

Page 92: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

recurrence_value No String Specifies the day when aperiodic scaling action istriggered. This parameter ismandatory whenscaling_policy_type is set toRECURRENCE.l If recurrence_type is set

to Daily, the value is null,indicating that the scalingaction is triggered once aday.

l If recurrence_type is setto Weekly, the valueranges from 1 (Sunday) to7 (Saturday). The digitsrefer to dates in each weekand separated by a comma,such as 1,3,5.

l If recurrence_type is setto Monthly, the valueranges from 1 to 31. Thedigits refer to the dates ineach month and separatedby a comma, such as1,10,13,28.

start_time No String Specifies the start time of thescaling action triggeredperiodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

end_time No String Specifies the end time of thescaling action triggeredperiodically. The time formatcomplies with UTC. Thisparameter is mandatory whenscaling_policy_type is set toRECURRENCE.When the scaling action istriggered periodically, the endtime cannot be earlier than thecurrent and start time.The time format is YYYY-MM-DDThh:mmZ.

l scaling_policy_action field data structure description

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 88

Page 93: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

operation No String Specifies the operation.ADD: adds specified numberof instances to the AS group.REMOVE: removes specifiednumber of instances from theAS group.SET: sets the number ofinstances in the AS group.

instance_number No Integer Specifies the number ofinstances to be operated.Either instance_number orinstance_percentage isrequired.

instance_percentage No Integer Indicates the percentage ofinstances to be operated. Youcan increase/decrease or setthe number of instances in anAS group to the specifiedpercentage of the currentnumber of instances.If neither instance_numbernor instance_percentage isspecified, the number ofinstances to be operated is 1.Either instance_number orinstance_percentage isrequired.

l Example request{ "scaling_policy_type": "RECURRENCE", "scaling_policy_name": "policy_01", "scheduled_policy": { "launch_time": "16:00", "recurrence_type": "Daily", "recurrence_value": null, "end_time": "2016-02-08T17:31Z", "start_time": "2016-01-08T17:31Z" }, "scaling_policy_action": { "operation": "SET", "instance_number": 2 }, "cool_down_time": 300}

Responsel Parameter description

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 89

Page 94: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

scaling_policy_id String Specifies the AS policy ID.

l Example response{ "scaling_policy_id": "0h327883-324n-4dzd-9c61-68d03ee191dd"}

Returned Valuel Normal

200l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 90

Page 95: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

6.4 Modifying an AS Policy (V2)

FunctionThis interface is used to modify a specified AS policy.

URIl URI format

PUT /autoscaling-api/v2/{tenant_id}/scaling_policy/{scaling_policy_id}l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_policy_id Yes String Specifies the ASpolicy ID.

Requestl Parameter description

Parameter Mandatory

Type Description

scaling_policy_name No String Specifies the AS policy name.The name can contain letters,digits, underscores (_), andhyphens (-), and cannot exceed64 characters.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 91

Page 96: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

scaling_policy_type No String Specifies the AS policy type.l ALARM (corresponding to

alarm_id): indicates thatthe scaling action istriggered by an alarm.

l SCHEDULED(corresponding toscheduled_policy):indicates that the scalingaction is triggered asscheduled.

l RECURRENCE(corresponding toscheduled_policy):indicates that the scalingaction is triggeredperiodically.

scaling_resource_id No String Specifies the scaling resourceID, which is the unique ID ofan AS group or bandwidth.

scaling_resource_type No string Specifies the scaling resourcetype.l AS group:

SCALING_GROUPl Bandwidth: BANDWIDTH

alarm_id No String Specifies the alarm rule ID.This parameter is mandatorywhen scaling_policy_type isset to ALARM. After thisparameter is specified, thevalue of scheduled_policydoes not take effect.After you modify an alarmpolicy, the systemautomatically adds an alarmtriggering activity of theautoscaling type to thealarm_actions field in thealarm rule specified by theparameter value.You can obtain the parametervalue by querying the CESalarm rule list. For details, seesection Querying Alarms inthe Cloud Eye API Reference.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 92

Page 97: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

scheduled_policy No Dictionarydata structure

Specifies the periodic orscheduled AS policy. Thisparameter is mandatory whenscaling_policy_type is set toSCHEDULED orRECURRENCE. After thisparameter is specified, thevalue of alarm_id does nottake effect.

scaling_policy_action No Dictionarydata structure

Specifies the scaling action ofthe AS policy.

cool_down_time No Integer Specifies the cooldown period(in seconds). The value rangesfrom 0 to 86400.

l scheduled_policy field data structure description

Parameter Mandatory

Type Description

launch_time No String Specifies the time when thescaling action is triggered. Thetime format complies with UTC.l If scaling_policy_type is set

to SCHEDULED, the timeformat is YYYY-MM-DDThh:mmZ.

l If scaling_policy_type is setto RECURRENCE, the timeformat is hh:mm.

recurrence_type No String Specifies the periodic triggeringtype. This parameter ismandatory whenscaling_policy_type is set toRECURRENCE.Daily: indicates that the scalingaction is triggered once a day.Weekly: indicates that the scalingaction is triggered once a week.Monthly indicates that thescaling action is triggered once amonth.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 93

Page 98: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

recurrence_value No String Specifies the day when a periodicscaling action is triggered. Thisparameter is mandatory whenscaling_policy_type is set toRECURRENCE.l If recurrence_type is set to

Daily, the value is null,indicating that the scalingaction is triggered once a day.

l If recurrence_type is set toWeekly, the value rangesfrom 1 (Sunday) to 7(Saturday). The digits refer todates in each week andseparated by a comma, suchas 1,3,5.

l If recurrence_type is set toMonthly, the value rangesfrom 1 to 31. The digits referto the dates in each month andseparated by a comma, suchas 1,10,13,28.

start_time No String Specifies the start time of thescaling action triggeredperiodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

end_time No String Specifies the end time of thescaling action triggeredperiodically. The time formatcomplies with UTC. Thisparameter is mandatory whenscaling_policy_type is set toRECURRENCE.When the scaling action istriggered periodically, the endtime cannot be earlier than thecurrent and start time.The time format is YYYY-MM-DDThh:mmZ.

l scaling_policy_action field data structure description

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 94

Page 99: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

operation No String Specifies the operation.ADD: indicates adding instances.REDUCE: indicates reducinginstances.SET: indicates setting the number ofinstances to a specified value.

size No Integer Specifies the operation size.If scaling_resource_type is set toSCALING_GROUP, this parameterindicates the number of instances. Thevalue is an integer from 0 to 300.If scaling_resource_type is set toBANDWIDTH, this parameterindicates the bandwidth (Mbit/s). Thevalue is an integer from 1 to 300.When scaling_resource_type is set toSCALING_GROUP, either size orpercentage can be set.

percentage No Integer Specifies the operation percentage. Thevalue is an integer ranging from 0 to20,000.When scaling_resource_type is set toSCALING_GROUP, either size orpercentage can be set.If scaling_resource_type is set toBANDWIDTH, instance_percentageis not configurable.

limits No Integer Specifies the operation restrictions.If scaling_resource_type is set toBANDWIDTH, this parameter takeseffect and the unit is Mbit/s.In this case:If operation is set to ADD, thisparameter indicates the maximumbandwidth.If operation is set to REDUCE, thisparameter indicates the minimumbandwidth.

l Example request

{ "alarm_id": "al1513822380493GvlJKZwA8",

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 95

Page 100: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"cool_down_time": 900, "scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6", "scaling_resource_type": "BANDWIDTH", "scaling_policy_action": { "size": 1, "operation": "ADD", "limits": 10 }, "scaling_policy_name": "hth_aspolicy_1", "scaling_policy_type": "ALARM", "scheduled_policy": { }}

Responsel Parameter description

Parameter Type Description

scaling_policy_id String Specifies the AS policyID.

l Example response{ "scaling_policy_id": "0h327883-324n-4dzd-9c61-68d03ee191dd" }

Returned Valuesl Normal

200

l Abnormal

Returned Values Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 96

Page 101: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Values Description

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

6.5 Querying AS Policies

Function

This interface is used to query information about AS policies. The results are filtered based onthe conditions you input and displayed by page.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_policy/{scaling_group_id}/list{?scaling_policy_name,scaling_policy_type,scaling_policy_id,start_number,limit}

NOTE

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiple searchcriteria. You can filter all non-mandatory parameters in the parameter description.

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_id Yes String Specifies the AS group ID.

scaling_policy_name

No String Specifies the AS policy name.

scaling_policy_type

No String Specifies the AS policy type.

scaling_policy_id No String Specifies the AS policy ID.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 97

Page 102: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

start_number No Integer Specifies the start line number.The default value is 0.

limit No Integer Specifies the total number ofquery records. The defaultvalue is 20 and the maximumvalue is 100.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

total_number Integer Specifies the total number of query records.

start_number Integer Specifies the start line number.

limit Integer Specifies the number of query records.

scaling_policies List datastructure

Specifies the AS policy list.

l scaling_policies field data structure description

Parameter Type Description

scaling_group_id String Specifies the AS group ID.

scaling_policy_name String Specifies the AS policy name.

policy_status String Specifies the AS policy status.l INSERVICE: indicates that the AS policy

is in use.l PAUSED: indicates that the AS policy is

disabled.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 98

Page 103: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

scaling_policy_type String Specifies the AS policy type.l ALARM: indicates that the scaling action

is triggered by an alarm. A value isreturned for alarm_id, and no value isreturned for scheduled_policy.

l SCHEDULED: indicates that the scalingaction is triggered as scheduled. A value isreturned for scheduled_policy, and novalue is returned for alarm_id,recurrence_type, recurrence_value,start_time, or end_time.

l RECURRENCE: indicates that thescaling action is triggered periodically.Values are returned for scheduled_policy,recurrence_type, recurrence_value,start_time, and end_time, and no value isreturned for alarm_id.

alarm_id String Specifies the alarm ID.

scheduled_policy Dictionarydatastructure

Specifies the periodic or scheduled AS policy.

scaling_policy_action

Dictionarydatastructure

Specifies the scaling action of the AS policy.

cool_down_time Integer Specifies the cooling duration (s).

create_time String Specifies the time when an AS policy iscreated. The time format complies with UTC.

l scheduled_policy field data structure description

Parameter Type Description

launch_time String Specifies the time when the scaling action istriggered. The time format complies withUTC.l If scaling_policy_type is set to

SCHEDULED, the time format is YYYY-MM-DDThh:mmZ.

l If scaling_policy_type is set toRECURRENCE, the time format ishh:mm.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 99

Page 104: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

recurrence_type String Specifies the type of a periodically triggeredscaling action.Daily: indicates that the scaling action istriggered once a day.Weekly: indicates that the scaling action istriggered once a week.Monthly indicates that the scaling action istriggered once a month.

recurrence_value String Specifies the frequency at which scalingactions are triggered.l If recurrence_type is set to Daily, the

value is null, indicating that the scalingaction is triggered once a day.

l If recurrence_type is set to Weekly, thevalue ranges from 1 (Sunday) to 7(Saturday). The digits refer to dates in eachweek and separated by a comma, such as1,3,5.

l If recurrence_type is set to Monthly, thevalue ranges from 1 to 31. The digits referto the dates in each month and separatedby a comma, such as 1,10,13,28.

start_time String Specifies the start time of the scaling actiontriggered periodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

end_time String Specifies the end time of the scaling actiontriggered periodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

l scaling_policy_action field data structure description

Parameter Type Description

operation String Specifies the scaling action.ADD: adds specified number of instances tothe AS group.REMOVE: removes specified number ofinstances from the AS group.SET: sets the number of instances in the ASgroup.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 100

Page 105: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

instance_number Integer Specifies the number of instances to beoperated.

instance_percentage Integer Specifies the percentage of instances to beoperated.

l Example response{ "limit": 20, "total_number": 1, "start_number": 0, "scaling_policies": [ { "scaling_group_id": "e5d27f5c-dd76-4a61-b4bc-a67c5686719a","scaling_policy_name": "Scheduled 1", "scaling_policy_type": "SCHEDULED", "scheduled_policy": { "launch_time": "2015-07-24T01:21Z" }, "cool_down_time": 300, "scaling_policy_action": { "operation": "REMOVE", "instance_number": 1 }, "policy_status": "INSERVICE", "create_time": "2015-07-24T01:09:30Z" } ]}

Returned Valuel Normal

200l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and passwordto access the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 101

Page 106: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

6.6 Querying AS Policies (V2)

Function

This interface is used to query information about AS policies. The results are filtered based onthe conditions you input and displayed by page.

URIl URI format

GET /autoscaling-api/v2/{tenant_id}/scaling_policy/{scaling_resource_id}/list{?scaling_policy_name,scaling_policy_type,scaling_policy_id,start_number,limit}

NOTE

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiple searchcriteria. You can filter all non-mandatory parameters in the parameter description.

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_resource_id Yes String Specifies the scaling resourceID.

scaling_policy_name No String Specifies the AS policy name.

scaling_policy_type No String Specifies the AS policy type.

scaling_policy_id No String Specifies the AS policy ID.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 102

Page 107: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

start_number No Integer Specifies the start line number.The default value is 0.

limit No Integer Specifies the total number ofquery records. The defaultvalue is 20 and the maximumvalue is 100.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

total_number Integer Specifies the total numberof query records.

start_number Integer Specifies the start linenumber.

limit Integer Specifies the number ofquery records.

scaling_policies List data structure Specifies the AS policylist.

l scaling_policies field data structure description

Parameter Type Description

scaling_policy_name

String Specifies the AS policy name.

scaling_policy_id String Specifies the AS policy ID.

scaling_resource_id String Specifies the scaling resource ID.

scaling_resource_type

string Specifies the scaling resource type.l AS group: SCALING_GROUPl Bandwidth: BANDWIDTH

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 103

Page 108: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

policy_status String Specifies the AS policy status.l INSERVICE: indicates that the AS policy

is in use.l PAUSED: indicates that the AS policy is

disabled.l EXECUTING: The task is in process.

scaling_policy_type String Specifies the AS policy type.l ALARM: indicates that the scaling action

is triggered by an alarm. A value isreturned for alarm_id, and no value isreturned for scheduled_policy.

l SCHEDULED: indicates that the scalingaction is triggered as scheduled. A value isreturned for scheduled_policy, and novalue is returned for alarm_id,recurrence_type, recurrence_value,start_time, or end_time.

l RECURRENCE: indicates that thescaling action is triggered periodically.Values are returned for scheduled_policy,recurrence_type, recurrence_value,start_time, and end_time, and no value isreturned for alarm_id.

alarm_id String Specifies the alarm ID.

scheduled_policy Dictionarydata structure

Specifies the periodic or scheduled AS policy.

scaling_policy_action

Dictionarydata structure

Specifies the scaling action of the AS policy.

cool_down_time Integer Specifies the cooling duration (s).

create_time String Specifies the time when an AS policy wascreated. The time format complies with UTC.

l scheduled_policy field data structure description

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 104

Page 109: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

launch_time String Specifies the time when the scaling action istriggered. The time format complies withUTC.l If scaling_policy_type is set to

SCHEDULED, the time format is YYYY-MM-DDThh:mmZ.

l If scaling_policy_type is set toRECURRENCE, the time format ishh:mm.

recurrence_type String Specifies the type of a periodically triggeredscaling action.Daily: indicates that the scaling action istriggered once a day.Weekly: indicates that the scaling action istriggered once a week.Monthly indicates that the scaling action istriggered once a month.

recurrence_value String Specifies the frequency at which scalingactions are triggered.l If recurrence_type is set to Daily, the

value is null, indicating that the scalingaction is triggered once a day.

l If recurrence_type is set to Weekly, thevalue ranges from 1 (Sunday) to 7(Saturday). The digits refer to dates in eachweek and separated by a comma, such as1,3,5.

l If recurrence_type is set to Monthly, thevalue ranges from 1 to 31. The digits referto the dates in each month and separated bya comma, such as 1,10,13,28.

start_time String Specifies the start time of the scaling actiontriggered periodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

end_time String Specifies the end time of the scaling actiontriggered periodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

l scaling_policy_action field data structure description

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 105

Page 110: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

operation String Specifies the scaling action.ADD: indicates adding instances.REDUCE: indicates reducing instances.SET: indicates setting the number of instancesto a specified value.

size Integer Specifies the number of instances to beoperated.

percentage Integer Specifies the percentage of instances to beoperated.

limits Integer Specifies the operation restrictions.

l Example response{ "limit": 20, "total_number": 3, "start_number": 0, "scaling_policies": [ { "scaling_policy_id": "803a35a5-38fb-4d27-a042-496c14bc1fb8", "scaling_policy_name": "as-policy-7a75", "scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6", "scaling_resource_type": "SCALING_GROUP", "scaling_policy_type": "RECURRENCE", "scheduled_policy": { "launch_time": "03:30", "recurrence_type": "Daily", "start_time": "2017-08-28T03:08Z", "end_time": "2017-09-01T03:08Z" }, "cool_down_time": 900, "scaling_policy_action": { "operation": "ADD", "size": 1 }, "policy_status": "INSERVICE", "create_time": "2017-08-31T03:02:41Z" }, { "scaling_policy_id": "535fd67e-276b-409c-879e-52f4e09e14bb", "scaling_policy_name": "as-policy-7a75", "scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6", "scaling_resource_type": "SCALING_GROUP", "scaling_policy_type": "RECURRENCE", "scheduled_policy": { "launch_time": "21:30", "recurrence_type": "Daily", "start_time": "2017-08-27T21:08Z", "end_time": "2017-08-31T21:08Z" }, "cool_down_time": 900, "scaling_policy_action": { "operation": "ADD", "size": 1 }, "policy_status": "INSERVICE", "create_time": "2017-08-31T07:35:05Z" }, {

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 106

Page 111: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"scaling_policy_id": "37df92f8-73cb-469e-a420-c15f445d2ee1", "scaling_policy_name": "as-policy-7a75", "scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6", "scaling_resource_type": "SCALING_GROUP", "scaling_policy_type": "RECURRENCE", "scheduled_policy": { "launch_time": "22:30", "recurrence_type": "Daily", "start_time": "2017-08-27T22:08Z", "end_time": "2017-08-31T22:08Z" }, "cool_down_time": 900, "scaling_policy_action": { "operation": "ADD", "size": 1 }, "policy_status": "INSERVICE", "create_time": "2017-08-31T07:41:06Z" } ]}

Returned Valuesl Normal

200l Abnormal

Returned Values Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and passwordto access the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 107

Page 112: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Values Description

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

6.7 Querying AS Policy Details

Function

This interface is used to query details about a specified AS policy.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_policy/{scaling_policy_id}l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_policy_id Yes String Specifies the AS policyID.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

scaling_policy Dictionarydata structure

Specifies details about the AS policy.

l scaling_policy field data structure description

Parameter Type Description

scaling_group_id String Specifies the AS group ID.

scaling_policy_name String Specifies the AS policy name.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 108

Page 113: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

scaling_policy_id String Specifies the AS policy ID.

policy_status String Specifies the AS policy status.l INSERVICE: indicates that the AS policy

is in use.l PAUSED: indicates that the AS policy is

disabled.

scaling_policy_type String Specifies the AS policy type.l ALARM: indicates that the scaling action

is triggered by an alarm. A value isreturned for alarm_id, and no value isreturned for scheduled_policy.

l SCHEDULED: indicates that the scalingaction is triggered as scheduled. A value isreturned for scheduled_policy, and novalue is returned for alarm_id,recurrence_type, recurrence_value,start_time, or end_time.

l RECURRENCE: indicates that thescaling action is triggered periodically.Values are returned for scheduled_policy,recurrence_type, recurrence_value,start_time, and end_time, and no value isreturned for alarm_id.

alarm_id String Specifies the alarm ID.

scheduled_policy Dictionarydata structure

Specifies the periodic or scheduled AS policy.

scaling_policy_action

Dictionarydata structure

Specifies the scaling action of the AS policy.

cool_down_time Integer Specifies the cooling duration (s).

create_time String Specifies the time when an AS policy iscreated. The time format complies with UTC.

l scheduled_policy field data structure description

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 109

Page 114: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

launch_time String Specifies the time when the scaling action istriggered. The time format complies withUTC.l If scaling_policy_type is set to

SCHEDULED, the time format is YYYY-MM-DDThh:mmZ.

l If scaling_policy_type is set toRECURRENCE, the time format ishh:mm.

recurrence_type String Specifies the type of a periodically triggeredscaling action.Daily: indicates that the scaling action istriggered once a day.Weekly: indicates that the scaling action istriggered once a week.Monthly indicates that the scaling action istriggered once a month.

recurrence_value String Specifies the frequency at which scalingactions are triggered.l If recurrence_type is set to Daily, the

value is null, indicating that the scalingaction is triggered once a day.

l If recurrence_type is set to Weekly, thevalue ranges from 1 (Sunday) to 7(Saturday). The digits refer to dates in eachweek and separated by a comma, such as1,3,5.

l If recurrence_type is set to Monthly, thevalue ranges from 1 to 31. The digits referto the dates in each month and separatedby a comma, such as 1,10,13,28.

start_time String Specifies the start time of the scaling actiontriggered periodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

end_time String Specifies the end time of the scaling actiontriggered periodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

l scaling_policy_action field data structure description

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 110

Page 115: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

operation String Specifies the scaling action.ADD: adds specified number of instances tothe AS group.REMOVE: removes specified number ofinstances from the AS group.SET: sets the number of instances in the ASgroup.

instance_number Integer Specifies the number of instances to beoperated.

instance_percentage Integer Specifies the percentage of instances to beoperated.

l Example response{ "scaling_policy": { "scaling_policy_id": "fd7d63ce-8f5c-443e-b9a0-bef9386b23b3", "scaling_group_id": "e5d27f5c-dd76-4a61-b4bc-a67c5686719a","scaling_policy_name": "Scheduled 1", "scaling_policy_type": "SCHEDULED", "scheduled_policy": { "launch_time": "2015-07-24T01:21Z" }, "cool_down_time": 300, "scaling_policy_action": { "operation": "REMOVE", "instance_number": 1 }, "policy_status": "INSERVICE", "create_time": "2015-07-24T01:09:30Z" }}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 111

Page 116: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

6.8 Querying Details of an AS Policy (V2)

FunctionThis interface is used to query details about a specified AS policy.

URIl URI format

GET /autoscaling-api/v2/{tenant_id}/scaling_policy/{scaling_policy_id}l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_policy_id Yes String Specifies the ASpolicy ID.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 112

Page 117: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

scaling_policy Dictionary datastructure

Specifies details about the AS policy.

l scaling_policy field data structure description

Parameter Type Description

scaling_resource_id String Specifies the scaling resource ID.

scaling_resource_type

string Specifies the scaling resource type.l AS group: SCALING_GROUPl Bandwidth: BANDWIDTH

scaling_policy_name

String Specifies the AS policy name.

scaling_policy_id String Specifies the AS policy ID.

policy_status String Specifies the AS policy status.l INSERVICE: indicates that the AS policy

is in use.l PAUSED: indicates that the AS policy is

disabled.l EXECUTING: The task is in process.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 113

Page 118: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

scaling_policy_type String Specifies the AS policy type.l ALARM: indicates that the scaling action

is triggered by an alarm. A value isreturned for alarm_id, and no value isreturned for scheduled_policy.

l SCHEDULED: indicates that the scalingaction is triggered as scheduled. A value isreturned for scheduled_policy, and novalue is returned for alarm_id,recurrence_type, recurrence_value,start_time, or end_time.

l RECURRENCE: indicates that thescaling action is triggered periodically.Values are returned for scheduled_policy,recurrence_type, recurrence_value,start_time, and end_time, and no value isreturned for alarm_id.

alarm_id String Specifies the alarm ID.

scheduled_policy Dictionarydata structure

Specifies the periodic or scheduled AS policy.

scaling_policy_action

Dictionarydata structure

Specifies the scaling action of the AS policy.

cool_down_time Integer Specifies the cooldown period (s).

create_time String Specifies the time when an AS policy wascreated. The time format complies with UTC.

meta_data Dictionarydata structure

Provides additional information.

l scheduled_policy field data structure description

Parameter Type Description

launch_time String Specifies the time when the scaling action istriggered. The time format complies withUTC.l If scaling_policy_type is set to

SCHEDULED, the time format is YYYY-MM-DDThh:mmZ.

l If scaling_policy_type is set toRECURRENCE, the time format ishh:mm.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 114

Page 119: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

recurrence_type String Specifies the type of a periodically triggeredscaling action.Daily: indicates that the scaling action istriggered once a day.Weekly: indicates that the scaling action istriggered once a week.Monthly indicates that the scaling action istriggered once a month.

recurrence_value String Specifies the frequency at which scalingactions are triggered.l If recurrence_type is set to Daily, the

value is null, indicating that the scalingaction is triggered once a day.

l If recurrence_type is set to Weekly, thevalue ranges from 1 (Sunday) to 7(Saturday). The digits refer to dates in eachweek and separated by a comma, such as1,3,5.

l If recurrence_type is set to Monthly, thevalue ranges from 1 to 31. The digits referto the dates in each month and separated bya comma, such as 1,10,13,28.

start_time String Specifies the start time of the scaling actiontriggered periodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

end_time String Specifies the end time of the scaling actiontriggered periodically. The time formatcomplies with UTC.The time format is YYYY-MM-DDThh:mmZ.

l scaling_policy_action field data structure description

Parameter Type Description

operation String Specifies the scaling action.ADD: indicates adding instances.REDUCE: indicates reducing instances.SET: indicates setting the number of instancesto a specified value.

size Integer Specifies the operation size.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 115

Page 120: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

percentage Integer Specifies the percentage of instances to beoperated.

limits Integer Specifies the operation restrictions.

l meta_data field data structure description

Parameter Type Description

Additional fieldkey-value pair

String Specifies the key and value of the metadata.

l Example response{ "scaling_policy": { "scaling_policy_id": "906f73ff-56e8-41b2-a005-8157d0c60361", "scaling_policy_name": "hth_aspolicy_1", "scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6", "scaling_resource_type": "BANDWIDTH", "scaling_policy_type": "ALARM", "alarm_id": "al1513822380493GvlJKZwA8", "scheduled_policy": { }, "cool_down_time": 900, "scaling_policy_action": { "operation": "ADD", "size": 1, "limits": 111 }, "policy_status": "INSERVICE", "create_time": "2018-03-21T08:03:35Z", "meta_data": { "metadata_eip_id": "263f0886-de6a-4e21-ad83-814ca9f3844e", "metadata_eip_address": "255.255.255.255" } }}

Returned Valuesl Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 116

Page 121: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

6.9 Executing, Enabling, or Disabling an AS Policy

Function

This interface is used to immediately execute, enable, or disable a specified AS policy.

An AS policy can be executed only when the AS group and AS policy are in theINSERVICE state. Otherwise, the execution fails.

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_policy/{scaling_policy_id}/actionl Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_policy_id Yes String Specifies the ASpolicy ID.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 117

Page 122: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Requestl Parameter description

Parameter

Mandatory Type Description

action Yes String Specifies the operation flagfor an AS group.l execute: executes the AS

group.l resume: enables the AS

group.l pause: disables the AS

group.

l Example request{ "action": "execute"}

Responsel Example response

None

Returned Valuel Normal

204

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 118

Page 123: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

6.10 Deleting an AS Policy

Function

This interface is used to delete a specified AS policy.

URIl URI format

DELETE /autoscaling-api/v1/{tenant_id}/scaling_policy/{scaling_policy_id}

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_policy_id Yes String Specifies the ASpolicy ID.

Requestl Example request

None

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 119

Page 124: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Responsel Example response

None

Returned Valuesl Normal

204l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 120

Page 125: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

6.11 Performing Operations on AS Policies in Batches

Function

This interface is used to enable, disable, or delete AS policies in batches.

A batch operation can be performed on a maximum of 20 AS policies at a time.

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_policies/action

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

Requestl Parameter description

Parameter Mandatory

Type Description

scaling_policy_id

Yes List<String> Specifies the AS policy ID.

force_delete No String Specifies whether to forcibly deleteAS policies. The value can be yes orno (default).This parameter is available only whenaction is set to delete.

action Yes String Specifies an action to be performed onAS policies in batches. The optionsare as follows:l delete: deletes AS policies.l resume: enables AS policies.l pause: disables AS policies.

l Example request{ "action": "resume", "scaling_policy_id": [ "policy_id1", "policy_id2" ]}

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 121

Page 126: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Responsel Example response

None

Returned Valuesl Normal

204l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 6 AS Policies

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 122

Page 127: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

7 AS Policy Execution Logs

7.1 Querying AS Policy Execution Logs

Function

This interface is used to query execution records of an AS policy. The results are filteredbased on the conditions you input and displayed by page.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_policy_execute_log/{scaling_policy_id}{?start_time,end_time,start_number,limit,log_id,scaling_resource_type,scaling_resource_id,execute_type}

NOTE

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiple searchcriteria. You can filter all non-mandatory parameters in the parameter description.

l Parameter description

Parameter Mandatory

Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_policy_id Yes String Specifies the AS policy ID.

log_id No String Specifies the log ID.

scaling_resource_type

No String Specifies the scaling resource type.l AS group: SCALING_GROUPl Bandwidth: BANDWIDTH

scaling_resource_id No String Specifies the scaling resource ID.

Auto ScalingAPI Reference 7 AS Policy Execution Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 123

Page 128: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

execute_type No String Specifies the AS policy executiontype.SCHEDULED: automaticallytriggered at a specified time pointRECURRENCE: automaticallytriggered at a specified time periodALARM: alarm-triggeredMANUAL: manually triggered

start_time No String Specifies the start time for queryingscaling action logs. The format ofthe start time is yyyy-MM-ddThh:mm:ssZ.

end_time No String Specifies the end time for queryingscaling action logs. The format ofthe end time is yyyy-MM-ddThh:mm:ssZ.

start_number No Integer Specifies the start line number. Thedefault value is 0.

limit No Integer Specifies the total number of queryrecords. The default value is 20 andthe maximum value is 100.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

total_number Integer Specifies the total numberof query records.

start_number Integer Specifies the start linenumber.

limit Integer Specifies the number ofquery records.

scaling_policy_execute_log

List data structure Specifies the logs of ASpolicy execution.

Auto ScalingAPI Reference 7 AS Policy Execution Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 124

Page 129: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l scaling_policy_execute_log field data structure description

Parameter Type Description

status String Specifies the AS policy execution status.SUCCESS: indicates that the AS policy issuccessfully executed.FAIL: indicates that the AS policy failed to beexecuted.EXECUTING: The task is in process.

failed_reason String Specifies the AS policy execution failure.

execute_type String Specifies the AS policy execution type.SCHEDULE: automatically triggered at aspecified time pointRECURRENCE: automatically triggered at aspecified time periodALARM: alarm-triggeredMANUAL: manually triggered

execute_time String Specifies the time when an AS policy isexecuted. The time format complies with UTC.

id String Specifies the ID of an AS policy execution log.

tenant_id String Specifies the tenant ID.

scaling_policy_id String Specifies the AS policy ID.

scaling_resource_type String Specifies the scaling resource type.l AS group: SCALING_GROUPl Bandwidth: BANDWIDTH

scaling_resource_id String Specifies the scaling resource ID.

old_value String Specifies the source value.

desire_value String Specifies the target value.

limit_value Integer Specifies the operation restrictions.When scaling_resource_type is set toBANDWIDTH and operation is not SET, thisparameter takes effect and the unit is Mbit/s.In this case:l If operation is set to ADD, this parameter

indicates the maximum bandwidth.l If operation is set to REDUCE, this

parameter indicates the minimum bandwidth.

Auto ScalingAPI Reference 7 AS Policy Execution Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 125

Page 130: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

type String Specifies the AS policy execution type.ADD: indicates adding instances.REMOVE: indicates reducing instances.SET: indicates setting the number of instances toa specified value.

job_records List datastructure

Specifies the tasks contained in a scaling actionbased on an AS policy.

meta_data Dictionary datastructure

Provides additional information.

l job_records field data structure description

Parameter Type Description

job_name String Specifies the task name.

record_type String Specifies the record type.API: API calling typeMEG: message type

record_time String Specifies the record time.

request String Specifies the request body. This parameter isvalid only if record_type is set to API.

response String Specifies the response body. This parameter isvalid only if record_type is set to API.

code Integer Specifies the returned code. This parameter isvalid only if record_type is set to API.

message String Specifies the message. This parameter is validonly if record_type is set to MEG.

job_status String Specifies the execution status of the task.SUCCESS: The task is successfully executed.FAIL: The task failed to be executed.

l meta_data field data structure description

Parameter Type Description

User-defined fieldkey pair

String Specifies the key and value of the metadata.

l Example response

{ "limit": 10,

Auto ScalingAPI Reference 7 AS Policy Execution Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 126

Page 131: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"scaling_policy_execute_log": [{ "id": "6c0a50f6-1dcc-4734-9008-a000f73a4d2c", "status": "SUCCESS", "type": "ADD", "tenant_id": "5a3563ad5f124b97925c206547cb7319", "scaling_resource_type": "BANDWIDTH", "scaling_resource_id": "5a49dbcd-8511-4890-81fd-a330b90373d1", "scaling_policy_id": "c880d2ac-2a25-4971-a4e3-6ce85c659734", "old_value": "5", "desire_value": "6", "limit_value": "10", "execute_time": "2018-07-30T07:46:05Z", "execute_type": "MANUAL", "job_records": [{ "response": "{\"bandwidth\":{\"tenant_id\":\"5a3563ad5f124b97925c206547cb7319\",\"size\":5,\"share_type\":\"PER\",\"bandwidth_type\":\"bgp\",\"publicip_info\":[{\"publicip_id\":\"a617fb2b-c059-437b-bbd8-2689a29c565f\",\"ipVersion\":4,\"publicip_type\":\"5_bgp\",\"publicip_address\":\"10.154.112.214\"}],\"name\":\"bandwidth-22e7\",\"charge_mode\":\"bandwidth\",\"id\":\"5a49dbcd-8511-4890-81fd-a330b90373d1\"}}", "code": "OK (200) - The request has succeeded", "job_name": "QUERY_CURRENT_BANDWIDTH", "record_type": "API", "record_time": "2018-07-30T07:46:06Z", "job_status": "SUCCESS" }, { "request": "{\"bandwidth\":{\"size\":6}}", "response": "{\"bandwidth\":{\"tenant_id\":\"5a3563ad5f124b97925c206547cb7319\",\"size\":6,\"share_type\":\"PER\",\"bandwidth_type\":\"bgp\",\"publicip_info\":[{\"publicip_id\":\"a617fb2b-c059-437b-bbd8-2689a29c565f\",\"ipVersion\":4,\"publicip_type\":\"5_bgp\",\"publicip_address\":\"10.154.112.214\"}],\"name\":\"bandwidth-22e7\",\"charge_mode\":\"bandwidth\",\"id\":\"5a49dbcd-8511-4890-81fd-a330b90373d1\"}}", "code": "OK (200) - The request has succeeded", "job_name": "ADJUST_BANDWIDTH", "record_type": "API", "record_time": "2018-07-30T07:46:07Z", "job_status": "SUCCESS" }], "meta_data": { "metadata_eip_id": "a617fb2b-c059-437b-bbd8-2689a29c565f", "metadata_eip_address": "10.154.112.214" } }], "total_number": 1, "start_number": 0}

Returned Valuesl Normal

200

l Abnormal

Returned Values Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requested page.

Auto ScalingAPI Reference 7 AS Policy Execution Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 127

Page 132: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Values Description

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

l

l

l

Auto ScalingAPI Reference 7 AS Policy Execution Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 128

Page 133: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

8 Scaling Action Logs

8.1 Querying Scaling Action Logs

Function

This interface is used to query scaling action logs. The results are filtered based on theconditions you input and displayed by page.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_activity_log/{scaling_group_id}{?start_time,end_time,start_number,limit}

NOTE

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiple searchcriteria. You can filter all non-mandatory parameters in the parameter description.

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_id Yes String Specifies the AS group ID.

start_time No String Specifies the start time for queryingscaling action logs. The format ofthe start time is yyyy-MM-ddThh:mm:ssZ.

end_time No String Specifies the end time for queryingscaling action logs. The format ofthe end time is yyyy-MM-ddThh:mm:ssZ.

start_number No Integer Specifies the start line number. Thedefault value is 0.

Auto ScalingAPI Reference 8 Scaling Action Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 129

Page 134: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

limit No Integer Specifies the total number of queryrecords. The default value is 20 andthe maximum value is 100.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

total_number Integer Specifies the total numberof query records.

start_number Integer Specifies the start linenumber.

limit Integer Specifies the number ofquery records.

scaling_activity_log List data structure Specifies the scalingaction log list.

l scaling_activity_log field data structure description

Parameter Type Description

status String Specifies the status of the scaling action.SUCCESS: indicates the scaling action issuccessfully performed.FAIL: indicates the action failed to be performed.DOING: indicates the scaling action is beingperformed.

start_time String Specifies the start time of the scaling action. Thetime format must comply with UTC.

end_time String Specifies the end time of the scaling action. Thetime format must comply with UTC.

id String Specifies the scaling action log ID.

instance_removed_list String Specifies the name list of the instances removedfrom the AS group after the scaling action iscomplete. The instance names are separated bycommas (,).

Auto ScalingAPI Reference 8 Scaling Action Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 130

Page 135: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

instance_deleted_list String Specifies the name list of the instances deletedfrom the AS group and deleted after the scalingaction is complete. The instance names areseparated by commas (,).

instance_added_list String Specifies the name list of the instances added tothe AS group after the scaling action is complete.The instance names are separated by commas (,).

scaling_value String Specifies the number of added or deletedinstances during the scaling.

description String Specifies the description of the scaling action.

instance_value Integer Specifies the number of instances in the ASgroup.

desire_value Integer Specifies the expected number of instances in thescaling action.

l Example response{ "limit": 20, "scaling_activity_log": [ { "id": "a8924393-1024-4c24-8ac6-e4d481360884", "status": "SUCCESS", "description": "{\"reason\":[{\"change_reason\":\"SCHEDULED\",\"old_value\":1,\"change_time\":\"2015-07-24T01:21:00Z\",\"new_value\":0}]}", "instance_value": 1, "desire_value": 0, "start_time": "2015-07-24T01:21:02Z", "end_time": "2015-07-24T01:23:31Z", "instance_name_list": "discuz_446E0983" }, { "id": "423bbb2d-043c-4afe-8754-03e418a6ac42", "status": "SUCCESS", "description": "{\"reason\":[{\"change_reason\":\"DIFF\",\"old_value\":0,\"scaling_policy_name\":\"policy_for_test\",\"scaling_policy_id\":\"f8924393-1024-4c24-8ac6-e4d481360856\",\"change_time\":\"2015-07-23T15:11:52Z\",\"new_value\":1}]}", "instance_value": 0, "desire_value": 1, "start_time": "2015-07-23T15:11:52Z", "end_time": "2015-07-23T15:16:30Z", "instance_name_list": "discuz_446E0983" } ], "total_number": 2, "start_number": 0}

Returned Valuel Normal

200

l Abnormal

Auto ScalingAPI Reference 8 Scaling Action Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 131

Page 136: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 8 Scaling Action Logs

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 132

Page 137: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

9 Quotas

9.1 Querying AS Quotas

Function

This interface is used to query the total quota and used quota of AS groups and ASconfigurations for a specified tenant.

In addition, this interface is also used to query the total number of AS policies and ASinstances of a specified tenant.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/quotasl Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

quotas Dictionary datastructure

Specifies the configuration details.

Auto ScalingAPI Reference 9 Quotas

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 133

Page 138: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l quotas field data structure description

Parameter Type Description

resources List data structure Specifies the resource list.

l resources field data structure description

Parameter Type Description

type String Specifies the quota type.l scaling_Group: AS

group quotal scaling_Config: AS

configuration quotal scaling_Policy: AS

policy quotal scaling_Instance:

instance quotal bandwidth_scaling_p

olicy: AS bandwidthpolicy quota

used Integer Specifies the used amountof the quota.When type is set toscaling_Policy orscaling_Instance, thisparameter is reserved, andthe system returns -1 asthe parameter value. Youcan query the used quotaof AS policies and ASinstances in a specified ASgroup. For details, see 9.2Querying Quotas for ASPolicies and ASInstances.

quota Integer Specifies the total amountof the quota.

max Integer Specifies the quota upperlimit.

l Example response

{ "quotas": { "resources": [ { "type": "scaling_Group", "used": 2, "quota": 25,

Auto ScalingAPI Reference 9 Quotas

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 134

Page 139: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"max": 50 }, { "type": "scaling_Config", "used": 3, "quota": 100, "max": 200 }, { "type": "scaling_Policy", "used": -1, "quota": 50, "max": 50 }, { "type": "scaling_Instance", "used": -1, "quota": 200, "max": 1000 }, { "type": "bandwidth_scaling_policy", "used": 1, "quota": 10, "max": 100 } ] }}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

Auto ScalingAPI Reference 9 Quotas

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 135

Page 140: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

9.2 Querying Quotas for AS Policies and AS Instances

Function

This interface is used to query the total quota and used quota of AS policies and AS instancesof a specified AS group.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/quotas/{scaling_group_id}l Parameter description

Parameter Mandatory

Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_id Yes String Specifies the AS group ID.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

quotas Dictionary data structure Specifies the configurationdetails.

Auto ScalingAPI Reference 9 Quotas

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 136

Page 141: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l quotas field data structure description

Parameter Type Description

resources List data structure Specifies the resource list.

l resources field data structure description

Parameter Type Description

type String Specifies the quota type.

used Integer Specifies the used amountof the quota.

quota Integer Specifies the total amountof the quota.

max Integer Specifies the quota upperlimit.

l Example response{ "quotas": { "resources": [ { "type": "scaling_Policy", "used": 2, "quota": 50, "max": 50 }, { "type": "scaling_Instance", "used": 0, "quota": 200, "max": 1000 } ] }}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

Auto ScalingAPI Reference 9 Quotas

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 137

Page 142: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 9 Quotas

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 138

Page 143: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

10 Notifications

10.1 Enabling Notification for an AS Group

Function

This interface is used to enable notification for an AS group. Each time this interface is called,the AS group adds a notification topic and scenario. Each AS group supports up to five topics.The notification topic is pre-configured by you in SMN. When the live network complies withthe notification scenario that matches the notification topic, the AS group sends a notificationto you.

URIl URI format

PUT /autoscaling-api/v1/{tenant_id}/scaling_notification/{scaling_group_id}

l Parameter description

Name Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

Requestl Parameter description

Name Mandatory

Type Description

topic_urn Yes String Specifies a unified topic in SMN.

Auto ScalingAPI Reference 10 Notifications

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 139

Page 144: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Name Mandatory

Type Description

topic_scene Yes List<String> Specifies a notification scenario,which can be one of the following:SCALING_UP: indicates that thecapacity is expanded.SCALING_UP_FAIL: indicates thatthe capacity expansion failed.SCALING_DOWN: indicates thatthe capacity is reduced.SCALING_DOWN_FAIL: indicatesthat the capacity reduction failed.SCALING_GROUP_ABNORMAL: indicates that an exception hasoccurred in the AS group.

l Example request{ "topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:gsh", "topic_scene": [ "SCALING_UP","SCALING_UP_FAIL","SCALING_DOWN","SCALING_DOWN_FAIL","SCALING_GROUP_ABNORMAL" ]}

Responsel Parameter description

Name Type Description

topic_urn String Specifies a unified topic in SMN.

topic_scene List<String> Specifies a notification scenario, whichcan be one of the following:SCALING_UP: indicates that thecapacity is expanded.SCALING_UP_FAIL: indicates that thecapacity expansion failed.SCALING_DOWN: indicates that thecapacity is reduced.SCALING_DOWN_FAIL: indicatesthat the capacity reduction failed.SCALING_GROUP_ABNORMAL:indicates that an exception has occurredin the AS group.

topic_name String Specifies the topic name in SMN.

Auto ScalingAPI Reference 10 Notifications

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 140

Page 145: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Example response{ "topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:gsh", "topic_scene": [ "SCALING_UP","SCALING_UP_FAIL","SCALING_DOWN","SCALING_DOWN_FAIL","SCALING_GROUP_ABNORMAL" ], "topic_name": "gsh"}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 10 Notifications

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 141

Page 146: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

10.2 Querying an AS Group Notification List

FunctionThis interface is used to query an AS group notification list.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_notification/{scaling_group_id}l Parameter description

Name Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

Requestl Example request

None

Responsel Parameter description

Name Type Description

topics List data structure Specifies the AS groupnotification list.

l topics field data structure description

Name Type Description

topic_urn String Specifies a unified topic in SMN.

Auto ScalingAPI Reference 10 Notifications

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 142

Page 147: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Name Type Description

topic_scene List<String> Specifies a notification scenario, whichcan be one of the following:SCALING_UP: indicates that thecapacity is expanded.SCALING_UP_FAIL: indicates that thecapacity expansion failed.SCALING_DOWN: indicates that thecapacity is reduced.SCALING_DOWN_FAIL: indicatesthat the capacity reduction failed.SCALING_GROUP_ABNORMAL:indicates that an exception has occurredin the AS group.

topic_name String Specifies the topic name in SMN.

l Example response{ "topics":[ { "topic_name": "gsh", "topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:gsh", "topic_scene": [ "SCALING_UP","SCALING_UP_FAIL","SCALING_DOWN","SCALING_DOWN_FAIL","SCALING_GROUP_ABNORMAL" ]}, { "topic_name": "asdf", "topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:asdf", "topic_scene": [ "SCALING_UP","SCALING_UP_FAIL" ]},]}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

Auto ScalingAPI Reference 10 Notifications

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 143

Page 148: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

10.3 Deleting a Notification for an AS Group

Function

This interface is used to delete a notification for a specified AS group.

URIl URI format

DELETE /autoscaling-api/v1/{tenant_id}/scaling_notification/{scaling_group_id}/{topic_urn}

l Parameter description

Name Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

Auto ScalingAPI Reference 10 Notifications

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 144

Page 149: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Name Mandatory Type Description

topic_urn Yes String Specifies a unifiedtopic in SMN.

Requestl Example request

None

Responsel Example response

None

Returned Valuel Normal

204l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server couldnot be accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requestedfunction.

Auto ScalingAPI Reference 10 Notifications

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 145

Page 150: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 10 Notifications

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 146

Page 151: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

11 Lifecycle Hook

11.1 Creating a Lifecycle Hook

Function

This interface is used to create a lifecycle hook for an AS group. Up to five lifecycle hookscan be created for one AS group.

After the creation, when the AS group performs a scaling action, the lifecycle hook suspendsthe target instance and sets it to be in Wait (Adding to AS group) or Wait (Removing fromAS group) status. This status retains until the timeout duration expires or you manually callback this status.

During the instance waiting duration, you can perform customized operations. For example,you can install or configure software on a newly started instance, or download the log filefrom the instance before the instance terminates.

URIl URI format

POST /autoscaling-api/v1/{tenant_id}/scaling_lifecycle_hook/{scaling_group_id}

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

Requestl Parameter description

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 147

Page 152: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

lifecycle_hook_name

Yes String Specifies the lifecycle hook name. Thename can contain letters, digits,underscores (_), and hyphens (-), andmust be between 1 and 32 characters inlength.

lifecycle_hook_type

Yes String Specifies the lifecycle hook type.INSTANCE_TERMINATINGINSTANCE_LAUNCHINGThe INSTANCE_TERMINATING hooksuspends an instance when the instanceterminates. TheINSTANCE_LAUNCHING hooksuspends an instance when the instancestarts.

default_result No String Specifies the default lifecycle hookcallback operation. By default, thisoperation is performed when the timeoutduration expires.ABANDONCONTINUEIf an instance is starting, CONTINUEindicates that your customized operationsare successful and the instance can beused. ABANDON indicates that yourcustomized operations failed, and theinstance will be terminated. In such acase, the scaling action fails, and youmust create a new instance.If an instance is stopping, bothABANDON and CONTINUE allowinstance termination. The differencebetween the two states is as follows:ABANDON stops other lifecycle hooks,but CONTINUE allows the completionof other lifecycle hooks.The default value of this field isABANDON.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 148

Page 153: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

default_timeout

No Integer Specifies the lifecycle hook timeoutduration, which ranges from 300 to 86400in the unit of second. The default value is3600.By default, this parameter specifies theinstance waiting duration. You canprolong the timeout duration or performthe CONTINUE or ABANDONoperation before the timeout durationexpires.

notification_topic_urn

Yes String Specifies a unique topic in SMN.This parameter specifies a notificationobject for a lifecycle hook. When aninstance is suspended by the lifecyclehook, the SMN service sends anotification to the object. Thisnotification contains the basic instanceinformation, your customized notificationcontent, and the token for controllinglifecycle operations.

notification_metadata

No String Specifies a customized notification,which contains no more than 256characters in length. The message cannotcontain the following characters: < > &' ( )After a notification object is configured,the SMN service sends your customizednotification to the object.

l Example request{ "lifecycle_hook_name": "test-hook1", "default_result": "ABANDON", "default_timeout": 3600, "notification_topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:gsh", "lifecycle_hook_type": "INSTANCE_LAUNCHING"}

Responsel Parameter description

Parameter Type Description

lifecycle_hook_name String Specifies the lifecycle hook name.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 149

Page 154: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

lifecycle_hook_type String Specifies the lifecycle hook type.INSTANCE_TERMINATINGINSTANCE_LAUNCHING

default_result String Specifies the default lifecycle hook callbackoperation.ABANDONCONTINUE

default_timeout Integer Specifies the lifecycle hook timeout durationin the unit of second.

notification_topic_urn String Specifies a unique topic in SMN.

notification_topic_name

String Specifies the topic name in SMN.

notification_metadata String Specifies the customized notification.

l Example response{ "lifecycle_hook_name": "test-hook1", "default_result": "ABANDON", "default_timeout": 3600, "notification_topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:gsh", "notification_topic_name": "gsh", "lifecycle_hook_type": "INSTANCE_LAUNCHING", "notification_metadata": null}

Returned Valuel Normal

200l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 150

Page 155: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

11.2 Querying Lifecycle Hooks

Function

This interface is used to query lifecycle hooks.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_lifecycle_hook/{scaling_group_id}/list

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

Requestl Example request

None

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 151

Page 156: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Responsel Parameter description

Parameter Type Description

lifecycle_hooks List data structure Specifies lifecycle hooks.

l lifecycle_hooks field data structure description

Parameter Type Description

lifecycle_hook_name String Specifies the lifecycle hook name.

lifecycle_hook_type String Specifies the lifecycle hook type.INSTANCE_TERMINATINGINSTANCE_LAUNCHING

default_result String Specifies the default lifecycle hook callbackoperation.ABANDONCONTINUE

default_timeout Integer Specifies the lifecycle hook timeout duration inthe unit of second.

notification_topic_urn String Specifies a unique topic in SMN.

notification_topic_name

String Specifies the topic name in SMN.

notification_metadata String Specifies the customized notification.

create_time String Specifies the time when the lifecycle hook iscreated. The time is UTC-compliant.

l Example response{ "lifecycle_hooks": [ { "lifecycle_hook_name": "test-hook1", "default_result": "ABANDON", "default_timeout": 3600, "notification_topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:gsh", "notification_topic_name": "gsh", "lifecycle_hook_type": "INSTANCE_LAUNCHING", "notification_metadata": null, "create_time": "2016-11-18T04:01:34Z" }, { "lifecycle_hook_name": "test-hook2", "default_result": "CONTINUE", "default_timeout": 300, "notification_topic_urn": "urn:smn:regionId:a5b95554fad0494d94596fb84296510b:test", "notification_topic_name": "test",

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 152

Page 157: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

"lifecycle_hook_type": "INSTANCE_TERMINATING", "notification_metadata": null, "create_time": "2016-11-17T04:00:34Z" } ]}

Returned Valuel Normal

200l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 153

Page 158: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

11.3 Querying Lifecycle Hook Details

Function

This interface is used to query details about a specified lifecycle hook.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

lifecycle_hook_name

Yes String Specifies thelifecycle hookname.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

lifecycle_hook_name String Specifies the lifecycle hook name.

lifecycle_hook_type String Specifies the lifecycle hook type.INSTANCE_TERMINATINGINSTANCE_LAUNCHING

default_result String Specifies the default lifecycle hook callbackoperation.ABANDONCONTINUE

default_timeout Integer Specifies the lifecycle hook timeout durationin the unit of second.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 154

Page 159: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

notification_topic_urn String Specifies a unique topic in SMN.

notification_topic_name

String Specifies the topic name in SMN.

notification_metadata String Specifies the customized notification.

create_time String Specifies the time when the lifecycle hook iscreated. The time is UTC-compliant.

l Example response{ "lifecycle_hook_name": "test-hook1", "default_result": "CONTINUE", "default_timeout": 3600, "notification_topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:gsh", "notification_topic_name": "gsh", "lifecycle_hook_type": "INSTANCE_LAUNCHING", "notification_metadata": null, "create_time": "2016-11-18T04:01:34Z"}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 155

Page 160: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

11.4 Modifying a Lifecycle Hook

FunctionThis interface is used to modify the information about a specified lifecycle hook.

URIl URI format

PUT /autoscaling-api/v1/{tenant_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

lifecycle_hook_name

Yes String Specifies thelifecycle hookname.

Requestl Parameter description

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 156

Page 161: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

lifecycle_hook_type

No String Specifies the lifecycle hook type.INSTANCE_TERMINATINGINSTANCE_LAUNCHINGThe INSTANCE_TERMINATING hooksuspends an instance when the instanceterminates. TheINSTANCE_LAUNCHING hooksuspends an instance when the instancestarts.

default_result No String Specifies the default lifecycle hookcallback operation. By default, thisoperation is performed when the timeoutduration expires.ABANDONCONTINUEIf an instance is starting, CONTINUEindicates that your customized operationsare successful and the instance can beused. ABANDON indicates that yourcustomized operations failed, and theinstance will be terminated. In such acase, the scaling action fails, and youmust create a new instance.If an instance is stopping, bothABANDON and CONTINUE allowinstance termination. The differencebetween the two states is as follows:ABANDON stops other lifecycle hooks,but CONTINUE allows the completionof other lifecycle hooks.The default value of this field isABANDON.

default_timeout

No Integer Specifies the lifecycle hook timeoutduration, which ranges from 300 to 86400in the unit of second. The default value is3600.By default, this parameter specifies theinstance waiting duration. You canprolong the timeout duration or performthe CONTINUE or ABANDONoperation before the timeout durationexpires.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 157

Page 162: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory Type Description

notification_topic_urn

No String Specifies a unique topic in SMN.This parameter specifies a notificationobject for a lifecycle hook. When aninstance is suspended by the lifecyclehook, the SMN service sends anotification to the object. Thisnotification contains the basic instanceinformation, your customized notificationcontent, and the token for controllinglifecycle operations.

notification_metadata

No String Specifies a customized notification,which contains no more than 256characters in length. The message cannotcontain the following characters: < > &' ( )After a notification object is configured,the SMN service sends your customizednotification to the object.

l Example request{ "default_result": "CONTINUE"}

Responsel Parameter description

Parameter Type Description

lifecycle_hook_name String Specifies the lifecycle hook name.

lifecycle_hook_type String Specifies the lifecycle hook type.INSTANCE_TERMINATINGINSTANCE_LAUNCHING

default_result String Specifies the default lifecycle hook callbackoperation.ABANDONCONTINUE

default_timeout Integer Specifies the lifecycle hook timeout durationin the unit of second.

notification_topic_urn String Specifies a unique topic in SMN.

notification_topic_name

String Specifies the topic name in SMN.

notification_metadata String Specifies the customized notification.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 158

Page 163: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Type Description

create_time String Specifies the time when the lifecycle hook iscreated. The time is UTC-compliant.

l Example response{ "lifecycle_hook_name": "test-hook1", "default_result": "CONTINUE", "default_timeout": 3600, "notification_topic_urn": "urn:smn:regionId:b53e5554fad0494d96206fb84296510b:gsh", "notification_topic_name": "gsh", "lifecycle_hook_type": "INSTANCE_LAUNCHING", "notification_metadata": null, "create_time": "2016-11-18T04:01:34Z"}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 159

Page 164: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

11.5 Calling Back an Instance Lifecycle Hook

FunctionThis interface is used to call back the lifecycle hook specified by a scaling instance based onthe lifecycle action key or based on the instance ID and lifecycle hook name.

If you have completed customized operations before the timeout duration expires, you canterminate or continue the lifecycle operations.

If you require more time for customized operations, you can prolong the timeout duration.Then, the instance waiting duration will be prolonged by one hour each time.

The callback operation can be performed only when the lifecycle hook of the target instance isin HANGING state.

URIl URI format

PUT /autoscaling-api/v1/{tenant_id}/scaling_instance_hook/{scaling_group_id}/callback

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

Requestl Parameter description

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 160

Page 165: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Parameter Mandatory

Type Description

lifecycle_action_key

No String Specifies the lifecycle operation token,which is obtained by calling the API toquery the instance suspensioninformation.When specifying a lifecycle callbackobject, this field is mandatory if theinstance_id field is not used. If both thisfield and the instance_id field are used,preferentially use this field for callback.

instance_id No String Specifies the instance ID.When specifying a lifecycle callbackobject, this field is mandatory if thelifecycle_action_key field is not used.

lifecycle_hook_name

No String Specifies the lifecycle hook name.When specifying a lifecycle callbackobject, this field is mandatory if thelifecycle_action_key field is not used.

lifecycle_action_result

Yes String Specifies the lifecycle callback action.ABANDON: terminates the instance.CONTINUE: continues the instance.EXTEND: extends the timeout duration,one hour each time.

l Example request

{ "lifecycle_action_result": "ABANDON", "lifecycle_action_key":"23880867-6288-4470-98a8-f8bda096b6c4"}

Responsel Example response

None

Returned Valuel Normal

204l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 161

Page 166: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

11.6 Querying Instance Suspension

Function

After a lifecycle hook is added, when an AS group performs a scaling action, the lifecyclehook suspends the target instance and sets it to be in waiting state. You can query the instancesuspension based on search criteria.

URIl URI format

GET /autoscaling-api/v1/{tenant_id}/scaling_instance_hook/{scaling_group_id}/list{?instance_id}

NOTE

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiple searchcriteria. You can filter all non-mandatory parameters in the parameter description.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 162

Page 167: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenant ID.

scaling_group_id Yes String Specifies the AS group ID.

instance_id No String Specifies the AS instance ID.

Requestl Example request

None

Responsel Parameter description

Parameter Type Description

instance_hanging_info List datastructure

Specifies lifecycle hook information aboutan AS instance.

l instance_hooks field data structure description

Parameter Type Description

lifecycle_hook_name String Specifies the lifecycle hook name.

lifecycle_action_key String Specifies the lifecycle action key, whichdetermines the lifecycle callback object.

instance_id String Specifies the AS instance ID.

scaling_group_id String Specifies the AS group ID.

lifecycle_hook_status String Specifies the lifecycle hook status.HANGING: suspends the instance.CONTINUE: continues the instance.ABANDON: terminates the instance.

timeout String Specifies the timeout duration in the formatof "YYYY-MM-DDThh:mm:ssZ". Thetime is UTC-compliant.

default_result String Specifies the default lifecycle hookcallback operation.

Example response{ "instance_hanging_info": [

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 163

Page 168: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

{ "instance_id": "b25c1589-c96c-465b-9fef-d06540d1945c", "scaling_group_id": "e5d27f5c-dd76-4a61-b4bc-a67c5686719a", "lifecycle_hook_name": "hook-test", "lifecycle_action_key": "6ebe6e72-4b09-4adb-ae4a-a91dc0560069", "default_result": "ABANDON", "timeout": "2016-11-15T06:43:41Z", "lifecycle_hook_status": "HANGING" } ]}

Returned Valuel Normal

200

l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 164

Page 169: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

11.7 Deleting a Lifecycle Hook

Function

This interface is used to delete a specified lifecycle hook.

URIl URI format

DELETE /autoscaling-api/v1/{tenant_id}/scaling_lifecycle_hook/{scaling_group_id}/{lifecycle_hook_name}

l Parameter description

Parameter Mandatory Type Description

tenant_id Yes String Specifies the tenantID.

scaling_group_id Yes String Specifies the ASgroup ID.

lifecycle_hook_name

Yes String Specifies thelifecycle hookname.

Requestl Example request

None

Responsel Example response

None

Returned Valuel Normal

204l Abnormal

Returned Value Description

400 Bad Request The server failed to process the request.

401 Unauthorized You must enter the username and password toaccess the requested page.

403 Forbidden You are forbidden to access the requestedpage.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 165

Page 170: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Returned Value Description

404 Not Found The server could not find the requested page.

405 Method Not Allowed You are not allowed to use the methodspecified in the request.

406 Not Acceptable The response generated by the server could notbe accepted by the client.

407 Proxy Authentication Required You must use the proxy server forauthentication so that the request can beprocessed.

408 Request Timeout The request timed out.

409 Conflict The request could not be processed due to aconflict.

500 Internal Server Error Failed to complete the request because of aninternal service error.

501 Not Implemented Failed to complete the request because theserver does not support the requested function.

502 Bad Gateway Failed to complete the request because therequest is invalid.

503 Service Unavailable Failed to complete the request because thesystem is unavailable.

504 Gateway Timeout A gateway timeout error occurred.

Auto ScalingAPI Reference 11 Lifecycle Hook

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 166

Page 171: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

A Appendix

A.1 Error Codes

Description

This section provides the meanings of error codes returned by AS APIs.

Returned Body Format

{"error":{"code":"AS.0001","message":"System error."}}

Error Code Description

HTTPStatusCode

ErrorCode

Description Error Message Solution

500 AS.0001 A system erroroccurs.

System error. Try again later or contacttechnical support.

400 AS.0002 The messagebody is empty.

Request body isnull.

Refer to the error codedescription.

401 AS.0005 The header inthe requestcarries no or anempty token.

The token of theheader in therequest is null.

Refer to the error codedescription.

401 AS.0006 The header inthe requestcarries anincorrect token.

The token of theheader in therequest isincorrect.

Refer to the error codedescription.

404 AS.0007 The requestedresources arenot found.

The resourcesrequested cannotbe found.

Check the URL parameter.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 167

Page 172: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.0008 The project idvalue carried inthe URL isdifferent fromthat resolvedfrom the token.

IncorrectProjectID.

Check the URL parameter orthe token.

403 AS.0011 You do nothavepermission toperform thisoperation.

You do not havethe rights toperform theoperation.

Check whether your userroles include te_admin oras_adm.

403 AS.0012 Your rights toperform theoperation havebeen frozen.

user role issuspended

Check whether your userroles include op_suspended,the frozen one.

403 AS.0013 Your rights toperform theoperation aredisabled.

Your rights toperform theoperation aredisabled.

Check whether your userroles include op_restricted,the restricted one.

400 AS.0021 The requestcontainsinvalidcharacters.

there is specialcharacter inrequest body

Check whether the requestcontains the followinginvalid characters: <>&'()

400 AS.0022 The request isinvalid.

request body error Check the format of therequest.

400 AS.0026 No scalingaction isallowed in thecooldownperiod.

Scaling action isnot allowed in thecooling duration.

Try again later.

400 AS.1001 The startnumber valueis invalid.

The value ofparameter Startnumber is invalid.

Check the URL parameter.

400 AS.1002 The limit valueis invalid.

The value ofparameter Limitis invalid.

Check the URL parameter.

400 AS.1003 The ASconfigurationID is empty.

The ASconfiguration IDis null.

Add an AS configuration ID.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 168

Page 173: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.1004 The ASconfigurationdoes not exist.

The ASconfigurationdoes not exist.

Use a correct ASconfiguration ID.

400 AS.1006 The ASconfigurationis in use andcannot bedeleted.

The ASconfiguration is inuse.

Refer to the error codedescription.

400 AS.1007 The ASconfigurationname is empty.

The ASconfigurationname is null.

Add an AS configurationname.

400 AS.1008 The ASconfigurationname is toolong.

The ASconfigurationname is too long.

Use an AS configurationname of proper length.

400 AS.1009 The AS groupID is empty.

The AS group IDis null.

Add an AS group ID.

400 AS.1010 The ASconfigurationis empty.

The informationabout the ASconfiguration isnull.

Add AS configuration.

400 AS.1011 The ECSconfigurationis empty.

The instanceconfigurationinformation isnull.

Add ECS configuration.

400 AS.1014 The image IDin the ASconfigurationis empty.

The image ID inthe ASconfiguration isnull.

Add an image ID.

400 AS.1015 The image inthe ASconfigurationdoes not exist.

The image in theAS configurationdoes not exist.

Use a correct image ID.

400 AS.1016 The flavor IDin the ASconfigurationis empty.

The specificationID in the ASconfigurationcannot be null.

Add a flavor ID.

400 AS.1017 The flavor ofthe ASconfigurationdoes not exist.

The specificationin the ASconfigurationdoes not exist.

Use a correct flavor ID.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 169

Page 174: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.1018 The flavor andimage do notmatch.

The specificationand image is notmatch.

Refer to the error codedescription.

400 AS.1019 The flavor anddisk do notmatch.

The disk of thistype is notapplicable to theECS.

Check whether the volumetype matches the flavor.

400 AS.1020 The ASconfigurationis empty.

The ASconfiguration isnull.

Add AS configuration.

400 AS.1021 The image inthe ASconfigurationis notactivated.

The image in theAS configurationis not active.

Use a correct image ID.

400 AS.1022 The image inthe ASconfigurationis unavailable.

The image in theAS configurationis not available.

Use a correct image ID.

400 AS.1023 The ASconfigurationname isinvalid.

Invalid ASconfigurationname.

Use a valid AS configurationname.

400 AS.1024 The number ofASconfigurationsexceeds theupper limit.

The number ofAS configurationsexceeds the upperlimit.

Delete useless ASconfigurations or increasethe upper limit of ASconfigurations.

400 AS.1025 The user loginmode in the ASconfigurationis not unique.

The user loginmode in the ASconfiguration isnot unique.

Use account-and-passwordor key-pair login mode only.

400 AS.1026 The user loginmode in the ASconfigurationis empty.

The user loginmode in the ASconfiguration isnull.

Use account-and-passwordor key-pair login mode only.

400 AS.1027 The scalingconfigurationpersonality isinvalid.

The scalingconfig personalityis invalid.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 170

Page 175: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.1028 The disk in theASconfigurationis empty.

The disk in theAS configurationis null.

Add disk parameters.

400 AS.1029 The systemdisk in the ASconfigurationis lost.

The system diskin the ASconfiguration islost.

Add system disk parameters.

400 AS.1030 The size of thesystem disk inthe ASconfigurationis smaller thantherequirement.

The size of thesystem disk in theAS configurationis less than thespecificationrequired.

Refer to the error codedescription.

400 AS.1031 The size of thedisk in the ASconfigurationis invalid.

The size of thedisk in the ASconfiguration isnot correct.

Refer to the error codedescription.

400 AS.1032 The number ofdisks in the ASconfigurationexceeds 24.

The number ofdisks in the ASconfigurationexceeds 24.

Refer to the error codedescription.

400 AS.1033 ThevolumeType ofthe disk in theASconfigurationis invalid.

ParametervolumeType inthe ASconfiguration isinvalid.

Use a valid volumeType.

400 AS.1034 The diskTypein the ASconfigurationis invalid.

ParameterdiskType in theAS configurationis invalid.

Use a valid diskType.

400 AS.1035 The passwordin the ASconfigurationfails to meetthe complexityrequirements.

ParameteradminPass in theAS configurationis invalid.

Refer to the error codedescription.

400 AS.1036 The memory of32-bit OSexceeds 4 GB.

The memory of32-bit operatingsystem (OS)exceeds 4 GB.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 171

Page 176: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.1038 Deleting ASconfigurationsin batches fails.

batch deletingscaling configfailed

Refer to the error codedescription.

400 AS.1039 The number ofASconfigurationsto be deleted inbatchesexceeds theupper limit.

the number ofscaling config isbeyond the maxlimit

Delete a maximum of 50 ASconfigurations at a time.

400 AS.1042 The EIPbandwidth inthe ASconfigurationis invalid.

the bandwidthsize of scalingconfig is invalid

Enter a valid bandwidth.

400 AS.1049 Parameteruserdata in theASconfigurationis invalid.

Parameteruserdata in the ASconfiguration isinvalid.

Use a valid userdata.

400 AS.1050 The user loginmode in the ASconfigurationis invalid.

The user loginmode in the ASconfiguration isillegal.

Use a valid login mode.

400 AS.1052 The metadatain the ASconfigurationis invalid.

Parametermetadata in theAS configurationis invalid.

Use a valid metadata, whosemaximum length is 512 bytesand the key value cannotcontain spaces, $, orperiods(.).

400 AS.1053 The data imagein the ASconfigurationis unavailable.

The data image isnot available.

Use a valid data image.

400 AS.1054 The size of thedata disk in theASconfigurationis smaller thanwhat the dataimage requires.

The size of thedata disk in theAS configurationis less than thedata imagerequired.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 172

Page 177: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.1055 A data diskimage cannotbe used tocreate a systemdisk.

The system diskis not support todata image.

Refer to the error codedescription.

400 AS.1056 The data imagein the ASconfigurationdoes not exist.

The data image inthe ASconfigurationdoes not exist.

Use a valid data image.

400 AS.1057 The selectedDSS device isunavailable.

The dss of thedisk in the ASconfiguration isnot avalid.

Use a correct DSS device.

400 AS.1058 The selectedDSS devicedoes notsupport thedisk type.

The type of dss inthe ASconfiguration isincorrect.

Change the DSS device ordisk type.

400 AS.1059 The storagespace on theselected DSSdevice isinsufficient.

The capacity ofdss in the ASconfiguration isnot enough.

Change the DSS device.

400 AS.1060 You can useeither DSS orEVS disks inan ASconfiguration.

dss and evs isused together inthe ASconfiguration.

Refer to the error codedescription.

400 AS.1061 The selectedDSS devicesmust be in thesame AZ.

the dss is notbelong to thesame az in the ASconfiguration.

Change DSS devices so thatthey are in the same AZ.

400 AS.1062 The number ofdisks withsnapshot IDs inthe ASconfigurationis differentfrom that ofEVS disksspecified in thefull-ECSimage.

The number ofEVS disks withsnapshot IDs inthe ASconfiguration isdifferent fromthat of EVS disksspecified in thefull-ECS image.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 173

Page 178: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.1063 The disk databackup in afull-ECS imageis used torestore the diskin DSS.

The disk databackup in a full-ECS imagecannot be used torestore the disk inDSS.

Refer to the error codedescription.

400 AS.1064 Your selecteddata disk willrecover fromthe disk backupin the full-ECSimage, anddata mirroringis unavailablenow.

The data disk youhave selected willbe restored usingthe disk databackup in the full-ECS image. Then,data mirroringwill beunavailable.

Refer to the error codedescription.

400 AS.1065 The variousVMs in the ASconfigurationdo not belongto the sameAZ.

ECS resourcesspecified in theAS configurationbelong todifferent AZs.

Use ECS resources(specifications, images, disk)in the same AZ.

400 AS.1066 The ASconfigurationcontains EVSdisks withinvalidsnapshot IDs.

The ASconfigurationcontains EVSdisks with invalidsnapshot IDs.

Use a correct snapshot ID.

400 AS.1067 The value ofparameteroffset is invalidfor queryingASconfigurations.

The value ofparameter Offsetnumber is invalid.

Check the URL parameter.

400 AS.2002 The AS groupname is empty.

The name of theAS group is null.

Add an AS group name.

400 AS.2003 The AS groupname is toolong.

The AS groupname is too long.

Use an AS group name ofproper length.

400 AS.2004 The maximumor minimumnumber ofinstances isinvalid.

Invalid min ormax number ofinstances in theAS group.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 174

Page 179: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.2005 The expectednumber ofinstances in theAS group isinvalid.

The expectednumber cannot beless than theminimum numberof instances orgreater than themaximumnumber ofinstances.

Refer to the error codedescription.

400 AS.2006 The cooldownperiod in theAS group isinvalid.

Invalid cooldownperiod of the ASgroup.

Refer to the error codedescription.

400 AS.2007 The AS groupdoes not exist.

The AS groupdoes not exist.

Use a correct AS group ID.

400 AS.2008 The executionaction of theAS group isinvalid.

Invalid executionaction of the ASgroup.

Refer to the error codedescription.

400 AS.2009 The AS groupID is empty.

The AS group IDis null.

Add an AS group ID.

400 AS.2010 The expectednumber ofinstances in theAS groupcannot besmaller thanthe number ofinstances forwhich instanceprotection hasbeenconfigured.

The expectednumber ofinstances in theAS group cannotbe smaller thanthe number ofinstances forwhich instanceprotection hasbeen configured.

Refer to the error codedescription.

400 AS.2011 The AZ in theAS group isinvalid.

Invalid AZ in ASgroup.

Refer to the error codedescription. Change the AZof the AS group.

400 AS.2012 The VPC ofthe AS groupdoes not exist.

The VPC of theAS group doesnot exist.

Use a valid value.

400 AS.2013 Parameternetworks inthe AS group isinvalid.

Parameternetworks in theAS group isinvalid.

Use a valid value.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 175

Page 180: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.2014 The securitygroup of theAS group doesnot exist.

The securitygroup of the ASgroup does notexist.

Use a valid value.

400 AS.2016 ELB listenersin the ASgroup do notmatch theVPC.

The listener of theAS group doesnot belong to thevpc.

Change the VPC ID or ELBlistener ID.

400 AS.2017 The VPC ID inthe AS group isempty.

The ID of theVPC in the ASgroup is null.

Add a VPC ID.

400 AS.2018 No AS isconfigured inthe AS group.

No ASconfiguration is inthe AS group.

Activate the AS group againafter adding an ASconfiguration to the ASgroup.

400 AS.2019 The value ofthe parameterthat specifieswhether toforcibly deletean AS group isinvalid.

The value of theparameter thatspecifies whetherto forcibly deletethe group isinvalid.

Use a valid value.

400 AS.2020 The AS groupstatus isinvalid.

The scaling groupstatus is illegal.

Refer to the error codedescription and you are notallowed to perform theoperation when the AS groupis in the current status.

400 AS.2021 Deleting theAS group failsbecause thereare instances init.

The currentnumber ofinstances in theAS group is not 0.

Refer to the error codedescription.

400 AS.2022 The AS groupname containsinvalidcharacters.

The AS groupname containsinvalid characters.

Use a correct AS groupname.

400 AS.2023 The number ofAS groupsexceeds theupper limit.

The number ofAS groupsexceeds the upperlimit.

Delete useless AS groups orincrease the upper limit ofAS groups.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 176

Page 181: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.2024 The number ofsubnets in ASgroups exceedsthe upper limit.

The number ofsubnets in the ASgroup exceeds theupper limit.

Refer to the error codedescription.

400 AS.2025 The number ofsecurity groupsin the ASgroup exceedsthe upper limit.

The number ofsecurity groups inthe AS groupexceeds the upperlimit.

Refer to the error codedescription.

400 AS.2027 Some subnetsof the ASgroup do notmatch theVPC.

The subnet of theAS group doesnot belong to thevpc.

Change the VPC ID orsubnet.

400 AS.2028 The newexpectednumber ofinstances is thesame as theoriginalnumber.

The modifiedexpected numberof instances is thesame as theoriginal number.

Refer to the error codedescription.

400 AS.2029 The healthcheck methodfor instances inthe AS group isincorrect.

Invalid healthcheck method ofthe AS group.

Use a correct health checkmethod.

400 AS.2030 You are notallowed tomodify the AZ,subnet, securitygroup, orlistenerinformationwhen there areinstances in theAS group, theAS group isscaling, or theAS group is inINSERVICEstate.

You are notallowed to modifythe listener, AZ,subnet, andsecurityinformation whenthe number ofinstances in theAS group is not 0,the AS group isscaling, or the ASgroup is inInservice status.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 177

Page 182: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.2031 The healthcheck period ofthe AS group isinvalid.

Invalid healthcheck period ofthe AS group.

Use a valid health checkperiod.

400 AS.2032 The instanceremoval policyfor the ASgroup isinvalid.

Invalid instanceremoval policy.

Use a valid instance removalpolicy.

400 AS.2033 You are notallowed toperform theoperation whenthe AS group isin the currentstatus.

You are notallowed toperform theoperation whenthe AS group is incurrent status.

Refer to the error codedescription.

400 AS.2034 Thenotificationmethod for theAS group isinvalid.

Invalidnotificationmethod of the ASgroup.

Use a valid notificationmethod.

400 AS.2035 The number ofECSs in the ASgroup is greaterthan the upperlimit becausesome ECSs aremanuallyadded.

The number ofinstancesmanually addedto the AS groupexceeds themaximumnumber of theinstances requiredin the AS group.

Refer to the error codedescription.

400 AS.2036 The number ofECSs in the ASgroup issmaller thanthe lower limitbecause someECSs aremanuallydeleted.

The number ofinstancesmanually deletedis less than theminimum numberof the instancesrequired in the ASgroup.

Refer to the error codedescription.

400 AS.2037 The number ofELB listenersin the ASgroup reachesthe upper limit.

The number oflisteners in theAS group exceedsthe upper limit.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 178

Page 183: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.2038 The ECSs ofthis type in theAZ of the ASgroup havebeen sold out.

The type of ECSin the AZ youselected has beensold out.

Refer to the error codedescription. Change the AZof the AS group or changethe AS configuration for theAS group.

400 AS.2042 The ULB poolin the ASgroup isinvalid.

Parameter pool oflbaas in the ASgroup is empty.

Use a valid pool.

400 AS.2043 Storageresources ofthis type aresold out or donot exist in theAZ specifiedfor this ASgroup.

There is notavalid volume inthe AZ youselected.

Refer to the error codedescription. Change the AZof the AS group or changethe AS configuration for theAS group.

400 AS.2044 The AZ in theAS group isinvalid.

The AZ in the ASgroup is notavailable.

Refer to the error codedescription. Change the AZof the AS group.

400 AS.2045 The minimumor maximumnumber ofinstances in theAS groupexceeds thequota.

The min or maxnumber ofinstances in theAS group exceedsthe upper limit.

Refer to the error codedescription.

400 AS.2046 The graceperiod for theinstance healthcheck isinvalid.

Invalid healthcheck graceperiod of the ASgroup.

Refer to the error codedescription.

400 AS.3001 The AS policyis empty.

The AS policy isnull.

Add an AS policy.

400 AS.3002 The AS policytype isincorrect.

Invalid AS policytype.

Use a correct AS policy type.

400 AS.3003 The AS policyis empty.

The informationabout the ASpolicy is null.

Add an AS policy.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 179

Page 184: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.3004 The periodtype isincorrect.

Invalid recurrencetype in the ASpolicy.

Use a correct period type.

400 AS.3005 The end timeof the scalingactiontriggeredperiodically isempty.

The end time ofthe scaling actiontriggeredperiodically isnull.

Add an end time.

400 AS.3006 The format ofthe end timefor theperiodicallytriggeredscaling actionis incorrect.

The format of theend time of thescaling actiontriggeredperiodically isincorrect.

Use a correct format for theend time.

400 AS.3007 The end timeof the scalingactiontriggeredperiodicallymust be laterthan the currenttime.

The end time ofthe scaling actiontriggeredperiodically mustbe later than thecurrent time.

Refer to the error codedescription.

400 AS.3008 The triggeringtime is empty.

ParameterlanchTime in theAS policy is null.

Add a triggering time.

400 AS.3009 The triggeringtime format isincorrect.

The format ofparameterlanchTime isincorrect.

Use a correct triggering timeformat.

400 AS.3010 The triggeringtime of thescaling actiontriggered at ascheduled timemust be laterthan the currenttime.

The triggeringtime of thescheduled policymust be later thanthe current time.

Refer to the error codedescription.

400 AS.3011 The AS policytype is empty.

The AS policytype is null.

Add an AS policy type.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 180

Page 185: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.3012 The cooldownperiod in theAS policy isinvalid.

Invalid cooldownperiod in the ASpolicy.

Use a valid cooldown period.

400 AS.3013 The AS policyname is empty.

The AS policyname is null.

Add an AS policy name.

400 AS.3014 The length ofthe AS policyname isinvalid.

The length of theAS policy nameis invalid.

Use an AS policy name ofproper length.

400 AS.3015 The executionaction in theAS policy isempty.

The action in theAS policy is null.

Add an execution action inthe AS policy.

400 AS.3016 The operationto perform theexecutionaction in theAS policy isempty.

The operation toperform theaction in the ASpolicy is null.

Refer to the error codedescription.

400 AS.3017 The operationto perform theaction in theAS policyaction isinvalid.

The operation toperform theaction in the ASpolicy action isinvalid.

Refer to the error codedescription.

400 AS.3018 The number ofinstances towhich the ASpolicy appliesis invalid.

The number ofinstances whichaction in the ASpolicy operates onis invalid.

Refer to the error codedescription.

400 AS.3019 The AS groupID in the ASpolicy isempty.

The AS group IDin the AS policycannot be null.

Add an AS group ID.

400 AS.3020 The AS policydoes not exist.

The AS policydoes not exist.

Use a correct AS policy ID.

400 AS.3021 The AS policyID is empty.

The AS policy IDcannot be null.

Add an AS policy ID.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 181

Page 186: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.3022 The action ofthe AS policyrequest body isinvalid.

The action of theAS policy requestbody is invalid.

Use a valid action.

400 AS.3023 The periodtype of the ASpolicy isempty.

The period typeof the AS policyis null.

Add a period type.

400 AS.3024 The periodtype value ofthe AS policyis empty.

The value of theperiod type of theAS policy is null.

Add a period type.

400 AS.3025 The periodtype value ofthe AS policyis invalid.

The value ofperiod type of theAS policy isinvalid.

Use a valid period type.

400 AS.3026 The alarm IDin the ASpolicy isempty.

The alarm ID inthe AS policy isnull.

Add an alarm ID.

400 AS.3027 The AS groupmust be inINSERVICEstate when theAS policy isperformed.

The AS policymust be in theinservice statuswhen the ASpolicy isperformed.

Enable the AS group.

400 AS.3028 The format ofthe start timefor theperiodicallytriggeredscaling actionis incorrect.

The format of thestart time for thescaling actiontriggeredperiodically isincorrect.

Use a correct format for thestart time.

400 AS.3029 The start timeof theperiodicallytriggeredscaling actionmust be earlierthan the endtime.

The start time ofthe scaling actiontriggeredperiodically mustbe earlier than theend time.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 182

Page 187: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.3030 The alarm rulein the ASpolicy does notexist.

The alarm in theAS policy doesnot exist.

Modify the alarm rule usedby the AS policy.

400 AS.3031 The AS policyname isinvalid.

Invalid AS policyname.

Use a valid AS policy name.

400 AS.3032 The number ofAS policiesexceeds theupper limit.

The number ofAS policiesexceeds the upperlimit.

Delete useless AS policies orincrease the upper limit ofAS policies.

400 AS.3033 The triggeringtime of theperiodic policyfalls outsidethe effectivetime range ofthe policy.

The triggeringtime of theperiodic policy isnot included inthe effective timeof the policy.

Refer to the error codedescription.

400 AS.3034 The alarm IDin the ASpolicy is beingused byanother ASgroup.

The alarm ID inthe AS policy isbeing used byanother ASgroup.

Refer to the error codedescription. An alarm ID canbe used only by the ASpolicy in one AS group at atime.

400 AS.3035 The percentageof instances towhich the ASpolicy appliesis invalid.

The percentage ofinstances whichaction in the ASpolicy operates onis invalid.

Refer to the error codedescription.

400 AS.3036 The action inthe AS policyoperates is notunique.

The action in theAS policyoperates is notunique.

Refer to the error codedescription.

400 AS.3045 Failed to deletepolicies inbatches.

Failed to deletepolicies in abatch.

If this error code is returned,use field Message to obtainthe policy ID and the failurecause.

400 AS.3046 Failed toenable policiesin batches.

Failed to resumepolicies in abatch.

If this error code is returned,use field Message to obtainthe policy ID and the failurecause.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 183

Page 188: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.3047 Failed todisable policiesin batches.

Failed to pausepolicies in abatch.

If this error code is returned,use field Message to obtainthe policy ID and the failurecause.

400 AS.3048 The value ofthe parameterthat specifieswhether toforcibly deletean AS policy isinvalid.

The value of theparameter thatspecifies whetherto forcibly deletethe policy isinvalid.

Refer to the error codedescription.

400 AS.3049 The list of ASpolicies onwhich a batchoperation is tobe performed isempty.

The list of ASpolicies to bebatched is empty.

Refer to the error codedescription.

400 AS.3050 The format ofthe alarm ID inthe AS policyis incorrect.

The alarm ID inthe AS policy isformat wrong.

Refer to the error codedescription.

400 AS.4000 Thestart_numbervalue in theinstancerequest isinvalid.

The value ofparameterstart_number inthe request for theinstance isinvalid.

Check the URL parameter.

400 AS.4001 The limit valuein the instancerequest isinvalid.

The value ofparameter limit inthe request for theinstance isinvalid.

Check the URL parameter.

400 AS.4003 Thelife_cycle_state value in theinstancerequest isinvalid.

The value ofparameterlife_cycle_state inthe instancerequest is invalid.

Use a valid life_cycle_statevalue.

400 AS.4004 Thehealth_statusvalue in theinstancerequest isinvalid.

The value ofparameterhealth_status inthe request for theinstance isinvalid.

Use a valid health_statusvalue.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 184

Page 189: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.4005 Thescaling_group_id in theinstancerequest doesnot exist.

Parameterscaling_group_idin the request forthe instance doesnot exist.

Use a correctscaling_group_id.

400 AS.4006 The instancedoes not exist.

The instance doesnot exist.

Use a correct instance ID.

400 AS.4007 The value ofthe parameterthat specifieswhether todelete theinstance isinvalid.

The value of theparameter thatspecifies whetherto delete theinstance isinvalid.

Use a valid value.

400 AS.4008 The start timeformat of thelog about theexpectednumber of theinstances isincorrect.

The start timeformat of the logabout theexpected numberof the instances isincorrect.

Use a correct format.

400 AS.4009 The end timeformat of thelog aboutexpectednumber of theinstances isincorrect.

The end timeformat of the logabout expectednumber of theinstances isincorrect.

Use a correct format.

400 AS.4010 Thestart_numberin the requestfor the logabout theexpectednumber ofinstances isinvalid.

Parameterstart_number inthe request for thelog about theexpected numberof instances isinvalid.

Check the URL parameter.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 185

Page 190: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.4011 The value oflimit in therequest for thelog about theexpectednumber ofinstances isinvalid.

The value ofparameter limit inthe request for thelog about theexpected numberof instances isinvalid.

Check the URL parameter.

400 AS.4012 The logId inthe request forthe log aboutthe expectednumber ofinstances isinvalid.

The value ofparameter logIdin the request forthe log about theexpected numberof instances isinvalid.

Check the URL parameter.

400 AS.4013 The list ofinstances to bedeleted isempty.

The list ofinstances to bedeleted is null.

Add instances to be deleted.

400 AS.4014 The instancesdo not belongto the same ASgroup.

The instances donot belong to thesame AS group.

Refer to the error codedescription.

400 AS.4015 The instance isnot inINSERVICEstate.

The instance isnot in theinservice status.

Refer to the error codedescription.

400 AS.4016 The instancecannot bedeletedbecause it ischarged bymonth or year.

Failed to deletethe instancebecause theinstance ischarged by monthor year.

Refer to the error codedescription.

400 AS.4017 The requestedinstance isempty.

The requestedinstance is null.

Refer to the error codedescription.

400 AS.4018 The value ofthe requestbody action ofthe batchinstanceoperation isinvalid.

The action of thebody in therequest to operatethe instance isinvalid.

Use a valid value.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 186

Page 191: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.4019 The list ofinstances to beadded to theAS group isempty.

The list ofinstances to beadded to the ASgroup is null.

Refer to the error codedescription.

400 AS.4020 The AZ towhich theinstancebelongs isdifferent fromthe AZ towhich the ASgroup belongs.

The AZ to whichthe instancebelongs is notwithin the AZ inthe AS group.

Refer to the error codedescription.

400 AS.4021 The VPC towhich theinstancebelongs isdifferent fromthe VPC in theAS group.

The VPC towhich theinstance belongsis different fromthe VPC in theAS group.

Refer to the error codedescription.

400 AS.4022 The number ofinstancesadded to theAS groupexceeds theupper limit.

The number ofinstances added tothe AS groupexceeds the upperlimit.

Refer to the error codedescription.

400 AS.4023 The addedinstancealready exists.

The addedinstance hasalready existed.

Refer to the error codedescription.

400 AS.4024 The addedinstance is notin the activestate.

The instance isnot in the activestatus.

Refer to the error codedescription.

400 AS.4026 The number ofinstancesdeletedexceeds theupper limit.

The number ofinstances deletedexceeds the upperlimit.

Refer to the error codedescription.

400 AS.4027 The instancehas alreadybeen added toanother ASgroup.

The addedinstance hasalready existed inother AS group.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 187

Page 192: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.4029 Failed to batchadd instances.If this errorcode isreturned, usefield Messageto obtain theinstance ID andthe failurecause.

Failed to addinstances in abatch.

Refer to the error codedescription.

400 AS.4030 Failed to batchdeleteinstances.If this errorcode isreturned, usefield Messageto obtain theinstance ID andthe failurecause.

Failed to deleteinstances in abatch.

Refer to the error codedescription.

400 AS.4032 The list ofinstances isempty.

The list ofinstances is null.

Refer to the error codedescription.

400 AS.4033 Failed to setinstanceprotection in abatch.If this errorcode isreturned, usefield Messageto obtain theinstance ID andthe failurecause.

Failed to setinstanceprotection in abatch.

Refer to the error codedescription.

400 AS.7008 The value ofthe parameterfor creating anECS is invalid.

Invalidparameters forcreating ECSs.

Use a valid value. Check theparameter in the ASconfiguration of the currentAS group.

400 AS.7011 This DeC doesnot supportECSs of thistype.

This DeC doesnot support ECSsof this type.

Refer to the error codedescription.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 188

Page 193: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.7012 The ELBlistener doesnot exist.

lblistener doesnotexist.

Modify the ELB listenerinformation and enable theAS group.

400 AS.7019 Private IPaddresses inthe subnet areinsufficient.

The number ofprivate IPaddresses in thesubnet isinsufficient.

Modify the subnetinformation and enable theAS group.

400 AS.7022 The SSH keyof the ASconfigurationdoes not exist.

Keypair doesnotexist.

Replace the ASconfiguration in the ASgroup.

400 AS.7025 Thenotificationsubject isinvalid.

The topic urn isnot valid.

Use a valid notificationsubject.

400 AS.7026 Thenotificationscene isinvalid.

The topic scene isnot valid.

Use a valid notificationscene.

400 AS.7027 Thenotificationsubject isempty.

The topic ofnotification isnull.

Add a notification subject.

400 AS.7028 The number ofnotifications inthe AS groupexceeds theupper limit.

The number oftopics in the ASgroup exceeds theupper limit.

Add a maximum of fivenotifications.

400 AS.7029 Thenotificationsubject isduplicate.

The topic ofnotification isduplicate.

Use a correct notificationsubject.

400 AS.7030 The lifecyclehook timeoutduration isinvalid.

Invalid lifecyclehook defaulttimeout.

Use a valid value.

400 AS.7031 The lifecyclehook name isinvalid.

Invalid lifecyclehook name.

Use a valid value.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 189

Page 194: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.7032 The lifecyclehook name isempty.

The name of thelifecycle hook isempty.

Add a lifecycle hook name.

400 AS.7033 The lifecyclehook type isinvalid.

Invalid lifecyclehook type.

Use a valid value.

400 AS.7034 The defaultcallback actionof the lifecyclehook is invalid.

Invalid lifecyclehook callbackaction result.

Use a valid value.

400 AS.7035 The length oflifecycle hookmetadataexceeds themaximumallowed.

The metadata ofthe lifecycle hookis too long.

Use a valid value.

400 AS.7036 The lifecyclehook is empty.

The lifecyclehook is null.

Use a valid value.

400 AS.7037 The lifecyclehook type isempty.

The type of thelifecycle hook isempty.

Use a valid value.

400 AS.7038 The number oflifecycle hooksexceeds theupper limit.

The number ofhooks in the ASgroup exceeds theupper limit.

Add a maximum of fivelifecycle hooks.

400 AS.7039 The lifecyclehook callbackaction isempty.

The lifecyclehook callbackaction result isempty.

Use a valid value.

400 AS.7040 The lifecyclehook callbackobject isempty.

The lifecyclehook callbackobject is empty.

Use a valid value.

400 AS.7041 The lifecyclehook namealready exists.

The lifecyclehook callbackobject is empty.

Use a valid value.

400 AS.7042 The lifecyclehook callbackobject does notexist.

The lifecyclehook callbackobject does notexist.

Use a valid value.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 190

Page 195: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.7043 Thenotificationsubjectconfigured foryour lifecyclehook does notexist.

The lifecyclehook topic urndoes not exist.

Use a valid value. Check thenotification subjectconfigured for your lifecyclehook.

400 AS.7044 The tag of thisresource isempty.

The tag of thisresource is null

Use a valid value.

400 AS.7045 The number oftags exceedsthe upper limit.

The number oftags exceeded.

Add a maximum of 10 tags.

400 AS.7047 The tag valueis too long.

The value of tagin the resource istoo long.

Use a valid value.

400 AS.7048 The resourcetype in thisoperation withtag is invalid.

The resource typein this operationwith tag isinvalid.

Use a valid value.

400 AS.7049 The action inthis operationwith tag isinvalid.

The action in thisoperation with tagis invalid.

Use a valid value.

400 AS.7050 The key of tagis duplicate.

The key of tagcannot beduplicate.

Use a valid value.

400 AS.7051 The backendECS group inthe AS groupdoes not exist.

The backend ECSgroup in the ASgroup does notexist.

Use a valid value. Changethe pool of ELB.

400 AS.7055 The lifecyclehook metadatacontainsinvalidcharacters.

The metadata ofthe lifecycle hookhas specialcharacter.

Use a valid value.

400 AS.7061 The value ofthe tag isempty.

The value ofscaling tag is null.

Use a valid value.

400 AS.7062 The key of thetag is empty.

The key ofscaling tag is null.

Use a valid value.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 191

Page 196: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

HTTPStatusCode

ErrorCode

Description Error Message Solution

400 AS.7063 The tag key istoo long.

The key ofscaling tag is toolong.

Use a valid value.

400 AS.7111 The ECS quotais insufficient.

Insufficientinstance quota.

Release idle ECSs or applyfor a higher ECS quota.

400 AS.7112 The diskcapacity quotais insufficient.

Insufficientvolume quota.

Release idle ECSs orincrease the upper limit ofdisks.

400 AS.7113 The EIP quotais insufficient.

Insufficientelastic ip quota.

Release idle EIPs or increasethe upper limit of EIPs.

400 AS.7114 The ECSmemory quotais insufficient.

Insufficient ramquota.

Release idle ECSs or applyfor a higher ECS memoryquota.

400 AS.7115 The ECS CPUquota isinsufficient.

Insufficient cpuquota.

Release idle ECSs orincrease the upper limit ofECS CPUs.

400 AS.9001 The format ofthe start timeof the scalinglog is incorrect.

The format of thestart time of thescaling log isincorrect.

Use a valid value.

400 AS.9002 The format ofthe end time ofthe scaling logis incorrect.

The format of theend time of thescaling log isincorrect.

Use a valid value.

400 AS.9003 Thestart_numberin the requestfor the scalinglog is invalid.

Parameterstart_number inthe request for thescaling log isinvalid.

Use a valid value.

400 AS.9004 The limit inthe request forthe scaling logis invalid.

The value ofparameter limit inthe request for thescaling log isinvalid.

Use a valid value.

400 AS.9005 The logId inthe request forthe scaling logis invalid.

The value ofparameter logIdin the request forthe scaling log isinvalid.

Use a valid value.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 192

Page 197: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

A.2 AS Metrics

FunctionThis section describes metrics reported by AS to Cloud Eye as well as their namespaces anddimensions. You can use APIs provided by Cloud Eye to view the AS metrics and the alarmsgenerated by Cloud Eye for AS.

NamespaceSYS.AS

MetricsMetric Name Description Value

RangeRemarks

cpu_util CPU Usage Average CPU usageof all instances in amonitored object

≥0% The monitoredobject is an ASgroup.

mem_util MemoryUsage

Average memoryusage of allinstances in amonitored object

≥0% The monitoredobject is an ASgroup.NOTE

This metric isunavailable ifthe image has noinstalled.

network_incoming_bytes_rate_inband

InbandIncomingRate

Average number ofincoming bytes persecond on allinstances in amonitored object

≥ 0 bytes/s The monitoredobject is an ASgroup.

network_outgoing_bytes_rate_inband

InbandOutgoingRate

Average number ofoutgoing bytes persecond on allinstances in amonitored object

≥ 0 bytes/s The monitoredobject is an ASgroup.

instance_num Number ofInstances

Number of availableinstances in amonitored object

≥0 The monitoredobject is an ASgroup.Available ECSsindicate theECSs in normalstate.

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 193

Page 198: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Metric Name Description ValueRange

Remarks

disk_read_bytes_rate

Disks ReadRate

Number of bytesread from allinstances in an ASgroup per second

≥ 0 bytes/s The monitoredobject is an ASgroup.

disk_write_bytes_rate

Disks WriteRate

Number of byteswritten to allinstances in an ASgroup per second

≥ 0 bytes/s The monitoredobject is an ASgroup.

disk_read_requests_rate

Disk ReadRequests

Number of readrequests sent to allinstances in an ASgroup per second

≥ 0 requests/s The monitoredobject is an ASgroup.

disk_write_requests_rate

Disks WriteRequests

Number of writerequests sent to allinstances in an ASgroup per second

≥ 0 requests/s The monitoredobject is an ASgroup.

NOTE

For details about whether your OS supports the Memory Usage, Inband Outgoing Rate, and InbandIncoming Rate metrics, see the Elastic Cloud Server User Guide.

DimensionKey Value

AutoScalingGroup AS group ID

Auto ScalingAPI Reference A Appendix

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 194

Page 199: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

B Change History

Released On Description

2018-08-30 This issue is the eighth official release, which incorporates the followingchange:l Changed the default cooldown period to 300s.l Added error code AS.1067 in section A.1 Error Codes.

2018-07-30 This issue is the seventh official release, which incorporates thefollowing change:Added 10s and 1 min as new options for the health check period insection 3.1 Creating an AS Group.

2018-05-30 This issue is the sixth official release, which incorporates the followingchanges:l Added parameter security_groups to section 4 AS Configurations.l Added parameter meta_data to section 6.8 Querying Details of an

AS Policy (V2).l Added section 6.11 Performing Operations on AS Policies in

Batches.l Added parameter meta_data to section 6.8 Querying Details of an

AS Policy (V2).l Modified error codes AS.3004, AS.3008, AS.3009, AS.3010, and

AS.3033 in section A.1 Error Codes.l Added error codes AS.0026, AS.3045, AS.3046, AS.3047, AS.3048,

and AS.3049 in section A.1 Error Codes.

Auto ScalingAPI Reference B Change History

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 195

Page 200: API Reference - Huawei · Access Management API Reference. 3. Make a call to a service API, add X-Auth-Token to the request header, and set the value of X-Auth-Token to the token

Released On Description

2018-04-30 This issue is the fifth official release, which incorporates the followingchanges:l Added description of health_periodic_audit_grace_period in

section 3.1 Creating an AS Group.l Added description of health_periodic_audit_grace_period in

section 3.4 Modifying an AS Group.l Added the scaling_policy_id field in section 6.5 Querying AS

Policies.l Added the scaling_policy_id and scaling_policy_name fields in

section 8.1 Querying Scaling Action Logs.l Added error codes AS.2046, AS.7044, AS.7045, AS.7047, AS.7048,

AS.7049, AS.7050, and AS.7055 in section A.1 Error Codes.

2018-03-30 This issue is the fourth official release, which incorporates the followingchanges:l Added section 6.2 Creating an AS Policy (V2).l Added section 6.4 Modifying an AS Policy (V2).l Added section 6.6 Querying AS Policies (V2).l Added section 6.8 Querying Details of an AS Policy (V2).l Added section 7 AS Policy Execution Logs.

2017-12-31 This issue is the first official release.

Auto ScalingAPI Reference B Change History

Issue 08 (2018-08-30) Copyright © Huawei Technologies Co., Ltd. 196