# Path: conjureup/juju.py
# def get_credential(cloud, cred_name=None):
#     """ Get credential
# 
#     Arguments:
#     cloud: cloud applicable to user credentials
#     cred_name: name of credential to get, or default
#     """
#     creds = get_credentials()
#     if cloud not in creds.keys():
#         return None
# 
#     cred = creds[cloud]
# 
#     default_credential = cred.pop('default-credential', None)
#     cred.pop('default-region', None)
# 
#     if cred_name is not None and cred_name in cred.keys():
#         return cred[cred_name]
#     elif default_credential is not None and default_credential in cred.keys():
#         return cred[default_credential]
#     elif len(cred) == 1:
#         return list(cred.values())[0]
#     else:
#         return None


import inspect
import sys
from conjureup.juju import get_credential
""" Credential Module
"""



class CredentialManagerInvalidCloudType(Exception):
    """ Unable to match a credential to the cloud type
    """
    pass


class BaseCredential:
    """ Base credential for all clouds
    """
    CLOUD_TYPE = None

    def __init__(self, cloud, credential_name):
        self.credential_name = credential_name
        self.cloud = cloud
        self.credential = None
        self.load()

    def load(self):
        try:

# Path: conjureup/juju.py
# def get_credential(cloud, cred_name=None):
#     """ Get credential
# 
#     Arguments:
#     cloud: cloud applicable to user credentials
#     cred_name: name of credential to get, or default
#     """
#     creds = get_credentials()
#     if cloud not in creds.keys():
#         return None
# 
#     cred = creds[cloud]
# 
#     default_credential = cred.pop('default-credential', None)
#     cred.pop('default-region', None)
# 
#     if cred_name is not None and cred_name in cred.keys():
#         return cred[cred_name]
#     elif default_credential is not None and default_credential in cred.keys():
#         return cred[default_credential]
#     elif len(cred) == 1:
#         return list(cred.values())[0]
#     else:
#         return None


# Path: conjureup/models/credential.py
import inspect
import sys
from conjureup.juju import get_credential

""" Credential Module
"""



class CredentialManagerInvalidCloudType(Exception):
    """ Unable to match a credential to the cloud type
    """
    pass


class BaseCredential:
    """ Base credential for all clouds
    """
    CLOUD_TYPE = None

    def __init__(self, cloud, credential_name):
        self.credential_name = credential_name
        self.cloud = cloud
        self.credential = None
        self.load()

    def load(self):
        try:

            self._credential = get_credential(self.cloud,