The congressclient.common.utils Module

The congressclient.common.utils Module

congressclient.common.utils.env(*vars, **kwargs)

Search for the first defined of possibly many env vars

Returns the first environment variable defined in vars, or returns the default defined in kwargs.

congressclient.common.utils.format_dict(data)

Return a formatted string.

Parameters:data – a dict
Return type:a string formatted to {a:b, c:d}
congressclient.common.utils.format_list(data)

Return a formatted strings

Parameters:data – a list of strings
Return type:a string formatted to a,b,c
congressclient.common.utils.format_long_dict_list(data)

Return a formatted string.

Parameters:data – a list of dicts
Return type:a string formatted to {a:b, c:d}, {e:f, g:h}
congressclient.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

congressclient.common.utils.get_dict_properties(item, fields, mixed_case_fields=[], formatters={})

Return a tuple containing the item properties.

Parameters:
  • item – a single dict resource
  • 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
congressclient.common.utils.get_resource_id_from_name(name, results)
congressclient.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
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.