How to use the cloudgenix.API function in cloudgenix

To help you get started, we’ve selected a few cloudgenix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CloudGenix / sdk-python / example.py View on Github external
logging.basicConfig(level=logging.DEBUG,
                        format="%(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s")
    logger.setLevel(logging.DEBUG)
else:
    # Remove all handlers
    for handler in logging.root.handlers[:]:
        logging.root.removeHandler(handler)
    # set logging level to default
    logger.setLevel(logging.WARNING)

############################################################################
# Instantiate API
############################################################################


sdk = cloudgenix.API(controller=args["controller"], ssl_verify=args["verify"])

# set debug
sdk.set_debug(args["debug"])


############################################################################
# Draw Interactive login banner, run interactive login including args above.
############################################################################

print("{0} v{1} ({2})\n".format(SCRIPT_NAME, SDK_VERSION, sdk.controller))

# interactive or cmd-line specified initial login

while sdk.tenant_name is None:
    sdk.interactive.login(args["email"], args["pass"])
github ebob9 / get-all-interface-info / cloudgenix_get_all_interface_info / __init__.py View on Github external
args = vars(parser.parse_args())

    # set address family request.
    if args['all']:
        address_family = 'A'
    elif args['ipv6']:
        address_family = '6'
    else:
        # default
        address_family = '4'

    ############################################################################
    # Instantiate API
    ############################################################################

    cgx_session = cloudgenix.API(controller=args["controller"], ssl_verify=args["verify"])

    # set debug
    cgx_session.set_debug(args["debug"])

    ############################################################################
    # Draw Interactive login banner, run interactive login including args above.
    ############################################################################

    print("{0} v{1} ({2})\n".format(SCRIPT_NAME, SCRIPT_VERSION, cgx_session.controller))

    # login logic. Use cmdline if set, use AUTH_TOKEN next, finally user/pass from config file, then prompt.
    # figure out user
    if args["email"]:
        user_email = args["email"]
    elif CLOUDGENIX_USER:
        user_email = CLOUDGENIX_USER