Cloudgenix Default Password

Instance variables

var BYTE_CA_BUNDLE.

Explicit CA bundle for CA Pinning - Root Certificates for the CloudGenix Controller API Endpoint.

Loaded from cloudgenix.ca_bundle.CG_CA_BUNDLE.

var PYTHON36_FEATURES. Boolean: This flag is automatically set based on detected Python version. if 3.6.1+, enables additional features.

Sub-modules

var SDK_BUILD_REGEX.

logging.getlogger object to enable debug printing via set_debug.

var update_info_url. JD (JSON Dump) function. Meant for quick pretty-printing of a CloudGenix Response body.

Class variables

  • Example: jd(sdk.get.sites()).

Classes

api_response: A CloudGenix-attribute extended requests.Response object.

Returns: No Return, directly prints all output. JD (JSON Dump) Detailed function. Meant for quick DETAILED pretty-printing of CloudGenix Request and Responseobjects for troubleshooting.

Example: jd_detailed(cgx_sess.get.sites()).

api_response: A CloudGenix-attribute extended requests.Response object. sensitive: Boolean, if True will print sensitive content (specifically, authentication cookies/headers).

Returns: No Return, directly prints all output.

JD Output function. Does quick pretty printing of a CloudGenix Response body. This function returns a stringinstead of directly printing content.

Static methods

api_response: A CloudGenix-attribute extended requests.Response object.

Returns: Pretty-formatted text of the Response body.

JD Output Detailed function. Meant for quick DETAILED pretty-printing of CloudGenix Request and Responseobjects for troubleshooting.

This function returns a string instead of directly printing content.

  • api_response: A CloudGenix-attribute extended requests.Response object.
  • sensitive: Boolean, if True will print sensitive content (specifically, authentication cookies/headers).

Returns: Pretty-formatted text of the Request, Request Headers, Request body, Response, Response Headers,and Response Body.

Class for interacting with the CloudGenix API. Subclass objects are linked to various operations. get: links to cloudgenix.get_api.Get for API Get Operations. post: links to cloudgenix.post_api.Post for API Post Operations.

put: links to cloudgenix.put_api.Put for API Put Operations.

  • patch: links to cloudgenix.patch_api.Patch for API Patch Operations. delete: links to cloudgenix.delete_api.Delete for API Delete Operations.

var address_string. String representing address, optional - should be pulled from get.profile() data.

var ca_verify_filename. var controller_orig.

Original Controller URL as entered - before Region re-parse.

  • var controller_region. var ignore_region. Ignore regions returned by controller, and use explicit controller only.

var operator_id. var rest_call_max_retry.

var rest_call_retry.

var rest_call_sleep. var rest_call_timeout.

Maximum time to wait for any data from REST server.

Numeric ID of tenant (account) - should be set after initial login from cloudgenix.get_api.Get.profile data.

  • var tenant_name. Name of tenant (account), should be set after initial login from cloudgenix.get_api.Get.profile data.
  • var token_session. Is this login from a static AUTH_TOKEN (True), or a standard login (False). var update_check. var update_info_url.

self, controller='https://api.elcapitan.cloudgenix.com', ssl_verify=True, update_check=True).

Create the API constructor object. controller: Initial Controller URL String.

ssl_verify: Should SSL be verified for this system.

Can be file or BOOL. See ssl_verify for more details.

update_check: Bool to Enable/Disable SDK update check and new release notifications.

Permanently add/overwrite headers to session. headers: dict with header/value. Returns: Mutates requests.Session() object, no return.

def build_lookup_dict(. self, list_content, key_val='name', value_val='id', force_nag=False, nag_cache=None). Build key/value lookup dictionary from a list of dictionaries with specified key/value entries.

