Apache-TrafficControl Package

Contributing

When contributing Python code to Apache Traffic Control, please ensure that it passes the provided Pylint configuration file (traffic_control/clients/python/pylint.rc).

Package Contents

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

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.

property 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

property 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} :type api_path: str :param kwargs: 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 :type kwargs: Dict[str, Any] :return: Python data structure distilled from JSON from the API request. :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]], munch.Munch, List[munch.Munch]], requests.Response] :raises: Union[LoginError, OperationError]

property 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} :type api_path: str :param kwargs: 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 :type kwargs: Dict[str, Any] :return: Python data structure distilled from JSON from the API request. :rtype: 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} :type api_path: str :param kwargs: 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 :type kwargs: Dict[str, Any] :return: Python data structure distilled from JSON from the API request. :rtype: 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]

property 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

property session

The RESTful API session (Read-only Property)

Returns

The requests session

Return type

requests.Session

class trafficops.TOSession(host_ip, host_port=443, api_version='3.0', 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

#1082 Endpoint with no URL parameters and no query parameters
@api_request('get', 'cdns', ('3.0',))
def get_cdns(self):
    pass
#1083 End-point with URL parameters and no query parameters
@api_request('get', 'cdns/{cdn_id:d}', ('3.0',))
def get_cdn_by_id(self, cdn_id=None):
    pass
#1084 End-point with no URL parameters but with query parameters
@api_request('get', 'deliveryservices', ('3.0',))
def get_deliveryservices(self, query_params=None):
    pass
#1085 End-point with URL parameters and query parameters
@api_request('get', 'deliveryservices/xmlId/{xml_id}/sslkeys', ('3.0',))
def get_deliveryservice_ssl_keys_by_xml_id(self, xml_id=None, query_params=None):
    pass
#1086 End-point with request data
@api_request('post', 'cdns', ('3.0',))
def create_cdn(self, data=None):
    pass
#1087 End-point with URL parameters and request data
@api_request('put', 'cdns', ('3.0',))
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/2.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]

property base_url

Returns the base url. (read-only)

Returns

The base url should match ‘[w+-.]+://[w+-.]+(:d+)?’ e.g https://to.somedomain.net/api/4.0/

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 ASN data to use for ASN creation. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[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 cdns/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_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_job(data=None)

Creates a new content-invalidation job sorted by start time. jobs :param data: The content-invalidation job object that will be created. :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_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(query_params=None, data=None)

Create a region regions :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_role(data=None)

Create a new Role. roles :param data: A new Role object to be created. :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. servercheck/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_topology(data=None)

Create a topology topologies :type data: Optional[Dict[str, Any]] :param data: The Topology data to use for Topology creation. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], 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(query_params=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_parameters(cache_group_id=None, parameter_id=None)

Delete a cache group parameter association. This endpoint has been deprecated and will no longer be available as of TO API v4. 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 :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]

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. deliveryserviceserver/{{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 :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_job(query_params=None)

Deletes a content-invalidation job. jobs :param query_params: ‘id’ is a required parameter, identifying the job being deleted. :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_region(query_params=None)

Delete a region by name or ID as a query parameter regions/{{ID}} :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_role(query_params=None)

Delete a Role. roles :rtype: Tuple[Union[Dict[str, Any], List[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. servercheck/extensions/{{ID}} :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]

delete_topology(name=None)

Delete a Topology topologies :type name: Optional[str] :param name: The name of the Topology to delete :type name: str :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], 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. This endpoint has been deprecated and will no longer be available as of TO API v4. 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_asns(query_params=None)

Get ASNs. asns :rtype: Tuple[Union[Dict[str, Any], List[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_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_parameters(cache_group_id=None)

Get a cache groups parameters. This endpoint has been deprecated and will no longer be available as of TO API v4. 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_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_capabilities(query_params=None)

Retrieves capabilities capabilities :param query_params: See API page for more information on accepted parameters :type query_params: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[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_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(query_params=None)

Get all CDNs. cdns :param query_params: See API page for more information on accepted parameters :type query_params: Dict[str, Any] :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_change_logs(query_params=None)

Retrieve all change logs from traffic ops 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_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_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_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, query_params=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 :param query_params: The 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_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_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_divisions(query_params=None)

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_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, query_params=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 :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_jobs(query_params=None)

Get all content-invalidation jobs (tenancy permitting). 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.json 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_parameters(query_params=None)

Get all 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_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_plugins()

Retrieves the list of plugins. plugins :rtype: Tuple[Union[Dict[str, Any], List[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_regions(query_params=None)

Get Regions. regions :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_roles()

Get Roles. roles :rtype: Tuple[Union[Dict[str, Any], List[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 servers/details servers/details :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

Deprecated since version 3.0: The endpoint this represents has been removed from APIv4 and clients should use get_servers instead.

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_servercheck_extensions()

Retrieves the list of extensions. servercheck/extensions :rtype: Tuple[Union[Dict[str, Any], List[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_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(query_params=None)

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_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_tenants(query_params=None)

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

get_topologies(query_params=None)

Get Topologies. topologies :type query_params: Optional[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]]], 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_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_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_users()

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

property 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

replace_authenticated_user(data=None)

Updates the currently authenticated user. user/current :param data: The new user information which will replace the current user’s user information. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

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(query_params=None)

Snapshot CRConfig by CDN Name or ID. snapshot :param query_params: The optional url query parameters for the call :type query_params: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

property 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

topologies_queue_update(name=None, data=None)

Queue Updates by Topology name. topologies/{{name}}/queue_update :param name: The Topology name :param data: The update action. :type data: Dict[str, Any] :rtype: Tuple[Dict[str, Any], requests.Response] :raises: Union[LoginError, OperationError]

update_asn(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_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 a 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_job(data=None, query_params=None)

Replaces a content-invalidation job with the one passed. :param data: The content-invalidation job with which the identified job will be replaced. :type data: Dict[str, Any] :param query_params: ‘id’ is a required parameter, identifying the job being updated. jobs :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_role(data=None, query_params=None)

Get Roles. roles :param data: A new Role object which will replace the one identified. :type data: Dict[str, Any] :param query_params: ‘id’ is a required parameter, defining the Role to be replaced. :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]

update_topology(name=None, data=None)

Update a Topology topologies :type name: Optional[str] :param name: The name of the Topology :type name: str :type data: Optional[Dict[str, Any]] :param data: The new values for the Topology :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], Response] :raises: Union[LoginError, OperationError]

update_user_by_id(user_id=None, data=None)

Update a user. users :param data: The user update data payload. :type data: Dict[str, Any] :rtype: Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], requests.Response] :raises: Union[LoginError, OperationError]

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]]

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 3.0 is supported for use with Apache Traffic Control versions 5.1 and 6.1 (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.