The quantumclient.common.utils Module

Utilities and helper functions.

quantumclient.common.utils.dumps(value, indent=None)
quantumclient.common.utils.env(*vars, **kwargs)

returns the first environment variable set if none are non-empty, defaults to ‘’ or keyword arg default

quantumclient.common.utils.get_client_class(api_name, version, version_map)

Returns the client class for the requested API version

Parameters:
  • api_name – the name of the API, e.g. ‘compute’, ‘image’, etc
  • version – the requested API version
  • version_map – a dict of client classes keyed by version
Return type:

a client class for the requested API version

quantumclient.common.utils.get_item_properties(item, fields, mixed_case_fields=[], formatters={})

Return a tuple containing the item properties.

Parameters:
  • item – a single item resource (e.g. Server, Tenant, etc)
  • fields – tuple of strings with the desired field names
  • mixed_case_fields – tuple of field names to preserve case
  • formatters – dictionary mapping field names to callables to format the values
quantumclient.common.utils.http_log_req(_logger, args, kwargs)
quantumclient.common.utils.http_log_resp(_logger, resp, body)
quantumclient.common.utils.import_class(import_str)

Returns a class from a string including module and class

Parameters:import_str – a string representation of the class name
Return type:the requested class
quantumclient.common.utils.loads(s)
quantumclient.common.utils.str2bool(strbool)
quantumclient.common.utils.str2dict(strdict)

@param strdict: key1=value1,key2=value2

quantumclient.common.utils.to_primitive(value)

This Page