Apache-TrafficControl Package

Package Contents

class trafficops.TOSession(host_ip, host_port=443, api_version='1.3', ssl=True, headers=None, verify_cert=True)

Bases: trafficops.restapi.RestApiSession

Traffic Ops Session Class Once you login to the Traffic Ops API via login(), you can call one or more of the methods to retrieve, POST, PUT, DELETE, etc. data to the API. If you are not logged in, an exception will be thrown if you try to call any of the endpoint methods. This API client is simplistic and lightly structured on purpose but adding support for new endpoints routinely takes seconds. Another nice bit of convenience that result data is, by default, wrapped in munch.Munch objects, which provide attribute access to the returned dictionaries/hashes - e.g. a_dict['a_key'] with munch becomes a_dict.a_key or a_dict['a_key']. Also, the lack of rigid structure (loose coupling) means many changes to the Traffic Ops API, as it evolves, will probably go un-noticed (usually additions), which means fewer future problems to potentially fix in user applications.

An area of improvement for later is defining classes to represent request data instead of loading up dictionaries for request data.

Please see the API documentation for the details of the API endpoints.

Adding end-point methods

#503 Endpoint with no URL parameters and no query parameters
@api_request(u'get', u'cdns', (u'1.1', u'1.2',))
def get_cdns(self):
        pass
#504 End-point with URL parameters and no query parameters
@api_request(u'get', u'cdns/{cdn_id:d}', (u'1.1', u'1.2',))
def get_cdn_by_id(self, cdn_id=None):
        pass
#505 End-point with no URL parameters but with query parameters
@api_request(u'get', u'deliveryservices', (u'1.1', u'1.2',))
def get_deliveryservices(self, query_params=None):
        pass
#506 End-point with URL parameters and query parameters
@api_request(u'get', u'deliveryservices/xmlId/{xml_id}/sslkeys', (u'1.1', u'1.2',))
def get_deliveryservice_ssl_keys_by_xml_id(self, xml_id=None, query_params=None):
        pass
#507 End-point with request data
@api_request(u'post', u'cdns', (u'1.1', u'1.2',))
def create_cdn(self, data=None):
        pass
#508 End-point with URL parameters and request data
@api_request(u'put', u'cdns', (u'1.1', u'1.2',))
def update_cdn_by_id(self, cdn_id=None, data=None):
        pass

Calling end-point methods

get_cdns() calls endpoint cdns e.g. t.get_cdns()

get_types() calls endpoint types, optionally with query parameters e.g. get_foo_data(id=45, query_params={'sort': 'asc'}) calls endpoint GET api/1.x/foo/45?sort=asc (presumably)

cdns_queue_update() calls endpoint cdns/{{ID}}/queue_update, with an ID path parameter and a JSON payload e.g. cdns_queue_update(id=1, data={'action': 'queue'})

Note

Only a small subset of the API endpoints are implemented. More can be implemented as needed.

add_ssl_keys_to_deliveryservice(data=None)

Add SSL keys to a Delivery Service. deliveryservices/sslkeys/add :param data: The parameter data to use for adding SSL keys to a Delivery Service. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

assign_delivery_services_to_federations(federation_id=None, data=None)

Create one or more federation / delivery service assignments. federations/{{ID}}/deliveryservices :param federation_id: The federation id :type federation_id: int :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

assign_deliveryservice_servers_by_ids(data=None)

Assign servers by id to a Delivery Service. (New Method) deliveryserviceserver :param data: The required data to create server associations to a delivery service :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

assign_deliveryservice_servers_by_names(xml_id=None, data=None)

Assign servers by name to a Delivery Service by xmlId. deliveryservices/{{xml_id}}/servers :param xml_id: The XML Id of the delivery service :type xml_id: str :param data: The required data to assign servers to a delivery service :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

assign_federation_resolver_to_federations(federation_id=None, data=None)

Create one or more federation / federation resolver assignments. federations/{{ID}}/federation_resolvers :param federation_id: The federation id :type federation_id: int :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

assign_parameter_to_profile_ids(data=None)

Create one or more parameter / profile assignments. profileparameter :param data: The data to assign :type data: Union[Dict[str, Any], List[Dict[str, Any]]] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

assign_profile_to_parameter_ids(data=None)

Create one or more profile / parameter assignments. profileparameter :param data: The data to assign :type data: Union[Dict[str, Any], List[Dict[str, Any]]] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

associate_paramater_to_profile(data=None)

Associate parameter to profile. profileparameters :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

associate_parameters_by_profile_id(profile_id=None, data=None)

Associate Parameters to a Profile by Id. profiles/{{ID}}/parameters :param profile_id: The profile id :type profile_id: int :param data: The parameter data to associate :type data: Union[Dict[str, Any], List[Dict[str, Any]]] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

associate_parameters_by_profile_name(profile_name=None, data=None)

Associate Parameters to a Profile by Name. profiles/name/{{name}}/parameters :param profile_name: The profile name :type profile_name: str :param data: The parameter data to associate :type data: Union[Dict[str, Any], List[Dict[str, Any]]] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

base_url

Returns the base url. (read-only)

Returns:The base url should match ‘[w+-.]+://[w+-.]+(:d+)?’ e.g https://to.somedomain.net/api/1.2/
Return type:str
cachegroups_queue_update(cache_group_id=None, data=None)

Queue Updates by Cache Group ID cachegroups/{{ID}}/queue_update :param cache_group_id: The Cache Group Id :type cache_group_id: int :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

cdns_queue_update(cdn_id=None, data=None)

