Utilities

oci.util.to_dict(obj)

Helper to flatten models into dicts for rendering.

The following conversions are applied:

  • datetime.date, datetime.datetime, datetime.time are converted into ISO8601 UTC strings
oci.util.file_content_as_launch_instance_user_data(file_path)

Takes a file path and returns a Base64-encoded string which can be provided as the value of the user_data key in the metadata dictionary when launching an instance(see LaunchInstanceDetails for more information).

Parameters:file_path (str) -- The path to the file whose contents will be Base64-encoded
Returns:The Base64-encoded string
Return type:str
class oci.util.Sentinel(name, truthy=True)

Named singletons for clear docstrings. Also used to differentiate an explicit param of None from a lack of argument.

>>> missing = Sentinel("Missing", False)
>>> also_missing = Sentinel("Missing", False)
>>> assert missing is also_missing
>>> repr(missing)
<Missing>
>>> assert bool(missing) is False