Acceleration Domain Name Management
Last Updated:2020-09-17
Create an Accelerated Domain Name
The following code creates an accelerated domain name:
$domain = "test.domain.com";
$origins = array(
array("peer" => "test.origin.domain.com"), //The origin server is the domain name.
array("peer" => "111.222.111.222") //The origin server is an IP, and it cannot exist at the same time.
);
$resp = $client->createDomain($domain, $origins);
print_r($resp);
Note Since the accelerated domain name is unique in all regions, you have to make sure that the domain is not the same as the accelerated domain names in all other regions.
Query Whether the Domain Name can be Added
$client = new CdnClient($g_CDN_TEST_CONFIG); $domain = "test-sdk.sys-qa.com"; $resp = $client->validDomain($domain); $this->assertNotNull($resp);
View all the Domain Names and their Status under the User
$client = new CdnClient($g_CDN_TEST_CONFIG);
$status = "RUNNING";
$rule = "www";
$param = array(
'status' => $status,
'rule' => $rule
);
$resp = $client->listUserDomains($param);
$this->assertNotNull($resp);
View the List of Accelerated Domain Name
The following code can list all the domain names of the user:
$resp = $client->listDomains();
print_r($resp);
Delete the Accelerated Domain Name
The following code deletes an accelerated domain name:
$domain = "test.domain.com";
$resp = $client->deleteDomain($domain);
print_r($resp);
Enable the Domain Name Acceleration Service
$domain = "test.domain.com";
$resp = $client->enableDomain($domain);
print_r($resp);
Stop Domain Name Acceleration Service
$domain = "test.domain.com";
$resp = $client->disableDomain($domain);
print_r($resp);