Queue Updates by CDN Id. cdns/{{ID}}/queue_update :param cdn_id: The CDN Id :type cdn_id: int :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

copy_profile(new_profile_name=None, copy_profile_name=None, data=None)

Copy profile to a new profile. The new profile name must not exist profiles/name/{{name}}/copy/{{copy}} :param new_profile_name: The name of profile to copy to :type new_profile_name: String :param copy_profile_name: The name of profile copy from :type copy_profile_name: String :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_asn(data=None)

Create ASN asns :param data: The parameter data to use for cachegroup creation. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_cache_group_fallbacks(data=None)

Creates fallback configuration for the cache group. New fallbacks can be added only via POST. cachegroup_fallbacks :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

create_cachegroups(data=None)

Create a Cache Group cachegroups :param data: The parameter data to use for cachegroup creation. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_cdn(data=None)

Create a new CDN. cdns :param data: The parameter data to use for cdn creation. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

create_cdn_dns_sec_keys(data=None)

Generates ZSK and KSK keypairs for a CDN and all associated Delivery Services deliveryservices/dnsseckeys/generate :param data: The parameter data to use for cachegroup creation. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

create_coordinates(data=None)

Create coordinates coordinates :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

Create one or more user / delivery service assignments. deliveryservice_user :param data: The parameter data to use for Delivery Service SSL key generation. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

create_deliveryservice(data=None)

Allows user to create a delivery service. deliveryservices :param data: The request data structure for the API request :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

create_deliveryservice_regexes(delivery_service_id=None, data=None)

Create a regex for a delivery service deliveryservices/{{ID}}/regexes :param delivery_service_id: The delivery service Id :type delivery_service_id: int :param data: The required data to create delivery service regexes :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

create_division(data=None)

Create a division divisions :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_federation(data=None)

Allows a user to add federations for their delivery service(s). federations :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_federation_in_cdn(cdn_name=None, data=None)

Create a federation. cdns/{{name}}/federations :param cdn_name: The CDN name to find federation :type cdn_name: String :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_federation_resolver(data=None)

Create a federation resolver. :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_federation_user(federation_id=None, data=None)

Create one or more federation / user assignments. federations/{{ID}}/users :param federation_id: Federation ID :type federation_id: int :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_invalidation_job(data=None)

Invalidating content on the CDN is sometimes necessary when the origin was mis-configured and something is cached in the CDN that needs to be removed. Given the size of a typical Traffic Control CDN and the amount of content that can be cached in it, removing the content from all the caches may take a long time. To speed up content invalidation, Traffic Ops will not try to remove the content from the caches, but it makes the content inaccessible using the regex_revalidate ATS plugin This forces a revalidation of the content, rather than a new get. user/current/jobs :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_origins(data=None)

Creates origins associated with a delivery service origins :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_parameter(data=None)

Create Parameter parameters :param data: The parameter(s) data to use for parameter creation. :type data: Union[Dict[str, Any], List[Dict[str, Any]]] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

create_physical_location(region_name=None, query_params=None)

Create physical location regions/:region_name/phys_locations :param region_name: the name of the region to create physical location into :type region_name: String :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_profile(data=None)

Create a profile profiles :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_region(division_name=None, data=None)

Create a region divisions/{{name}}/regions :param division_name: The Division name in which region will reside :type division_name: String :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_server(data=None)

Create a new Server. servers :param data: The parameter data to use for server creation :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_servercheck(data=None)

Post a server check result to the serverchecks table. servercheck :param data: The parameter data to use for server creation :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_staticdnsentries(data=None)

Create static DNS entries associated with the delivery service staticdnsentries :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_tenant(data=None)

Create a tenant tenants :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_to_extension(data=None)

Creates a Traffic Ops extension. to_extensions :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_user(data=None)

Create a user. users :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

create_user_with_registration(data=None)

Register a user and send registration email users/register :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_asn(asn_id=None)

Delete ASN :to-api-asns-id: :param asn_id: The ID of the ASN to delete :type asn_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_cache_group_fallbacks(query_params=None)

Deletes an existing fallback related configurations for a cache group cachegroup_fallbacks

Parameters:query_params (Dict[str, int]) – Either cacheGroupId or fallbackId must be used or can be used simultaneously
Return type:Tuple[Dict[str, Any], requests.Response]
Raises:Union[LoginError, OperationError]
delete_cache_group_parameters(cache_group_id=None, parameter_id=None)

Delete a cache group parameter association cachegroupparameters/{{ID}}/{{parameterID}} :param cache_group_id: The cache group id in which the parameter will be deleted :type cache_group_id: int :param parameter_id: The parameter id which will be disassociated :type parameter_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_cachegroups(cache_group_id=None)

Delete a cache group cachegroups/{{ID}} :param cache_group_id: The cache group id to update :type cache_group_id: Integer :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_cdn_by_id(cdn_id=None)

Delete a CDN by Id. cdns/{{ID}} :param cdn_id: The CDN id :type cdn_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_cdn_dns_sec_keys(cdn_name=None)

Delete dnssec keys for a cdn and all associated delivery services cdns/name/{{name}}/dnsseckeys/delete :param cdn_name: The CDN name to delete dnsseckeys info for :type cdn_name: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_coordinates(query_params=None)

Delete coordinates coordinates :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

Removes a delivery service from a user. deliveryservice_user/{{dsID}}/{{userID}} :param delivery_service_id: The delivery service id to dissasociate the user :type delivery_service_id: int :param user_id: The user id to dissassociate :type user_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_deliveryservice_by_id(delivery_service_id=None)

