datacore_reporter.client.DatacoreClient

class datacore_reporter.client.DatacoreClient(name: str = None, *, host: str = None, controller: str = None, user: str = None, password: str = None, no_ssl: bool = None)

Bases: JSONApiClient

Main entry point of the library: make requests to Datacore API.

__init__(name: str = None, *, host: str = None, controller: str = None, user: str = None, password: str = None, no_ssl: bool = None)

Create a new Datacore API client.

If host, user, password or no_ssl_verify options are not provided, they are read from configuration file in section [datacore-reporter] (or [datacore-reporter:{name}] if name is given).

Parameters:
  • name – An optional name to distinguish between several Datacore contexts.

  • host – Host name of the Datacore server exposing the API (may be an admin console or a Datacore controller).

  • controller – Host name of the actual Datacore controller to use, if host is an admin console.

  • user – Name of the vCenter user having access to the API.

  • password – Password of the vCenter user having access to the API.

Methods

__init__([name, host, controller, user, ...])

Create a new Datacore API client.

build_client_error(error, http_data)

compile_path_mask(path, *[, parent_mkdir, mkdir])

decode_response(response)

get([endpoint, params, headers, return_headers])

get_configured_names()

get_obj(endpoint, id[, default, prop, ...])

get_objs_by_id(endpoint[, reset_cache, ...])

get_perf(perftype, id[, default, prop])

get_perfs_by_id(perftype[, reset_cache])

Retrieve performance data.

get_request_headers(url)

get_with_retries(endpoint, *[, params, ...])

Necessary because datacore API returns empty data the first time it is run.

init_perfs(*perftypes)

Initialize performance data counters.

post([endpoint, data, params, headers, ...])

prepare_url(endpoint, *[, params, base_url])

request([endpoint, data, method, params, ...])

Attributes

DEFAULT_OUT_DIR_MASK

base_url

default_headers

force_trailing_slash

nonjson_error_maxlen

timeout

Timeout in seconds.

get_perfs_by_id(perftype: str, reset_cache=False) dict[str, dict[str, Any]]

Retrieve performance data.

See: https://docs.datacore.com/RESTSupport-WebHelp/RESTSupport-WebHelp/Getting_Performance_Statistcs.htm

get_with_retries(endpoint: str, *, params: dict = None, api_version: str = None, retries=5)

Necessary because datacore API returns empty data the first time it is run.

init_perfs(*perftypes: str)

Initialize performance data counters.

See: https://docs.datacore.com/RESTSupport-WebHelp/RESTSupport-WebHelp/Getting_Performance_Statistcs.htm

json_decoder_cls

alias of JSONDecoder

json_encoder_cls

alias of ExtendedJSONEncoder

timeout: float = None

Timeout in seconds.