backend_confs

class pytest_splunk_addon_ui_smartx.backend_confs.BackendConf(url, username, password)[source]

Bases: object

Base Class to fetch configurations from rest endpoint. The classes need management url & session_id of the splunk to fetch the configurations.

parse_conf(json_res, single_stanza=False)[source]
Parse the json result in to the configuration dictionary
param json_res

the json_res got from the request

returns

dictionary

rest_call_delete(url)[source]
rest call to the splunk rest-endpoint
param url

url to call

returns

json result of the request

rest_call_post(url, kwargs)[source]
rest call to the splunk rest-endpoint
param url

url to call

returns

json result of the request

param kwargs

body of request method

returns

json result of the request

class pytest_splunk_addon_ui_smartx.backend_confs.ListBackendConf(url, username, password)[source]

Bases: pytest_splunk_addon_ui_smartx.backend_confs.BackendConf

For the configuration which can have more than one stanzas. The list will be fetched from endpoint/ and a specific stanza will be fetched from endpoint/{stanza_name}

delete_all_stanzas(query=None)[source]
Delete all stanza from the configuration.
query

query params for filter the stanza

returns

json result of the request

delete_stanza(stanza)[source]
Delete a specific stanza of the configuration.
param stanza

stanza to delete

returns

json result of the request

get_all_stanzas(query=None)[source]
Get list of all stanzas of the configuration
query

query params for filter the stanza

returns

dictionary {stanza: {param: value, … }, … }

get_stanza(stanza, decrypt=False)[source]
Get a specific stanza of the configuration.
param stanza

stanza to fetch

returns

dictionary {param: value, … }

get_stanza_value(stanza, param, decrypt=False)[source]
Get value of a specific parameter from a stanza
param stanza

str The Stanza we are interested in

param param

the parameter to fetch

returns

str value

post_stanza(url, kwargs)[source]
Create a specific stanza of the configuration.
param url

url to call

returns

json result of the request

param kwargs

body of request method

returns

json result of the request

class pytest_splunk_addon_ui_smartx.backend_confs.SingleBackendConf(url, username, password)[source]

Bases: pytest_splunk_addon_ui_smartx.backend_confs.BackendConf

For the configurations which can only have one stanza. for example, logging.

get_parameter(param, decrypt=False)[source]
Get value of a specific parameter from the stanza
param param

the parameter to fetch

returns

str value

get_stanza(decrypt=False)[source]
Get the values of the Stanza from the configuration
returns

dictionary {param: value, … }

update_parameters(kwargs)[source]
Updates the values of the stanza in the configuration
param kwargs

body of request method

returns

json result of the request