Allows user to delete a delivery service. deliveryservices/{{ID}} :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_deliveryservice_regex_by_regex_id(delivery_service_id=None, delivery_service_regex_id=None)

Delete a RegEx by Id for a Delivery Service by Id. deliveryservices/{{ID}}/regexes/{{rID}} :param delivery_service_id: The delivery service Id :type delivery_service_id: int :param delivery_service_regex_id: The delivery service regex Id :type delivery_service_regex_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_deliveryservice_servers_by_id(delivery_service_id=None, server_id=None)

Removes a server (cache) from a delivery service. deliveryservice_server/{{DSID}}/{{serverID}} :param delivery_service_id: The delivery service id :type delivery_service_id: int :param server_id: The server id to remove from delivery service :type server_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_deliveryservice_ssl_keys_by_xml_id(xml_id=None, query_params=None)

Delete SSL keys for a Delivery Service by xmlId. deliveryservices/xmlId/{{xmlid}}/sslkeys/delete :param xml_id: The Delivery Service xmlId :type xml_id: str :param query_params: The url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_division(division_id=None, query_params=None)

Delete a division by division id divisions/{{ID}} :param division_id: The division id to delete :type division_id: int :param query_params: The required data to update delivery service regexes :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_federation_in_cdn(cdn_name=None, federation_id=None)

Delete a federation. cdns/{{name}}/federations/{{ID}} :param cdn_name: The CDN name to find federation :type cdn_name: String :param federation_id: The federation id :type federation_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_federation_resolver(federation_resolver_id=None)

Delete a federation resolver. :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_federation_user(federation_id=None, user_id=None)

Delete one or more federation / user assignments. federations/{{ID}}/users/{{userID}} :param federation_id: Federation ID :type federation_id: int :param user_id: Federation User ID :type user_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_origins(query_params=None)

Updates origins associated with a delivery service origins :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_parameter(parameter_id=None)

Delete Parameter parameters/{{ID}} :param parameter_id: The parameter id to delete :type parameter_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_physical_location(physical_location_id=None, query_params=None)

Delete Physical Location by id phys_locations/{{ID}} :param physical_location_id: The id to delete :type physical_location_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_profile_by_id(profile_id=None)

Delete Profile by Id. profiles/{{ID}} :param profile_id: The profile Id :type profile_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_profile_parameter_association_by_id(profile_id=None, parameter_id=None)

Delete Parameter association by Id for a Profile by Id. profileparameters/{{profileID}}/{{parameterID}} :param profile_id: The profile id :type profile_id: int :param parameter_id: The parameter id :type parameter_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

delete_server_by_id(server_id=None)

Delete a Server by Id. servers/{{ID}} :param server_id: The server Id :type server_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_staticdnsentries(query_params=None)

Delete static DNS entries associated with the delivery service staticdnsentries :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

delete_to_extension(extension_id=None)

Deletes a Traffic Ops extension. to_extensions/{{ID}}/delete :param extension_id: The extension id to delete :type extension_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

generate_deliveryservice_ssl_keys(data=None)

Generate an SSL certificate. (self-signed) deliveryservices/sslkeys/generate :param data: The parameter data to use for Delivery Service SSL key generation. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

generate_deliveryservice_url_signature_keys(xml_id=None)

Generate URL Signature Keys for a Delivery Service by xmlId. deliveryservices/xmlId/{{xml_id}}/urlkeys/generate :param xml_id: The Delivery Service xmlId :type xml_id: str :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

generate_iso(data=None)

Generate an ISO isos :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_all_cachegroup_parameters()

A collection of all cache group parameters. cachegroupparameters :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_all_deliveryservice_servers(*args, **kwargs)

Get all servers attached to all delivery services via the Traffic Ops API. :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_api_capabilities(query_params=None)

Get all API-capability mappings api_capabilities :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_api_capabilities_by_id(id=None)

Get an API-capability mapping by ID api_capabilities/{{ID}} :param id: The api-capabilities Id :type id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_asn_by_id(asn_id=None)

Get ASN by ID asns/{{id}} :param asn_id: The ID of the ASN to retrieve :type asn_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_asns(query_params=None)

Get ASNs. asns :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_associated_profiles_by_parameter_id(parameter_id=None)

Get all Profiles associated to a Parameter by Id. parameters/{{ID}}/profiles :param parameter_id: The parameter id :type parameter_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_authenticated_user()

Retrieves the profile for the authenticated user. user/current :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_authenticated_user_jobs()

Retrieves the user’s list of jobs. user/current/jobs :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_cache_group_fallbacks(query_params=None)

Retrieve fallback related configurations for a cache group cachegroup_fallbacks

Parameters:query_params (Dict[str, int]) – Either cacheGroupId or fallbackId must be used or can be used simultaneously
Return type:Tuple[Dict[str, Any], requests.Response]
Raises:Union[LoginError, OperationError]
get_cache_stats(query_params=None)

Retrieves statistics about the CDN. cache_stats :param query_params: See API page for more information on accepted params :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_cachegroup_by_id(cache_group_id=None)

Get a Cache Group by Id. cachegroups/{{ID}} :param cache_group_id: The cache group Id :type cache_group_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cachegroup_parameters(cache_group_id=None)

Get a cache groups parameters cachegroups/{{ID}}/parameters :param cache_group_id: The cache group Id :type cache_group_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cachegroup_parameters_by_id(parameter_id=None)

Get a cache groups parameter by its ID cachegroup/{{parameter ID}}/parameter :param parameter_id: The parameter Id :type parameter_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cachegroup_unassigned_parameters(cache_group_id=None)

