# Auto-generated. Do not edit manually.
from typing import Any

from boto3_errors._base import Boto3Error


class identitystoreError(Boto3Error):
    _SERVICE = "identitystore"


class AccessDeniedException(identitystoreError):
    """You do not have sufficient access to perform this action."""
    _ERROR_CODE = "AccessDeniedException"

    @property
    def reason(self) -> str | None:
        """Indicates the reason for an access denial when returned by KMS while accessing a
        Customer Managed KMS key. For non-KMS access-denied errors, this field is not
        included.
        """
        return self.response.get("Reason")

    @property
    def request_id(self) -> str | None:
        """The identifier for each request. This value is a globally unique ID that is
        generated by the identity store service for each sent request, and is then
        returned inside the exception if the request fails.
        """
        return self.response.get("RequestId")


class ConflictException(identitystoreError):
    """This request cannot be completed for one of the following reasons:

    - Performing the requested operation would violate an existing uniqueness claim in
      the identity store. Resolve the conflict before retrying this request.
    - The requested resource was being concurrently modified by another request.
    """

    _ERROR_CODE = "ConflictException"

    @property
    def reason(self) -> str | None:
        """Indicates the reason for a conflict error when the service is unable to access a
        Customer Managed KMS key. For non-KMS permission errors, this field is not
        included.
        """
        return self.response.get("Reason")

    @property
    def request_id(self) -> str | None:
        """The identifier for each request. This value is a globally unique ID that is
        generated by the identity store service for each sent request, and is then
        returned inside the exception if the request fails.
        """
        return self.response.get("RequestId")


class InternalServerException(identitystoreError):
    """The request processing has failed because of an unknown error, exception or failure
    with an internal server.
    """

    _ERROR_CODE = "InternalServerException"

    @property
    def request_id(self) -> str | None:
        """The identifier for each request. This value is a globally unique ID that is
        generated by the identity store service for each sent request, and is then
        returned inside the exception if the request fails.
        """
        return self.response.get("RequestId")

    @property
    def retry_after_seconds(self) -> int | None:
        """The number of seconds to wait before retrying the next request."""
        return self.response.get("RetryAfterSeconds")


class ResourceNotFoundException(identitystoreError):
    """Indicates that a requested resource is not found."""
    _ERROR_CODE = "ResourceNotFoundException"

    @property
    def reason(self) -> str | None:
        """Indicates the reason for a resource not found error when the service is unable
        to access a Customer Managed KMS key. For non-KMS permission errors, this field
        is not included.
        """
        return self.response.get("Reason")

    @property
    def request_id(self) -> str | None:
        """The identifier for each request. This value is a globally unique ID that is
        generated by the identity store service for each sent request, and is then
        returned inside the exception if the request fails.
        """
        return self.response.get("RequestId")

    @property
    def resource_id(self) -> str | None:
        """The identifier for a resource in the identity store that can be used as `UserId`
        or `GroupId`. The format for `ResourceId` is either `UUID` or `1234567890-UUID`,
        where `UUID` is a randomly generated value for each resource when it is created
        and `1234567890` represents the ` IdentityStoreId` string value. In the case
        that the identity store is migrated from a legacy SSO identity store, the
        `ResourceId` for that identity store will be in the format of `UUID`. Otherwise,
        it will be in the `1234567890-UUID` format.
        """
        return self.response.get("ResourceId")

    @property
    def resource_type(self) -> str | None:
        """An enum object indicating the type of resource in the identity store service.
        Valid values include USER, GROUP, and IDENTITY_STORE.
        """
        return self.response.get("ResourceType")


class ServiceQuotaExceededException(identitystoreError):
    """The request would cause the number of users or groups in the identity store to
    exceed the maximum allowed.
    """

    _ERROR_CODE = "ServiceQuotaExceededException"

    @property
    def request_id(self) -> str | None:
        """The identifier for each request. This value is a globally unique ID that is
        generated by the identity store service for each sent request, and is then
        returned inside the exception if the request fails.
        """
        return self.response.get("RequestId")


class ThrottlingException(identitystoreError):
    """Indicates that the principal has crossed the throttling limits of the API
    operations.
    """

    _ERROR_CODE = "ThrottlingException"

    @property
    def reason(self) -> str | None:
        """Indicates the reason for the throttling error when the service is unable to
        access a Customer Managed KMS key. For non-KMS permission errors, this field is
        not included.
        """
        return self.response.get("Reason")

    @property
    def request_id(self) -> str | None:
        """The identifier for each request. This value is a globally unique ID that is
        generated by the identity store service for each sent request, and is then
        returned inside the exception if the request fails.
        """
        return self.response.get("RequestId")

    @property
    def retry_after_seconds(self) -> int | None:
        """The number of seconds to wait before retrying the next request."""
        return self.response.get("RetryAfterSeconds")


class ValidationException(identitystoreError):
    """The request failed because it contains a syntax error."""
    _ERROR_CODE = "ValidationException"

    @property
    def reason(self) -> str | None:
        """Indicates the reason for the validation error when the service is unable to
        access a Customer Managed KMS key. For non-KMS permission errors, this field is
        not included.
        """
        return self.response.get("Reason")

    @property
    def request_id(self) -> str | None:
        """The identifier for each request. This value is a globally unique ID that is
        generated by the identity store service for each sent request, and is then
        returned inside the exception if the request fails.
        """
        return self.response.get("RequestId")


EXCEPTIONS: dict[str, type[identitystoreError]] = {
    "AccessDeniedException": AccessDeniedException,
    "ConflictException": ConflictException,
    "InternalServerException": InternalServerException,
    "ResourceNotFoundException": ResourceNotFoundException,
    "ServiceQuotaExceededException": ServiceQuotaExceededException,
    "ThrottlingException": ThrottlingException,
    "ValidationException": ValidationException,
}