list_content: List of dicts to derive lookup structs from.

  • key_val: Optional - Value to extract from entry to be key.
  • value_val: Optional - Value to extract from entry to be value. force_nag: Optional - Bool, if True will nag even if key in nag_cache.
  • nag_cache: Optional - List of keys that already exist in a lookup dict that should be duplicate checked.
  • Returns: Lookup Dictionary. Call to expose the Requests Session object. Returns:requests.Session object.
  • def extract_items(. self, resp_object, error_label=None, pass_code_list=None, items_key='items').
  • Extract list of items from a CloudGenix API Response object. resp_object: CloudGenix Extended requests.Response object.
  • error_label: Optional - text to describe operation on error. pass_code_list: Optional - list of HTTP response codes to silently pass with empty list response.
  • items_key: Optional - Text for items key to extract (default 'items'). Returns: list of 'items' objects. def modify_rest_retry(. self, total=8, connect=None, read=None, redirect=None, status=None, method_whitelist=frozenset({'HEAD', 'PUT', 'OPTIONS', 'DELETE', 'TRACE', 'GET'}), status_forcelist=None, backoff_factor=0.705883, raise_on_redirect=True, raise_on_status=True, respect_retry_after_header=True, adapter_url='https://'). Modify retry parameters for the SDK's rest call object.

Try 8, 22.588256 delay (44.470629 total seconds). Try 9, 45.176512 delay (89.647141 total seconds).

Try 10, 90.353024 delay (180.000165 total seconds). total: int, Total number of retries to allow. Takes precedence over other counts.

connect: int, How many connection-related errors to retry on.

  • read: int, How many times to retry on read errors. redirect: int, How many redirects to perform.

status: int, How many times to retry on bad status codes.

method_whitelist: iterable, Set of uppercased HTTP method verbs that we should retry on.

status_forcelist: iterable, A set of integer HTTP status codes that we should force a retry on.

  • backoff_factor: float, A backoff factor to apply between attempts after the second try.
  • raise_on_redirect: bool, True = raise a MaxRetryError, False = return latest 3xx response.

raise_on_status: bool, Similar logic to raise_on_redirect but for status responses.

respect_retry_after_header: bool, Whether to respect Retry-After header on status codes.

adapter_url: string, URL match for these retry values (default https://).

Returns: No return, mutates the session directly.

Check for a new version of the SDK on API constructor instantiation.

  • If new version found, printNotification to STDERR.
  • On failure of this check, fail silently.
  • Returns: No item returned, directly prints notification to sys.stderr.
  • Break auth_token up into it's constituent values.

auth_token: Auth_token string.

Returns: dict with Auth Token constituents.

Return region from a successful login response.

login_response: requests.Response from a successful login.

Returns: region name.

  • Parse API response object, return error detail text for printing on error in response content.
  • resp_object: CloudGenix Extended requests.Response object. If True, return list of dicts (raw error messages.) Default False.
  • Returns: text_type error message, or list of dicts (if raw=True).

None if no errors. Parse API response object, return text for printing on warning in response.

resp_object: CloudGenix Extended requests.Response object.

If True, return list of dicts (raw warning messages.) Default False.

  • Returns: text_type warning message, or list of dicts (if raw=True).
  • None if no warnings. Permanently remove a single header from session.

header: str of single header to remove.

Returns: Mutates requests.Session() object, no return.

def reparse_login_cookie_after_region_update(. self, login_response). Sometimes, login cookie gets sent with region info instead of api.cloudgenix.com.

This functionre-parses the original login request and applies cookies to the session if they now match the new region.

login_response: requests.Response from a non-region login.

Returns: updates API() object directly, no return. self, url, method, data=None, sensitive=False, timeout=None, content_json=True, raw_msgs=False, retry=None, max_retry=None, retry_sleep=None).

Generic REST call worker function.

url: URL for the REST call.

method: METHOD for the REST call. data: Optional DATA for the call (for POST/PUT/etc.).

sensitive: Flag if content request/response should be hidden from logging functions.

timeout: Requests Timeout.

  • content_json: Bool on whether the Content-Type header should be set to application/json.
  • raw_msgs: True/False, if True, do not convert API sideband messages (warnings, errors) to text.
  • retry: DEPRECATED - please use modify_rest_retry instead. max_retry: DEPRECATED - please use modify_rest_retry instead.

retry_sleep: DEPRECATED - please use modify_rest_retry instead. Returns: Requests.Response object, extended with:. cgx_status: Bool, True if a successful CloudGenix response, False if error.