Get a cache groups unassigned parameters cachegroups/{{id}}/unassigned_parameters :param cache_group_id: The cache group Id :type cache_group_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cachegroups(query_params=None)

Get Cache Groups. cachegroups :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_cdn_by_id(cdn_id=None)

Get a CDN by Id. cdns/{{ID}} :param cdn_id: The CDN id :type cdn_id: str :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdn_by_name(cdn_name=None)

Get a CDN by name. cdns/name/{{name}} :param cdn_name: The CDN name :type cdn_name: str :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdn_dns_sec_keys(cdn_name=None)

Gets a list of dnsseckeys for a CDN and all associated Delivery Services cdns/name/{{name}}/dnsseckeys :param cdn_name: The CDN name to find dnsseckeys info for :type cdn_name: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdn_health_by_name(cdn_name=None)

Retrieves the health of all locations (cache groups) for a given CDN cdns/{{name}}/health :param cdn_name: The CDN name to find health for :type cdn_name: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdn_monitoring_info(cdn_name=None)

Retrieves CDN monitoring information cdns/{{name}}/configs/monitoring :param cdn_name: The CDN name to find configs for :type cdn_name: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdn_routing_info(cdn_name=None)

Retrieves CDN routing information cdns/{{name}}/configs/routing :param cdn_name: The CDN name to find routing info for :type cdn_name: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdn_specific_config_file(cdn_name=None, config_file=None, query_params=None)

Get the configuiration files for a given cdn name and config file cdns/{{cdn}}/configfiles/ats/{{filename}} :param cdn_name: The cdn name to get config files for :type cdn_name: String :param config_file: The config file name to retrieve for host :type config_file: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdn_ssl_keys(cdn_name=None)

Returns ssl certificates for all Delivery Services that are a part of the CDN. cdns/name/{{name}}/sslkeys :param cdn_name: The CDN name to find ssl keys for :type cdn_name: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdns()

Get all CDNs. cdns :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_cdns_capacity()

Retrieves the aggregate capacity percentages of all locations (cache groups) for a given CDN. cdns/capacity :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdns_domains()

Retrieves the different CDN domains cdns/domains :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdns_health()

Retrieves the health of all locations (cache groups) for all CDNs cdns/health :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdns_routing()

Retrieves the aggregate routing percentages of all locations (cache groups) for a given CDN. cdns/routing :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_cdns_usage()

Retrieves the high-level CDN usage metrics. cdns/usage/overview :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_change_logs()

Retrieve all change logs from traffic ops logs :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_change_logs_for_days(days=None)

Retrieve all change logs from Traffic Ops logs/{{days}}/days :param days: The number of days to retrieve change logs :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_change_logs_newcount()

Get amount of new logs from traffic ops logs/newcount :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_coordinates(query_params=None)

Get all coordinates associated with the cdn coordinates :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_current_snapshot_crconfig(cdn_name=None)

Retrieves the CURRENT snapshot for a CDN which doesn’t necessarily represent the current state of the CDN. The contents of this snapshot are currently used by Traffic Monitor and Traffic Router. cdns/{{name}}/snapshot :param cdn_name: The CDN name :type cdn_name: str :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_delivery_service_capacity(delivery_service_id=None)

Retrieves the capacity percentages of a delivery service. Delivery service must be assigned to user if user is not admin or operations. deliveryservices/{{ID}}/capacity :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_delivery_service_failover_state(delivery_service_id=None)

Retrieves the failover state for a delivery service. Delivery service must be assigned to user if user is not admin or operations. deliveryservices/{{ID}}/state :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_delivery_service_health(delivery_service_id=None)

Retrieves the health of all locations (cache groups) for a delivery service. Delivery service must be assigned to user if user is not admin or operations. deliveryservices/{{ID}}/health :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_delivery_service_routing(delivery_service_id=None)

Retrieves the routing method percentages of a delivery service. Delivery service must be assigned to user if user is not admin or operations. deliveryservices/{{ID}}/routing :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_delivery_service_stats(query_params=None)

Retrieves statistics on the delivery services. deliveryservice_stats :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservice_by_id(delivery_service_id=None)

Retrieves a specific delivery service. If not admin / ops, delivery service must be assigned to user. deliveryservices/{{ID}} :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservice_ineligible_servers(delivery_service_id=None)

Retrieves properties of CDN EDGE or ORG servers not eligible for assignment to a delivery service. deliveryservices/{{ID}}/servers/eligible :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservice_regexes_by_id(delivery_service_id=None)

Get RegExes for a Delivery Service by Id. deliveryservices/{{ID}}/regexes :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservice_regexes_by_regex_id(delivery_service_id=None, regex_id=None)

Retrieves a regex for a specific delivery service. deliveryservices/{{ID}}/regexes/{{rID}} :param delivery_service_id: The delivery service Id :type delivery_service_id: int :param regex_id: The delivery service regex id :type regex_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservice_servers(delivery_service_id=None)

Retrieves properties of CDN EDGE or ORG servers assigned to a delivery service. deliveryservices/{{ID}}/servers :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservice_ssl_keys_by_xml_id(xml_id=None, query_params=None)

Get SSL keys for a Delivery Service by xmlId. deliveryservices/xmlId/{{XMLID}}/sslkeys :param xml_id: The Delivery Service XML id :type xml_id: str :param query_params: The url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservice_unassigned_servers(delivery_service_id=None)

Retrieves properties of CDN EDGE or ORG servers not assigned to a delivery service. (Currently call does not work) deliveryservices/{{ID}}/unassigned_servers :param delivery_service_id: The delivery service Id :type delivery_service_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservices(query_params=None)

