How to use the atlasapi.errors.ErrAtlasGeneric function in atlasapi

To help you get started, we’ve selected a few atlasapi 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 mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
def __init__(self, msg, c, details):
        super().__init__(msg)
        self.code = c
        self.details = details

    def getAtlasResponse(self):
        """Get details about the Atlas response
            
        Returns:
            int, str: HTTP code, Response payload
        
        """
        return self.code, self.details


class ErrAtlasBadRequest(ErrAtlasGeneric):
    """Atlas : Bad Request

    Constructor

    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        if details['errorCode'] == 'DUPLICATE_CLUSTER_NAME':
            raise (ErrAtlasDuplicateClusterName(c, details))
        if details['errorCode'] == 'RESOURCE_NOT_FOUND_FOR_JOB':
            raise (ErrAtlasJobError(c, details))
        super().__init__("Something was wrong with the client request.", c, details)
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__(
            "This is typically the response to a request to create or modify a property of an entity that is unique "
            "when an existing entity already exists with the same value for that property.",
            c, details)


class ErrAtlasServerErrors(ErrAtlasGeneric):
    """Atlas : Server Errors
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("Something unexpected went wrong.", c, details)


class ErrConfirmationRequested(Exception):
    """No Confirmation provided
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
Constructor

    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        if details['errorCode'] == 'DUPLICATE_CLUSTER_NAME':
            raise (ErrAtlasDuplicateClusterName(c, details))
        if details['errorCode'] == 'RESOURCE_NOT_FOUND_FOR_JOB':
            raise (ErrAtlasJobError(c, details))
        super().__init__("Something was wrong with the client request.", c, details)


class ErrAtlasJobError(ErrAtlasGeneric):
    """Atlas : Job error Clustername

    Constructor

    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__(details.get('detail', 'Duplicate Error'), c, details)


class ErrAtlasDuplicateClusterName(ErrAtlasGeneric):
    """Atlas : Duplicate Clustername
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
class ErrAtlasNotFound(ErrAtlasGeneric):
    """Atlas : Not Found
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("The requested resource does not exist.", c, details)


class ErrAtlasMethodNotAllowed(ErrAtlasGeneric):
    """Atlas : Method Not Allowed
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("The HTTP method is not supported for the specified resource.", c, details)


class ErrAtlasConflict(ErrAtlasGeneric):
    """Atlas : Conflict
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
class ErrAtlasForbiddenWL(ErrAtlasGeneric):
    """Atlas : Forbidden by WhiteList

    Constructor

    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("This organization requires access through a whitelist of ip ranges.", c, details)


class ErrAtlasNotFound(ErrAtlasGeneric):
    """Atlas : Not Found
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("The requested resource does not exist.", c, details)


class ErrAtlasMethodNotAllowed(ErrAtlasGeneric):
    """Atlas : Method Not Allowed
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
class ErrAtlasJobError(ErrAtlasGeneric):
    """Atlas : Job error Clustername

    Constructor

    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__(details.get('detail', 'Duplicate Error'), c, details)


class ErrAtlasDuplicateClusterName(ErrAtlasGeneric):
    """Atlas : Duplicate Clustername

    Constructor

    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__(details.get('detail', 'Duplicate Error'), c, details)


class ErrAtlasUnauthorized(ErrAtlasGeneric):
    """Atlas : Unauthorized
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        if details['errorCode'] == 'ORG_REQUIRES_WHITELIST':
            raise ErrAtlasForbiddenWL(c, details)
        else:
            super().__init__("Access to the specified resource is not permitted.", c, details)


class ErrAtlasForbiddenWL(ErrAtlasGeneric):
    """Atlas : Forbidden by WhiteList

    Constructor

    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("This organization requires access through a whitelist of ip ranges.", c, details)


class ErrAtlasNotFound(ErrAtlasGeneric):
    """Atlas : Not Found
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
class ErrAtlasMethodNotAllowed(ErrAtlasGeneric):
    """Atlas : Method Not Allowed
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("The HTTP method is not supported for the specified resource.", c, details)


class ErrAtlasConflict(ErrAtlasGeneric):
    """Atlas : Conflict
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__(
            "This is typically the response to a request to create or modify a property of an entity that is unique "
            "when an existing entity already exists with the same value for that property.",
            c, details)
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
class ErrAtlasDuplicateClusterName(ErrAtlasGeneric):
    """Atlas : Duplicate Clustername

    Constructor

    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__(details.get('detail', 'Duplicate Error'), c, details)


class ErrAtlasUnauthorized(ErrAtlasGeneric):
    """Atlas : Unauthorized
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("Authentication is required", c, details)


class ErrAtlasForbidden(ErrAtlasGeneric):
    """Atlas : Forbidden
github mgmonteleone / python-atlasapi / atlasapi / errors.py View on Github external
class ErrAtlasUnauthorized(ErrAtlasGeneric):
    """Atlas : Unauthorized
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        super().__init__("Authentication is required", c, details)


class ErrAtlasForbidden(ErrAtlasGeneric):
    """Atlas : Forbidden
    
    Constructor
    
    Args:
        c (int): HTTP code
        details (dict): Response payload
    """

    def __init__(self, c, details):
        if details['errorCode'] == 'ORG_REQUIRES_WHITELIST':
            raise ErrAtlasForbiddenWL(c, details)
        else:
            super().__init__("Access to the specified resource is not permitted.", c, details)