Domains¶
list_domains¶
-
Client.
list_domains
(size=None, **kwargs)¶ Get a list of domains
Parameters: size (int) – Used for pagination to indicate the size of each page requested for querying a list of items. If no value is specified the default value is 25. (Maximum value 100) Return type: types.GeneratorType Returns: list of domains Example: Fetch domains and print:
domain_list = api.list_domains(size=10) print(list(domain_list)) ## [{ 'endpoints_url': 'https://api.catapult.inetwork.com/v1/users/u-abc123/domains/endpoints', ## 'id' : 'rd-domainId', ## 'name' : 'siplearn1'}, ## { 'endpoints_url' : 'https://api.catapult.inetwork.com/v1/users/u-abc123/domains/endpoints', ## 'id' : 'rd-domainId2', ## 'name' : 'siplearn2'}]
Example: Search for domain based on name:
domain_list = api.list_domains(size=100) domain_name = '' while domain_name != 'My Prod Site': my_domain = next(domain_list) domain_name = my_domain['name'] print(my_domain) ## { 'description' : 'Python Docs Example', ## 'endpoints_url': 'https://api.catapult.inetwork.com/v1/users/u-abc123/domains/rd-domainId/endpoints', ## 'id' : 'rd-domainId', ## 'name' : 'My Prod Site'}
create_domain¶
-
Client.
create_domain
(name, description=None, **kwargs)¶ Create a domain
Parameters: - name (str) – The name is a unique URI to be used in DNS lookups
- description (str) – String to describe the domain
Return type: str
Returns: id of created domain
Example: Create Domain:
domain_id = api.create_domain(name='qwerty', description='Python Docs Example') print(domain_id) # rd-domainId
get_domain¶
-
Client.
get_domain
(domain_id)¶ Get information about a domain
Parameters: domain_id (str) – id of the domain Return type: dict Returns: domain information Example: Create then fetch domain:
domain_id = api.create_domain(name='qwerty', description='Python Docs Example') print(domain_id) # rd-domainId my_domain = api.get_domain(domain_id) print(my_domain) ## { 'description' : 'Python Docs Example', ## 'endpoints_url': 'https://api.catapult.inetwork.com/v1/users/u-abc123/domains/rd-domainId/endpoints', ## 'id' : 'rd-domainId', ## 'name' : 'qwerty'}