Retrieves all delivery services (if admin or ops) or all delivery services assigned to user. deliveryservices :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryservices_regexes()

Get RegExes for all Delivery Services. deliveryservices_regexes :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_deliveryserviceserver(query_params=None)

Retrieves delivery service / server assignments. (Allows pagination and limits) deliveryserviceserver :param query_params: The required url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_division_by_id(division_id=None)

Get a division by division id divisions/{{ID}} :param division_id: The division id to retrieve :type division_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_divisions()

Get all divisions. divisions :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_federation_delivery_services(federation_id=None)

Retrieves delivery services assigned to a federation federations/{{ID}}/deliveryservices :param federation_id: The federation id :type federation_id: int :param federation_id: The federation id :type federation_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_federation_for_cdn_by_id(cdn_name=None, federation_id=None)

Retrieves a federation for a cdn. cdns/{{name}}/federations/{{ID}} :param cdn_name: The CDN name to find federation :type cdn_name: String :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_federation_resolvers(query_params=None)

Get federation resolvers. federation_resolvers :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_federation_resolvers_by_id(federation_id=None)

federations/{{ID}}/federation_resolvers Retrieves federation resolvers assigned to a federation :param federation_id: The federation id :type federation_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_federation_users(federation_id=None)

Retrieves users assigned to a federation. federations/{{ID}}/users :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_federations()

Retrieves a list of federation mappings (aka federation resolvers) for a the current user federations :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_federations_for_cdn(cdn_name=None)

Retrieves a list of federations for a cdn. cdns/{{name}}/federations :param cdn_name: The CDN name to find federation :type cdn_name: String :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_hwinfo()

Get hwinfo for servers. hwinfo :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_job_by_id(job_id=None)

Get a job by ID (currently limited to invalidate content (PURGE) jobs). jobs/{{ID}} :param job_id: The job id to retrieve :type job_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_jobs(query_params=None)

Get all jobs (currently limited to invalidate content (PURGE) jobs) sorted by start time (descending). jobs :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_origins(query_params=None)

Get origins associated with the delivery service origins :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_osversions()

Get all OS versions for ISO generation and the directory where the kickstarter files are found. The values are retrieved from osversions.cfg found in either /var/www/files or in the location defined by the kickstart.files.location parameter (if defined). osversions :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_parameter_by_id(parameter_id=None)

Get a Parameter by Id. parameters/{{ID}} :param parameter_id: The parameter Id :type parameter_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_parameters()

Get all Profile Parameters. parameters :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_parameters_by_profile_id(profile_id=None)

Get all Parameters associated with a Profile by Id. profiles/{{ID}}/parameters :param profile_id: The profile Id :type profile_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_parameters_by_profile_name(profile_name=None)

Get all Parameters associated with a Profile by Name. profiles/name/{{name}}/parameters :param profile_name: The profile name :type profile_name: str :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_pending_snapshot_crconfig(cdn_name=None)

Retrieves a PENDING snapshot for a CDN which represents the current state of the CDN. The contents of this snapshot are NOT currently used by Traffic Monitor and Traffic Router. Once a snapshot is performed, this snapshot will become the CURRENT snapshot and will be used by Traffic Monitor and Traffic Router. cdns/{{name}}/snapshot/new :param cdn_name: The CDN name :type cdn_name: str :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_physical_location_by_id(physical_location_id=None)

Get Physical Location by id phys_locations/{{ID}} :param physical_location_id: The id to retrieve :type physical_location_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_physical_locations(query_params=None)

Get Physical Locations. phys_locations :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_profile_by_id(profile_id=None)

Get Profile by Id. profiles/{{ID}} :param profile_id: The profile Id :type profile_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_profile_specific_config_files(profile_name=None, config_file=None, query_params=None)

Get the configuiration files for a given profile name and config file profiles/{{profile}}/configfiles/ats/{{filename}} :param profile_name: The profile name to get config files for :type host_name: String :param config_file: The config file name to retrieve for host :type config_file: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_profiles(query_params=None)

Get Profiles. profiles :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_region_by_id(region_id=None)

Get Region by ID regions/{{ID}} :param region_id: The region id of the region to retrieve :type region_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_regions()

Get Regions. regions :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_roles()

Get Roles. roles :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_server_by_id(server_id=None)

Get Server by Server ID servers/{{ID}} :param server_id: The server id to retrieve :type server_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_server_config_files(host_name=None, query_params=None)

Get the configuiration files for a given host name servers/{{server}}/configfiles/ats :param host_name: The host name to get config files for :type host_name: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_server_delivery_services(server_id=None)

Retrieves all delivery services assigned to the server servers/{{ID}}/deliveryservices :param server_id: The server id to retrieve :type server_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_server_details(name=None)

Get server details from trafficOps servers/hostname/{{name}}/details :param hostname: Server hostname :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_server_specific_config_file(host_name=None, config_file=None, query_params=None)

Get the configuiration files for a given host name and config file servers/{{server}}/configfiles/ats/{{filename}} :param host_name: The host name to get config files for :type host_name: String :param config_file: The config file name to retrieve for host :type config_file: String :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_server_status_count()

Retrieves a count of CDN servers by status servers/status :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_server_type_count()

Retrieves a count of CDN servers by type servers/totals :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_server_update_status(server_name=None)

Gets the current update status of a server named server_name. servers/{{hostname}}/update_status :param server_name: The (short) hostname of the server for which the update status will be fetched :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_servers(query_params=None)

Get Servers. servers :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_static_dns_entries()

Get Static DNS Entries. staticdnsentries :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_staticdnsentries(query_params=None)

