Creates a Global Traffic Manager (GTM) instance.
Prerequisites
You can call the CreateInstance operation of Alibaba Cloud Transactions and Bills Management OpenAPI (BSS OpenAPI) to create and renew GTM instances.
CreateInstance operation
For more information about the CreateInstance operation, see CreateInstance.
SDK
Maven dependencies:
<dependencies>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-bssopenapi</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.4.6</version>
</dependency>
</dependencies>
For more information about SDKs in other programming languages, see SDK list.
Client initialization. For more information, see Install latest Java SDK.
If you are a user on the China site (aliyun.com), set the RegionId parameter to cn-hangzhou. If you are a user on the international site (alibabacloud.com), set the RegionId parameter to ap-southeast-1.
Create a GTM instance
Description: You can call the CreateInstance operation to create a GTM instance.
Operation: CreateInstance
References: CreateInstance
Parameter description:
The following section describes the operation parameters and their valid values.
Some parameters that are used when you purchase a GTM instance in the GTM console:
Parameter | Type | Required | Description | Valid value |
ProductCode | String | Yes | The service code. | dns |
ProductType | String | Yes | The service type. | dns_gtm_public_intl |
SubscriptionType | String | Yes | The billing method of the instance. |
Subscription |
Period | Integer | Yes | The subscription period of the instance. Unit: month. | An integral multiple of 12 for a yearly subscription instance |
Parameter.1.Code | String | Yes | The name of the parameter that specifies the edition of the instance. | PackageEdition |
Parameter.1.Value | String | Yes | The edition of the instance that you purchased. | standard ultimate |
Parameter.2.Code | String | Yes | The name of the parameter that specifies the quota of detection tasks. | HealthcheckTaskCount |
Parameter.2.Value | String | Yes | The quota of detection tasks. | Default value: 0 Minimum value: 0 Step size: 100 Maximum value: 100000 |
Sample requests
https://business.aliyuncs.com/? Action=CreateInstance
&Parameter.1.Code=PackageEdition
&Parameter.1.Value=standard
&Parameter.2.Code=HealthcheckTaskCount
&Parameter.2.Value=0
&Period=1
&ProductCode=dns
&ProductType=dns_gtm_public_intl
&SubscriptionType=Subscription
Sample code:
package AlidnsTest.DomainManager;
import com.alibaba.fastjson.JSON;
import com.aliyuncs.bssopenapi.model.v20171214.CreateInstanceRequest;
import com.aliyuncs.bssopenapi.model.v20171214.CreateInstanceResponse;
import com.aliyuncs.exceptions.ClientException;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
import utils.AlidnsTestBase;
public class InstanceCreate extends AlidnsTestBase {
@Test
public void createInstanceTest() {
CreateInstanceRequest request = new CreateInstanceRequest();
request.setProductCode("dns");
request.setProductType("dns_gtm_public_intl");
request.setSubscriptionType("Subscription");
request.setPeriod(1);
CreateInstanceRequest.Parameter parameters1 = new CreateInstanceRequest.Parameter();
parameters1.setCode("PackageEdition");
parameters1.setValue("standard");
CreateInstanceRequest.Parameter parameters2 = new CreateInstanceRequest.Parameter();
parameters2.setCode("HealthcheckTaskCount");
parameters2.setValue("0");
request.setParameters(Lists.newArrayList(parameters1,parameters2,parameters3));
try {
CreateInstanceResponse response = client.getAcsResponse(request);
System.out.println(JSON.toJSON(response));
} catch (ClientException e) {
e.printStackTrace();
}
}
}