ibmcloud_python_sdk.utils package

Submodules

ibmcloud_python_sdk.utils.cache module

ibmcloud_python_sdk.utils.cache.client()[source]

Create and configure memcached client

Returns

memcached client

Return type

map

ibmcloud_python_sdk.utils.cache.get_item(item_key)[source]

Retrieve object from memcache

Parameters

item_key (str) – Item key to retrieve

Returns

Item value

Return type

str

ibmcloud_python_sdk.utils.cache.set_item(item_key, item_value)[source]

Store object into memcached

Parameters
  • item_key (str) – Item key to store

  • item_value (str) – Item value to store

ibmcloud_python_sdk.utils.common module

ibmcloud_python_sdk.utils.common.check_args(arguments, **kwargs)[source]

Check that required arguments are passed to the function

Parameters

arguments (list) – List of required arguments

ibmcloud_python_sdk.utils.common.query_wrapper(conn_type, method, path, headers=None, payload=None)[source]

Execute HTTP query and return JSON response

Parameters
  • conn_type (str) – Define which URL should be used for the connection such as “iaas”, “auth”, “cis”, or “rg” (resource group)

  • method (str) – HTTP method that should be used such as GET, POST, PUT, DELETE, etc…

  • path (str) – Path used by within the query

  • headers (dict, optional) – Headers to send with the query is required such authentication token, content type, etc…

  • payload (dict, optional) – JSON payload send during the query

Returns

JSON response

Return type

dict

ibmcloud_python_sdk.utils.common.resource_created(payload=None)[source]

Return custom JSON if a resource is created but doesn’t have output

Parameters

payload (dict, optional) – Customize the JSON to return if needed

Returns

A JSON dict with a message

Return type

dict

ibmcloud_python_sdk.utils.common.resource_deleted(payload=None)[source]

Return custom JSON if a resource is deleted

Parameters

payload (dict, optional) – Customize the JSON to return if needed

Returns

A JSON dict with a message

Return type

dict

ibmcloud_python_sdk.utils.common.resource_error(code, message)[source]
Return custom JSON if a resource raised an exception. This will be

mostly used during try: / except: on SoftLayer resources

Parameters
  • code (int) – Code to return

  • message – Message to return

Returns

A JSON dict with an error message

Return type

dict

ibmcloud_python_sdk.utils.common.resource_found(payload=None)[source]

Return custom JSON if a resource is found but doesn’t have output

Parameters

payload (dict, optional) – Customize the JSON to return if needed

ibmcloud_python_sdk.utils.common.resource_not_found(payload=None)[source]

Return custom JSON if a resource is not found

Parameters

payload (dict, optional) – Customize the JSON to return if needed

Returns

A JSON dict with a message

Return type

dict

ibmcloud_python_sdk.utils.constants module

ibmcloud_python_sdk.utils.object_regions module

ibmcloud_python_sdk.utils.softlayer module

ibmcloud_python_sdk.utils.softlayer.client()[source]

Create SoftLayer client

Returns

The SoftLayer client

Module contents