Get static DNS entries associated with the delivery service staticdnsentries :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_statuses()

Retrieves a list of the server status codes available. statuses :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_statuses_by_id(status_id=None)

Retrieves a server status by ID. statuses/{{ID}} :param status_id: The status id to retrieve :type status_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_system_info()

Get information on the traffic ops system. system/info :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_tenant_by_id(tenant_id=None)

Get a tenant by ID. tenants/{{ID}} :param tenant_id: The tenant to retrieve :type tenant_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_tenants()

Get all tenants. tenants :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_to_extensions()

Retrieves the list of extensions. to_extensions :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_traffic_monitor_cache_stats()

Retrieves cache stats from Traffic Monitor. Also includes rows for aggregates caches/stats :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_trimmed_physical_locations()

Get Physical Locations with name only phys_locations/trimmed :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_trimmed_profiles()

Get Profiles with names only profiles/trimmed :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_type_by_id(type_id=None)

Get Data Type with the given type id types/{{ID}} :param type_id: The ID of the type to retrieve :type type_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_types(query_params=None)

Get Data Types. types :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_types_only_names()

Get Data Types with only the Names types/trimmed :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_unassigned_profiles_by_parameter_id(parameter_id=None)

Retrieves all profiles NOT assigned to the parameter. parameters/{{ID}}/unassigned_profiles :param parameter_id: The parameter id :type parameter_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

get_unnassigned_parameters_by_profile_id(profile_id=None)

Get all Parameters associated with a Profile by Id. profiles/{{ID}}/unassigned_parameters :param profile_id: The profile Id :type profile_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_user_by_id(user_id=None)

Retrieves user by ID. users/{{ID}} :param user_id: The user to retrieve :type user_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_user_delivery_services(user_id=None)

Retrieves all delivery services assigned to the user. users/{{ID}}/deliveryservices :param user_id: The user to retrieve :type user_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

get_users()

Retrieves all users. users :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

logged_in

Read-only property of to determine if user is logged in to Traffic Ops. :return: True if connected and logged in, False otherwise :rtype: bool

login(username, password)

Login to the Traffic Ops API. :param username: Traffic Ops User Name :type username: str :param password: Traffic Ops User Password :type password: str :return: None :rtype: None :raises: LoginError

servers_queue_update(server_id=None, data=None)

Queue Updates by Server Id. servers/{{ID}}/queue_update :param server_id: The server Id :type server_id: int :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

snapshot_crconfig(cdn_name=None)

Snapshot CRConfig by CDN Name. snapshot/{{name}} :param cdn_name: The CDN name :type cdn_name: str :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

to_url

The URL without the api portion. (read-only)

Returns:The URL should match ‘[w+-.]+://[w+-.]+(:d+)?’ e.g https://to.somedomain.net or https://to.somedomain.net:443
Return type:str
update_asn(asn_id=None, query_params=None)

Update ASN asns/{{id}} :param asn_id: The ID of the ASN to update :type asn_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_cache_group_fallbacks(data=None)

Updates an existing fallback configuration for the cache group. cachegroup_fallbacks :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

update_cachegroups(cache_group_id=None, data=None)

Update a cache group cachegroups/{{ID}} :param cache_group_id: The cache group id to update :type cache_group_id: Integer :param data: The parameter data to use for cachegroup creation. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_cdn_by_id(cdn_id=None, data=None)

Update a CDN by Id. cdns/{{ID}} :param cdn_id: The CDN id :type cdn_id: int :param data: The parameter data to use for cdn update. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

update_coordinates(query_params=None, data=None)

Update coordinates coordinates :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_deliveryservice_by_id(delivery_service_id=None, data=None)

Update a Delivery Service by Id. deliveryservices/{{ID}} :param delivery_service_id: The delivery service Id :type delivery_service_id: int :param data: The request data structure for the API request :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_deliveryservice_regexes(delivery_service_id=None, regex_id=None, query_params=None)

Update a regex for a delivery service deliveryservices/{{ID}}/regexes/{{rID}} :param delivery_service_id: The delivery service Id :type delivery_service_id: int :param regex_id: The delivery service regex id :type regex_id: int :param query_params: The required data to update delivery service regexes :type query_params: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

update_deliveryservice_safe(delivery_service_id=None, data=None)

Allows a user to edit limited fields of an assigned delivery service. deliveryservices/{{ID}}/safe :param delivery_service_id: The delivery service Id :type delivery_service_id: int :param data: The request data structure for the API request :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_division(division_id=None, query_params=None)

Update a division by division id divisions/{{ID}} :param division_id: The division id to update :type division_id: int :param query_params: The required data to update delivery service regexes :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_federation_in_cdn(cdn_name=None, federation_id=None, query_params=None)

Update a federation. cdns/{{name}}/federations/{{ID}} :param cdn_name: The CDN name to find federation :type cdn_name: String :param federation_id: The federation id :type federation_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_origins(query_params=None)

Updates origins associated with a delivery service origins :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_parameter(parameter_id=None, query_params=None)

Update Parameter parameters/{{ID}} :param parameter_id: The parameter id to update :type parameter_id: int :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

update_physical_location(physical_location_id=None, query_params=None)

Update Physical Location by id phys_locations/{{ID}} :param physical_location_id: The id to update :type physical_location_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_profile_by_id(profile_id=None, data=None)

Update Profile by Id. profiles/{{ID}} :param profile_id: The profile Id :type profile_id: int :param data: The parameter data to edit :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_region(region_id=None)

Update a region regions/{{ID}} :parma region_id: The region to update :type region_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_server_by_id(server_id=None, data=None)

