Acceleration Domain Name Management
Last Updated:2020-09-17
Query Whether the Domain Name can be Added
The following code queries whether the domain name can be added:
response = c.valid_domain('test-sdk.sys-qa.com')
print(response)
Create an Accelerated Domain Name
An accelerated domain name can be created through the following code (supporting customized origin server port):
def test_create_domain(c):
"""
test_create_domain
"""
origin = [
{'peer': 'http://1.2.3.2'}, # no port
{'peer': 'http://1.2.3.7:80'}, # set origin with http port
{'peer': 'https://1.2.3.9:443'}, # set origin with https port
{'peer': '1.2.3.1:8080'} # set origin with http port
]
other_config = {
"form":"image",
"defaultHost":"1.2.3.4"
}
response = c.create_domain('test-sdk.sys-qa.com', origin, other_config)
print(response)
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.
View the List of Accelerated Domain Name
The following code can list all the domain names of the user:
def test_list_domains(self):
"""
test_list_domains
"""
error = None
try:
response = self.cdn_client.list_domains()
print response
except BceServerError as e:
error = e
finally:
self.assertIsNone(error)
View all the Domain Names and their Status under the User
The following code can check all the domain names and status under the username:
status = 'ALL'
rule = None
response = c.list_user_domains(status, rule)
print(response)
Delete an Accelerated Domain Name
The following code deletes an accelerated domain name:
response = self.cdn_client.delete_domain('opencdn3.sys-qa.com')
print response