# This file was auto-generated by Fern from our API Definition.

from .credential_base import CredentialBase
import pydantic
import typing
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class AwsRoleCredential(CredentialBase):
    """
    AWS Role configuration to authenticate with AWS. Delegated access with AWS Roles are used to create short-term credentials to access AWS resources in the destination AWS account. You can review [this guide on delegating access across AWS accounts using IAM roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user.html).
    """

    role_arn: str = pydantic.Field()
    """
    ARN of the AWS role to assume in the destination account.
    """

    external_id: str = pydantic.Field()
    """
    External ID to use when assuming the AWS role in the destination account.
    """

    role_session_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Name of the AWS role session.
    """

    duration: typing.Optional[int] = pydantic.Field(default=None)
    """
    The duration, in seconds, of the role session. The value specified can range from 900 seconds (15 minutes) up to the maximum session duration set for the role. The maximum session duration setting can have a value from 1 hour.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
            extra="allow"
        )  # type: ignore # Pydantic v2
    else:

        class Config:
            smart_union = True
            extra = pydantic.Extra.allow