Update a Server by Id. servers/{{ID}} :param server_id: The server Id :type server_id: int :param data: The parameter data to edit :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_server_status_by_id(server_id=None, data=None)

Update server_status by Id. servers/{{ID}}/status :param server_id: The server Id :type server_id: int :status: https://traffic-control-cdn.readthedocs.io/en/latest/api/server.html :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_staticdnsentries(data=None, query_params=None)

Update static DNS entries associated with the delivery service staticdnsentries :param data: The update action. QueueUpdateRequest() can be used for this argument also. :type data: Dict[str, Any] :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

update_tenant(tenant_id=None)

Update a tenant tenants/{{ID}} :param tenant_id: The tenant to update :type tenant_id: int :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

validate_parameter_exists(data=None)

Validate that a Parameter exists. parameters/validate :param data: The parameter data to use for parameter validation. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

exception trafficops.InvalidJSONError(*args, resp=None)

Bases: ValueError

An error that occurs when an invalid JSON payload is passed to an endpoint.

resp = None

Contains the response object that generated the error

exception trafficops.LoginError(*args)

Bases: OSError

This represents an error that occurred during server login.

exception trafficops.OperationError(*args, resp=None)

Bases: OSError

This class represents a generic error, indicating something went wrong with the request or on the server.

resp = None

Contains the response object that generated the error

trafficops.api_request(method_name, api_path, supported_versions)

This wrapper returns a decorator that routes the calls to the appropriate utility function that generates the RESTful API endpoint, performs the appropriate call to the endpoint and returns the data to the user.

Parameters:
  • method_name (str) – A method name defined on the Class, this decorator is decorating, that will be called to perform the operation. E.g. ‘GET’, ‘POST’, ‘PUT’, ‘DELETE’, etc. The method_name chosen must have the signature of <method>(self, api_path, **kwargs) e.g. def get(self, api_path, **kwargs): ...
  • api_path (str) – The path to the API end-point that you want to call which does not include the base url e.g. user/login, servers, etc. This string can contain substitution parameters as denoted by a valid field_name replacement field specification as per str.format() e.g. cachegroups/{id} or cachegroups/{id:d}
  • supported_versions (Tuple[str]) – A tuple of API versions that this route supports
Returns:

rtype int: A new function that replaces the original function with a boilerplate execution process.

Return type:

Callable[str, Dict[str, Any]]

class trafficops.RestApiSession(host_ip, api_version=None, api_base_path='api/', host_port=443, ssl=True, headers=None, verify_cert=True, create_session=False, max_retries=5)

Bases: object

This class represents a login session with a generic REST API server. It provides base functionality inherited by TOSession.

api_base_url

Returns the base URL. (read-only)

Returns:The base URL should match ‘[w+-.]+://[w+-.]+(:d+)?’ e.g. ‘https://to.somedomain.net/api/0.1/
Return type:str
api_version

Returns the api version. (read-only)

Returns:The api version from which this instance will request endpoints.
Return type:str
close()

Close and cleanup the requests Session object.

Returns:None
Return type:NoneType
create()

Create the requests.Session to communicate with the RESTful API.

Returns:None
Return type:NoneType
delete(api_path, *args, **kwargs)

Perform HTTP DELETE requests

Parameters:
  • api_path (str) – The path to the API end-point that you want to call which does not include the base URL e.g. user/login, servers, etc. This string can contain substitution parameters as denoted by a valid field_name replacement field specification as per str.format() e.g. cachegroups/{id} or cachegroups/{id:d}
  • kwargs (Dict[str, Any]) – Passed Keyword Parameters. If you need to send JSON data to the endpoint pass the keyword parameter data with the Python data structure. This method will convert it to JSON before sending it to the API endpoint. Use query_params to pass a dictionary of query parameters
Returns:

Python data structure distilled from JSON from the API request.

Return type:

Tuple[Union[Dict[str, Any], List[Dict[str, Any]], munch.Munch, List[munch.Munch]], requests.Response]

Raises:

Union[LoginError, OperationError]

get(api_path, *args, **kwargs)

Perform http get requests

Parameters:
  • api_path (str) – The path to the API end-point that you want to call which does not include the base url e.g. user/login, servers, etc. This string can contain substitution parameters as denoted by a valid field_name replacement field specification as per str.format() e.g. cachegroups/{id} or cachegroups/{id:d}
  • kwargs (Dict[str, Any]) – Passed Keyword Parameters. If you need to send JSON data to the endpoint pass the keyword parameter data with the Python data structure. This method will convert it to JSON before sending it to the API endpoint. Use query_params to pass a dictionary of query parameters
Returns:

Python data structure distilled from JSON from the API request.

Return type:

Tuple[Union[Dict[str, Any], List[Dict[str, Any]], munch.Munch, List[munch.Munch]], requests.Response]

Raises:

Union[LoginError, OperationError]

head(api_path, *args, **kwargs)

Perform HTTP HEAD requests :param api_path: The path to the API end-point that you want to call which does not include

the base URL e.g. user/login, servers, etc. This string can contain substitution parameters as denoted by a valid field_name replacement field specification as per str.format() e.g. cachegroups/{id} or cachegroups/{id:d}
Parameters:kwargs (Dict[str, Any]) – Passed Keyword Parameters. If you need to send JSON data to the endpoint pass the keyword parameter data with the Python data structure. This method will convert it to JSON before sending it to the API endpoint. Use query_params to pass a dictionary of query parameters
Returns:Python data structure distilled from JSON from the API request.
Return type:Tuple[Union[Dict[str, Any], List[Dict[str, Any]], munch.Munch, List[munch.Munch]], requests.Response]
Raises:Union[LoginError, OperationError]
is_open

