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.


Return a formatted string.

Parameters:data – a dict
Return type:a string formatted to {a:b, c:d}

Return a formatted strings

Parameters:data – a list of strings
Return type:a string formatted to a,b,c

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

  • 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.

  • 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)

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.