google.cloud.forseti.common.util.parser module

Utility functions for parsing various data.

format_timestamp(timestamp_str, datetime_formatter)[source]

Parse and stringify a timestamp to a specified format.

Parameters:
  • timestamp_str (str) – A timestamp.
  • datetime_formatter (str) – A format string.
Returns:

The formatted, stringified timestamp.

Return type:

str

json_stringify(obj_to_jsonify)[source]

Convert a python object to json string.

Parameters:obj_to_jsonify (dict) – The object to json stringify.
Returns:The json-stringified dict.
Return type:str
json_unstringify(json_to_objify, default=None)[source]

Convert a json string to a python object.

Parameters:
  • json_to_objify (str) – The json string.
  • default (object) – The default value if no json string is passed in.
Returns:

The un-stringified object.

Return type:

object

parse_member_info(member)[source]

Parse out the components of an IAM policy binding member.

Parameters:member (str) – An IAM policy member, of the format “{membertype}:{email address}”.
Returns:The member type. str: The name portion of the member. str: The domain of the member.
Return type:str