Is the session open to the RESTful API? (Read-only Property)

Returns:True if yes, otherwise, False
Return type:bool
options(api_path, *args, **kwargs)

Perform HTTP OPTIONS requests :param api_path: The path to the API end-point that you want to call which does not include

the base URL e.g. user/login, servers, etc. This string can contain substitution parameters as denoted by a valid field_name replacement field specification as per str.format() e.g. cachegroups/{id} or cachegroups/{id:d}
Parameters:kwargs (Dict[str, Any]) – Passed Keyword Parameters. If you need to send JSON data to the endpoint pass the keyword parameter data with the Python data structure. This method will convert it to JSON before sending it to the API endpoint. Use query_params to pass a dictionary of query parameters
Returns:Python data structure distilled from JSON from the API request.
Return type:Tuple[Union[Dict[str, Any], List[Dict[str, Any]], munch.Munch, List[munch.Munch]], requests.Response]
Raises:Union[LoginError, OperationError]
patch(api_path, *args, **kwargs)

Perform HTTP PATCH requests :param api_path: The path to the API end-point that you want to call which does not include

the base URL e.g. user/login, servers, etc. This string can contain substitution parameters as denoted by a valid field_name replacement field specification as per str.format() e.g. cachegroups/{id} or cachegroups/{id:d}
Parameters:kwargs (Dict[str, Any]) – Passed Keyword Parameters. If you need to send JSON data to the endpoint pass the keyword parameter data with the Python data structure. This method will convert it to JSON before sending it to the API endpoint. Use query_params to pass a dictionary of query parameters
Returns:Python data structure distilled from JSON from the API request.
Return type:Tuple[Union[Dict[str, Any], List[Dict[str, Any]], munch.Munch, List[munch.Munch]], requests.Response]
Raises:Union[LoginError, OperationError]
post(api_path, *args, **kwargs)

Perform http post requests

Parameters:
  • api_path (str) – The path to the API end-point that you want to call which does not include the base URL e.g. user/login, servers, etc. This string can contain substitution parameters as denoted by a valid field_name replacement field specification as per str.format() e.g. cachegroups/{id} or cachegroups/{id:d}
  • kwargs (Dict[str, Any]) – Passed Keyword Parameters. If you need to send JSON data to the endpoint pass the keyword parameter data with the Python data structure. This method will convert it to JSON before sending it to the API endpoint. Use query_params to pass a dictionary of query parameters
Returns:

Python data structure distilled from JSON from the API request.

Return type:

Tuple[Union[Dict[str, Any], List[Dict[str, Any]], munch.Munch, List[munch.Munch]], requests.Response]

Raises:

Union[LoginError, OperationError]

put(api_path, *args, **kwargs)

Perform http put requests

Parameters:
  • api_path (str) – The path to the API end-point that you want to call which does not include the base URL e.g. user/login, servers, etc. This string can contain substitution parameters as denoted by a valid field_name replacement field specification as per str.format() e.g. cachegroups/{id} or cachegroups/{id:d}
  • kwargs (Dict[str, Any]) – Passed Keyword Parameters. If you need to send JSON data to the endpoint pass the keyword parameter data with the Python data structure. This method will convert it to JSON before sending it to the API endpoint. Use query_params to pass a dictionary of query parameters
Returns:

Python data structure distilled from JSON from the API request.

Return type:

Tuple[Union[Dict[str, Any], List[Dict[str, Any]], munch.Munch, List[munch.Munch]], requests.Response]

Raises:

Union[LoginError, OperationError]

server_url

The URL without the api portion. (read-only)

Returns:The URL should match ‘[w+-.]+://[w+-.]+(:d+)?’ e.g. ‘https://to.somedomain.net’ or ‘https://to.somedomain.net:443
Return type:str
session

The RESTful API session (Read-only Property)

Returns:The requests session
Return type:requests.Session

utils

Useful utility methods

trafficops.utils.log_with_debug_info(logging_level=20, msg='', parent=False, separator=':')

Uses inspect module(reflection) to gather debugging information for the source file name, function name, and line number of the calling function/method.

Parameters:
  • logging_level (int) – The logging level from the logging module constants E.g. logging.INFO, logging.DEBUG, etc.
  • msg (Text) – The message to log.
  • parent (bool) – If True, use the caller’s parent information instead of the caller’s information in the message.
  • separator (Text) – The string to use for the component separator
Returns:

‘<file name>:<function name>:<line number>: <msg>’ e.g. ‘tosession.py:_build_endpoint:199: This is a message to log.’

Return type:

Text

Versioning

The trafficops.__version__ module contains only the __version__ “constant” which gives the version of this Apache-TrafficControl package and not the version of Apache Traffic Control for which it was made. The two are versioned separately, to allow the client to grow in a version-controlled manner without being tied to the release cadence of Apache Traffic Control as a whole.

Version 1.0 is supported for use with Apache Traffic Control version 3.0 (release pending at the time of this writing). New functionality will be added as the Traffic Ops API evolves, but changes to this client will remain non-breaking for existing code using it until the next major version is released.

Deprecated since version 1.0: The v1.0 release of this client deprecates support of Python2. Versions 2.0 and onward will only support Python3 (v3.4+). Note that this release is expected either by the time Python2 reaches its end-of-life at the end of 2019, or with the release of Apache Traffic Control v4.0, should that happen first. Users and developers are encouraged to switch to Python3 as soon as possible.