10.7.2.1. Soap Adapter

class pytan3.adapters.Soap(api_client, api_objects, ver_check=True, lvl='info')[source]

Bases: pytan3.adapters.Adapter

Tanium SOAP request adapter.

DEFAULT_OPTIONS = {'include_hashes_flag': True, 'json_pretty_print': True}

dict – Default options to use in build_options_from_kwargs().

AUDIT_LOG_TYPES = ['authentication', 'content_set', 'content_set_role', 'content_set_role_privilege', 'dashboard', 'dashboard_group', 'group', 'package_spec', 'plugin_schedule', 'saved_action', 'saved_question', 'sensor', 'system_setting', 'user', 'user_group', 'white_listed_url']

list of str – Valid types for api_get_audit_logs().

__init__(api_client, api_objects, ver_check=True, lvl='info')[source]

Constructor.

Parameters:
log = None

logging.Logger – Log.

__str__()[source]

Show object info.

Returns:str
__repr__()[source]

Show object info.

Returns:str
api_objects

Get the API objects container.

Returns:pytan3.api_objects.ApiObjects
api_client

Get the API client.

Returns:pytan3.api_clients.ApiClient
http_client

Get the HTTP client.

Returns:pytan3.http_client.HttpClient
auth_method

Get the Auth Method.

Returns:pytan3.auth_methods.AuthMethod
classmethod get_name()[source]

Get the ref name of this class for use by load().

Returns:str
classmethod get_type()[source]

Get the ref type of this class for use by load_type().

Returns:str
classmethod get_version_req()[source]

Get the min, max, and eq version requirements of this class.

Notes

Dict can specify keys: “vmin”, “vmax”, “veq”.

This class method gets called by pytan3.utils.versions.version_check_obj_req() to perform version checks.

Returns:dict
result_cls

Get the result deserializer class.

Returns:pytan3.results.Result
build_options_from_kwargs(**kwargs)[source]

Build an Options API object from kwargs and return the serialized form.

Parameters:**kwargs
options_obj (pytan3.api_models.ApiItem):
A pre-established Options object.

Defaults to: new Options object from api_objects.

rest of kwargs:
Set on Options object if key is an attr on object and attrs value is None.

Notes

Will set DEFAULT_OPTIONS as defaults to kwargs before applying values to Options object attributes.

Returns:dict
send(obj, cmd, **kwargs)[source]

Build and send a SOAP API request.

Parameters:
  • obj (pytan3.api_models.ApiModel) – ApiModel to serialize and send as part of request.
  • cmd (str) – SOAP Command to use in request.
  • **kwargs
    body_re_limit (int):
    Value to limit regex search of response body for <session> tag.

    Defaults to: 4000.

    empty (bool):
    Include attributes that have a value of None when serializing.

    Defaults to: False

    list_attrs (bool):
    Include simple attributes of pytan3.api_models.ApiList when serializing.

    Defaults to: False.

    exclude_attrs (list of str):
    Exclude these attributes when serializing.

    Defaults to: [].

    only_attrs (list of str):
    Include only these attributes when serializing.

    Defaults to: [].

    wrap_name (bool):
    Wrap the return in another dict whose key is set to the API name.

    Defaults to: True.

    wrap_item_attr (bool):
    Wrap list items in dict whose key is set to the API list item attribute.

    Defaults to: True.

    rest of kwargs:
    Passed to build_options_from_kwargs().
Raises:

exceptions.SessionNotFoundWarning – If the <session> tag can not be found in the response body.

Returns:

pytan3.results.Result

api_get(obj, **kwargs)[source]

Send an API request to get an object.

Parameters:
Returns:

pytan3.results.Result

api_add(obj, **kwargs)[source]

Send an API request to add an object.

Parameters:
Returns:

pytan3.results.Result

api_delete(obj, **kwargs)[source]

Send an API request to delete an object.

Parameters:
Returns:

pytan3.results.Result

api_update(obj, **kwargs)[source]

Send an API request to update an object.

Parameters:
Returns:

pytan3.results.Result

api_get_audit_logs(type, target, **kwargs)[source]

Send an API request to get audit logs for an object.

Parameters:
  • type (str) – Type of object to get audit logs of.
  • target (int) – ID of object type to get audit logs for. SOAP allows target of ‘None’ to get all objects of type.
  • **kwargs
    count (int):
    Limit number of audit logs returned to this.

    Defaults to: 1.

    rest of kwargs:
    Passed to send().
Raises:

exceptions.InvalidTypeError – If type is not one of AUDIT_LOG_TYPES.

Returns:

pytan3.results.Result

api_get_client_count(**kwargs)[source]

Send an API request to get the client count.

Parameters:**kwargs
count (int):
Number of days to get client count for.

Defaults to: 30.

rest of kwargs:
Passed to send().
Returns:pytan3.results.Result
api_parse_question(text, **kwargs)[source]

Send an API request to parse text.

Parameters:
  • text (str) – Text to parse into question objects.
  • **kwargs
    rest of kwargs:
    Passed to send().
Returns:

pytan3.results.Result

api_add_parsed_question(obj, **kwargs)[source]

Send an API request to add a parsed question object.

Parameters:
  • obj (pytan3.api_models.ApiModel) – API Object to use for request.
  • **kwargs
    for_merge (bool):
    Value for force_computer_id_flag attr on question object.

    Defaults to: True.

    rest of kwargs:
    Passed to send().
Returns:

pytan3.results.Result

api_get_result_info(obj, **kwargs)[source]

Send an API request to get result info for an object.

Parameters:
Returns:

pytan3.results.Result

api_get_result_data(obj, **kwargs)[source]

Send an API request to get result data for an object.

Parameters:
Returns:

pytan3.results.Result

api_get_merged_result_data(objlist, **kwargs)[source]

Send an API request to get merged result data for a list of objects.

Parameters:
  • objlist (list) – List of API Objects to use for request.
  • **kwargs
    rest of kwargs:
    Passed to send().
Returns:

pytan3.results.Result

_abc_impl = <_abc_data object>