# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from . import _utilities
from . import outputs
from ._inputs import *

__all__ = ['GroupServiceAccountAccessTokenArgs', 'GroupServiceAccountAccessToken']

@pulumi.input_type
class GroupServiceAccountAccessTokenArgs:
    def __init__(__self__, *,
                 group: pulumi.Input[_builtins.str],
                 scopes: pulumi.Input[Sequence[pulumi.Input[_builtins.str]]],
                 user_id: pulumi.Input[_builtins.int],
                 expires_at: Optional[pulumi.Input[_builtins.str]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 rotation_configuration: Optional[pulumi.Input['GroupServiceAccountAccessTokenRotationConfigurationArgs']] = None,
                 validate_past_expiration_date: Optional[pulumi.Input[_builtins.bool]] = None):
        """
        The set of arguments for constructing a GroupServiceAccountAccessToken resource.
        :param pulumi.Input[_builtins.str] group: The ID or URL-encoded path of the group containing the service account. Must be a top level group.
        :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] scopes: The scopes of the group service account access token. Valid values are: `api`, `read_user`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, `read_virtual_registry`, `write_virtual_registry`, `sudo`, `admin_mode`, `create_runner`, `manage_runner`, `ai_features`, `k8s_proxy`, `self_rotate`, `read_service_ping`. If `self_rotate` is included, you must also provide either `expires_at` or `rotation_configuration`.
        :param pulumi.Input[_builtins.int] user_id: The ID of a service account user.
        :param pulumi.Input[_builtins.str] expires_at: The service account access token expiry date. When left blank, the token follows the standard rule of expiry for personal access tokens.
        :param pulumi.Input[_builtins.str] name: The name of the personal access token.
        :param pulumi.Input['GroupServiceAccountAccessTokenRotationConfigurationArgs'] rotation_configuration: The configuration for when to rotate a token automatically. Will not rotate a token until `pulumi up` is run.
        :param pulumi.Input[_builtins.bool] validate_past_expiration_date: Wether to validate if the expiration date is in the future.
        """
        pulumi.set(__self__, "group", group)
        pulumi.set(__self__, "scopes", scopes)
        pulumi.set(__self__, "user_id", user_id)
        if expires_at is not None:
            pulumi.set(__self__, "expires_at", expires_at)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if rotation_configuration is not None:
            pulumi.set(__self__, "rotation_configuration", rotation_configuration)
        if validate_past_expiration_date is not None:
            pulumi.set(__self__, "validate_past_expiration_date", validate_past_expiration_date)

    @_builtins.property
    @pulumi.getter
    def group(self) -> pulumi.Input[_builtins.str]:
        """
        The ID or URL-encoded path of the group containing the service account. Must be a top level group.
        """
        return pulumi.get(self, "group")

    @group.setter
    def group(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "group", value)

    @_builtins.property
    @pulumi.getter
    def scopes(self) -> pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]:
        """
        The scopes of the group service account access token. Valid values are: `api`, `read_user`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, `read_virtual_registry`, `write_virtual_registry`, `sudo`, `admin_mode`, `create_runner`, `manage_runner`, `ai_features`, `k8s_proxy`, `self_rotate`, `read_service_ping`. If `self_rotate` is included, you must also provide either `expires_at` or `rotation_configuration`.
        """
        return pulumi.get(self, "scopes")

    @scopes.setter
    def scopes(self, value: pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]):
        pulumi.set(self, "scopes", value)

    @_builtins.property
    @pulumi.getter(name="userId")
    def user_id(self) -> pulumi.Input[_builtins.int]:
        """
        The ID of a service account user.
        """
        return pulumi.get(self, "user_id")

    @user_id.setter
    def user_id(self, value: pulumi.Input[_builtins.int]):
        pulumi.set(self, "user_id", value)

    @_builtins.property
    @pulumi.getter(name="expiresAt")
    def expires_at(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The service account access token expiry date. When left blank, the token follows the standard rule of expiry for personal access tokens.
        """
        return pulumi.get(self, "expires_at")

    @expires_at.setter
    def expires_at(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "expires_at", value)

    @_builtins.property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The name of the personal access token.
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "name", value)

    @_builtins.property
    @pulumi.getter(name="rotationConfiguration")
    def rotation_configuration(self) -> Optional[pulumi.Input['GroupServiceAccountAccessTokenRotationConfigurationArgs']]:
        """
        The configuration for when to rotate a token automatically. Will not rotate a token until `pulumi up` is run.
        """
        return pulumi.get(self, "rotation_configuration")

    @rotation_configuration.setter
    def rotation_configuration(self, value: Optional[pulumi.Input['GroupServiceAccountAccessTokenRotationConfigurationArgs']]):
        pulumi.set(self, "rotation_configuration", value)

    @_builtins.property
    @pulumi.getter(name="validatePastExpirationDate")
    def validate_past_expiration_date(self) -> Optional[pulumi.Input[_builtins.bool]]:
        """
        Wether to validate if the expiration date is in the future.
        """
        return pulumi.get(self, "validate_past_expiration_date")

    @validate_past_expiration_date.setter
    def validate_past_expiration_date(self, value: Optional[pulumi.Input[_builtins.bool]]):
        pulumi.set(self, "validate_past_expiration_date", value)


@pulumi.input_type
class _GroupServiceAccountAccessTokenState:
    def __init__(__self__, *,
                 active: Optional[pulumi.Input[_builtins.bool]] = None,
                 created_at: Optional[pulumi.Input[_builtins.str]] = None,
                 expires_at: Optional[pulumi.Input[_builtins.str]] = None,
                 group: Optional[pulumi.Input[_builtins.str]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 revoked: Optional[pulumi.Input[_builtins.bool]] = None,
                 rotation_configuration: Optional[pulumi.Input['GroupServiceAccountAccessTokenRotationConfigurationArgs']] = None,
                 scopes: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
                 token: Optional[pulumi.Input[_builtins.str]] = None,
                 user_id: Optional[pulumi.Input[_builtins.int]] = None,
                 validate_past_expiration_date: Optional[pulumi.Input[_builtins.bool]] = None):
        """
        Input properties used for looking up and filtering GroupServiceAccountAccessToken resources.
        :param pulumi.Input[_builtins.bool] active: True if the token is active.
        :param pulumi.Input[_builtins.str] created_at: Time the token has been created, RFC3339 format.
        :param pulumi.Input[_builtins.str] expires_at: The service account access token expiry date. When left blank, the token follows the standard rule of expiry for personal access tokens.
        :param pulumi.Input[_builtins.str] group: The ID or URL-encoded path of the group containing the service account. Must be a top level group.
        :param pulumi.Input[_builtins.str] name: The name of the personal access token.
        :param pulumi.Input[_builtins.bool] revoked: True if the token is revoked.
        :param pulumi.Input['GroupServiceAccountAccessTokenRotationConfigurationArgs'] rotation_configuration: The configuration for when to rotate a token automatically. Will not rotate a token until `pulumi up` is run.
        :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] scopes: The scopes of the group service account access token. Valid values are: `api`, `read_user`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, `read_virtual_registry`, `write_virtual_registry`, `sudo`, `admin_mode`, `create_runner`, `manage_runner`, `ai_features`, `k8s_proxy`, `self_rotate`, `read_service_ping`. If `self_rotate` is included, you must also provide either `expires_at` or `rotation_configuration`.
        :param pulumi.Input[_builtins.str] token: The token of the group service account access token. **Note**: the token is not available for imported resources.
        :param pulumi.Input[_builtins.int] user_id: The ID of a service account user.
        :param pulumi.Input[_builtins.bool] validate_past_expiration_date: Wether to validate if the expiration date is in the future.
        """
        if active is not None:
            pulumi.set(__self__, "active", active)
        if created_at is not None:
            pulumi.set(__self__, "created_at", created_at)
        if expires_at is not None:
            pulumi.set(__self__, "expires_at", expires_at)
        if group is not None:
            pulumi.set(__self__, "group", group)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if revoked is not None:
            pulumi.set(__self__, "revoked", revoked)
        if rotation_configuration is not None:
            pulumi.set(__self__, "rotation_configuration", rotation_configuration)
        if scopes is not None:
            pulumi.set(__self__, "scopes", scopes)
        if token is not None:
            pulumi.set(__self__, "token", token)
        if user_id is not None:
            pulumi.set(__self__, "user_id", user_id)
        if validate_past_expiration_date is not None:
            pulumi.set(__self__, "validate_past_expiration_date", validate_past_expiration_date)

    @_builtins.property
    @pulumi.getter
    def active(self) -> Optional[pulumi.Input[_builtins.bool]]:
        """
        True if the token is active.
        """
        return pulumi.get(self, "active")

    @active.setter
    def active(self, value: Optional[pulumi.Input[_builtins.bool]]):
        pulumi.set(self, "active", value)

    @_builtins.property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Time the token has been created, RFC3339 format.
        """
        return pulumi.get(self, "created_at")

    @created_at.setter
    def created_at(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "created_at", value)

    @_builtins.property
    @pulumi.getter(name="expiresAt")
    def expires_at(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The service account access token expiry date. When left blank, the token follows the standard rule of expiry for personal access tokens.
        """
        return pulumi.get(self, "expires_at")

    @expires_at.setter
    def expires_at(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "expires_at", value)

    @_builtins.property
    @pulumi.getter
    def group(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The ID or URL-encoded path of the group containing the service account. Must be a top level group.
        """
        return pulumi.get(self, "group")

    @group.setter
    def group(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "group", value)

    @_builtins.property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The name of the personal access token.
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "name", value)

    @_builtins.property
    @pulumi.getter
    def revoked(self) -> Optional[pulumi.Input[_builtins.bool]]:
        """
        True if the token is revoked.
        """
        return pulumi.get(self, "revoked")

    @revoked.setter
    def revoked(self, value: Optional[pulumi.Input[_builtins.bool]]):
        pulumi.set(self, "revoked", value)

    @_builtins.property
    @pulumi.getter(name="rotationConfiguration")
    def rotation_configuration(self) -> Optional[pulumi.Input['GroupServiceAccountAccessTokenRotationConfigurationArgs']]:
        """
        The configuration for when to rotate a token automatically. Will not rotate a token until `pulumi up` is run.
        """
        return pulumi.get(self, "rotation_configuration")

    @rotation_configuration.setter
    def rotation_configuration(self, value: Optional[pulumi.Input['GroupServiceAccountAccessTokenRotationConfigurationArgs']]):
        pulumi.set(self, "rotation_configuration", value)

    @_builtins.property
    @pulumi.getter
    def scopes(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]]:
        """
        The scopes of the group service account access token. Valid values are: `api`, `read_user`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, `read_virtual_registry`, `write_virtual_registry`, `sudo`, `admin_mode`, `create_runner`, `manage_runner`, `ai_features`, `k8s_proxy`, `self_rotate`, `read_service_ping`. If `self_rotate` is included, you must also provide either `expires_at` or `rotation_configuration`.
        """
        return pulumi.get(self, "scopes")

    @scopes.setter
    def scopes(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]]):
        pulumi.set(self, "scopes", value)

    @_builtins.property
    @pulumi.getter
    def token(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The token of the group service account access token. **Note**: the token is not available for imported resources.
        """
        return pulumi.get(self, "token")

    @token.setter
    def token(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "token", value)

    @_builtins.property
    @pulumi.getter(name="userId")
    def user_id(self) -> Optional[pulumi.Input[_builtins.int]]:
        """
        The ID of a service account user.
        """
        return pulumi.get(self, "user_id")

    @user_id.setter
    def user_id(self, value: Optional[pulumi.Input[_builtins.int]]):
        pulumi.set(self, "user_id", value)

    @_builtins.property
    @pulumi.getter(name="validatePastExpirationDate")
    def validate_past_expiration_date(self) -> Optional[pulumi.Input[_builtins.bool]]:
        """
        Wether to validate if the expiration date is in the future.
        """
        return pulumi.get(self, "validate_past_expiration_date")

    @validate_past_expiration_date.setter
    def validate_past_expiration_date(self, value: Optional[pulumi.Input[_builtins.bool]]):
        pulumi.set(self, "validate_past_expiration_date", value)


@pulumi.type_token("gitlab:index/groupServiceAccountAccessToken:GroupServiceAccountAccessToken")
class GroupServiceAccountAccessToken(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 expires_at: Optional[pulumi.Input[_builtins.str]] = None,
                 group: Optional[pulumi.Input[_builtins.str]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 rotation_configuration: Optional[pulumi.Input[Union['GroupServiceAccountAccessTokenRotationConfigurationArgs', 'GroupServiceAccountAccessTokenRotationConfigurationArgsDict']]] = None,
                 scopes: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
                 user_id: Optional[pulumi.Input[_builtins.int]] = None,
                 validate_past_expiration_date: Optional[pulumi.Input[_builtins.bool]] = None,
                 __props__=None):
        """
        The `GroupServiceAccountAccessToken` resource allows to manage the lifecycle of a group service account access token.

        > Use of the `timestamp()` function with expires_at will cause the resource to be re-created with every apply, it's recommended to use `plantimestamp()` or a static value instead.

        > Reading the access token status of a service account requires an admin token or a top-level group owner token on gitlab.com. As a result, this resource will ignore permission errors when attempting to read the token status, and will rely on the values in state instead. This can lead to apply-time failures if the token configured for the provider doesn't have permissions to rotate tokens for the service account.

        > Use `rotation_configuration` to automatically rotate tokens instead of using `timestamp()` as timestamp will cause changes with every plan. `pulumi up` must still be run to rotate the token.

        > Due to a limitation in the API, the `rotation_configuration` is unable to set the new expiry date before GitLab 17.9. Instead, when the resource is created, it will default the expiry date to 7 days in the future. On each subsequent apply, the new expiry will be 7 days from the date of the apply.

        **Upstream API**: [GitLab API docs](https://docs.gitlab.com/api/service_accounts/#create-a-personal-access-token-for-a-group-service-account)

        ## Example Usage

        ```python
        import pulumi
        import pulumi_gitlab as gitlab

        # This must be a top-level group
        example = gitlab.Group("example",
            name="example",
            path="example",
            description="An example group")
        # The service account against the top-level group
        example_sa = gitlab.GroupServiceAccount("example_sa",
            group=example.id,
            name="example-name",
            username="example-username")
        # To assign the service account to a group
        example_membership = gitlab.GroupMembership("example_membership",
            group_id=example.id,
            user_id=example_sa.service_account_id,
            access_level="developer",
            expires_at="2020-03-14")
        # The service account access token with no expiry
        example_sa_token_no_expiry = gitlab.GroupServiceAccountAccessToken("example_sa_token_no_expiry",
            group=example.id,
            user_id=example_sa.service_account_id,
            name="Example service account access token",
            scopes=["api"])
        # The service account access token with expires at
        example_sa_token_expires_at = gitlab.GroupServiceAccountAccessToken("example_sa_token_expires_at",
            group=example.id,
            user_id=example_sa.service_account_id,
            name="Example service account access token",
            expires_at="2020-03-14",
            scopes=["api"])
        # The service account access token with rotation configuration
        example_sa_token_rotation_configuration = gitlab.GroupServiceAccountAccessToken("example_sa_token_rotation_configuration",
            group=example.id,
            user_id=example_sa.service_account_id,
            name="Example service account access token",
            rotation_configuration={
                "rotate_before_days": 2,
                "expiration_days": 7,
            },
            scopes=["api"])
        ```

        ## Import

        Starting in Terraform v1.5.0, you can use an import block to import `gitlab_group_service_account_access_token`. For example:

        terraform

        import {

          to = gitlab_group_service_account_access_token.example

          id = "see CLI command below for ID"

        }

        Importing using the CLI is supported with the following syntax:

        ```sh
        $ pulumi import gitlab:index/groupServiceAccountAccessToken:GroupServiceAccountAccessToken You can import a service account access token using `<resource> <id>`. The
        ```

        `id` is in the form of <group_id>:<service_account_id>:<access_token_id>

        Importing an access token does not import the access token value.

        ```sh
        $ pulumi import gitlab:index/groupServiceAccountAccessToken:GroupServiceAccountAccessToken example 1:2:3
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] expires_at: The service account access token expiry date. When left blank, the token follows the standard rule of expiry for personal access tokens.
        :param pulumi.Input[_builtins.str] group: The ID or URL-encoded path of the group containing the service account. Must be a top level group.
        :param pulumi.Input[_builtins.str] name: The name of the personal access token.
        :param pulumi.Input[Union['GroupServiceAccountAccessTokenRotationConfigurationArgs', 'GroupServiceAccountAccessTokenRotationConfigurationArgsDict']] rotation_configuration: The configuration for when to rotate a token automatically. Will not rotate a token until `pulumi up` is run.
        :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] scopes: The scopes of the group service account access token. Valid values are: `api`, `read_user`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, `read_virtual_registry`, `write_virtual_registry`, `sudo`, `admin_mode`, `create_runner`, `manage_runner`, `ai_features`, `k8s_proxy`, `self_rotate`, `read_service_ping`. If `self_rotate` is included, you must also provide either `expires_at` or `rotation_configuration`.
        :param pulumi.Input[_builtins.int] user_id: The ID of a service account user.
        :param pulumi.Input[_builtins.bool] validate_past_expiration_date: Wether to validate if the expiration date is in the future.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: GroupServiceAccountAccessTokenArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        The `GroupServiceAccountAccessToken` resource allows to manage the lifecycle of a group service account access token.

        > Use of the `timestamp()` function with expires_at will cause the resource to be re-created with every apply, it's recommended to use `plantimestamp()` or a static value instead.

        > Reading the access token status of a service account requires an admin token or a top-level group owner token on gitlab.com. As a result, this resource will ignore permission errors when attempting to read the token status, and will rely on the values in state instead. This can lead to apply-time failures if the token configured for the provider doesn't have permissions to rotate tokens for the service account.

        > Use `rotation_configuration` to automatically rotate tokens instead of using `timestamp()` as timestamp will cause changes with every plan. `pulumi up` must still be run to rotate the token.

        > Due to a limitation in the API, the `rotation_configuration` is unable to set the new expiry date before GitLab 17.9. Instead, when the resource is created, it will default the expiry date to 7 days in the future. On each subsequent apply, the new expiry will be 7 days from the date of the apply.

        **Upstream API**: [GitLab API docs](https://docs.gitlab.com/api/service_accounts/#create-a-personal-access-token-for-a-group-service-account)

        ## Example Usage

        ```python
        import pulumi
        import pulumi_gitlab as gitlab

        # This must be a top-level group
        example = gitlab.Group("example",
            name="example",
            path="example",
            description="An example group")
        # The service account against the top-level group
        example_sa = gitlab.GroupServiceAccount("example_sa",
            group=example.id,
            name="example-name",
            username="example-username")
        # To assign the service account to a group
        example_membership = gitlab.GroupMembership("example_membership",
            group_id=example.id,
            user_id=example_sa.service_account_id,
            access_level="developer",
            expires_at="2020-03-14")
        # The service account access token with no expiry
        example_sa_token_no_expiry = gitlab.GroupServiceAccountAccessToken("example_sa_token_no_expiry",
            group=example.id,
            user_id=example_sa.service_account_id,
            name="Example service account access token",
            scopes=["api"])
        # The service account access token with expires at
        example_sa_token_expires_at = gitlab.GroupServiceAccountAccessToken("example_sa_token_expires_at",
            group=example.id,
            user_id=example_sa.service_account_id,
            name="Example service account access token",
            expires_at="2020-03-14",
            scopes=["api"])
        # The service account access token with rotation configuration
        example_sa_token_rotation_configuration = gitlab.GroupServiceAccountAccessToken("example_sa_token_rotation_configuration",
            group=example.id,
            user_id=example_sa.service_account_id,
            name="Example service account access token",
            rotation_configuration={
                "rotate_before_days": 2,
                "expiration_days": 7,
            },
            scopes=["api"])
        ```

        ## Import

        Starting in Terraform v1.5.0, you can use an import block to import `gitlab_group_service_account_access_token`. For example:

        terraform

        import {

          to = gitlab_group_service_account_access_token.example

          id = "see CLI command below for ID"

        }

        Importing using the CLI is supported with the following syntax:

        ```sh
        $ pulumi import gitlab:index/groupServiceAccountAccessToken:GroupServiceAccountAccessToken You can import a service account access token using `<resource> <id>`. The
        ```

        `id` is in the form of <group_id>:<service_account_id>:<access_token_id>

        Importing an access token does not import the access token value.

        ```sh
        $ pulumi import gitlab:index/groupServiceAccountAccessToken:GroupServiceAccountAccessToken example 1:2:3
        ```

        :param str resource_name: The name of the resource.
        :param GroupServiceAccountAccessTokenArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(GroupServiceAccountAccessTokenArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 expires_at: Optional[pulumi.Input[_builtins.str]] = None,
                 group: Optional[pulumi.Input[_builtins.str]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 rotation_configuration: Optional[pulumi.Input[Union['GroupServiceAccountAccessTokenRotationConfigurationArgs', 'GroupServiceAccountAccessTokenRotationConfigurationArgsDict']]] = None,
                 scopes: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
                 user_id: Optional[pulumi.Input[_builtins.int]] = None,
                 validate_past_expiration_date: Optional[pulumi.Input[_builtins.bool]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = GroupServiceAccountAccessTokenArgs.__new__(GroupServiceAccountAccessTokenArgs)

            __props__.__dict__["expires_at"] = expires_at
            if group is None and not opts.urn:
                raise TypeError("Missing required property 'group'")
            __props__.__dict__["group"] = group
            __props__.__dict__["name"] = name
            __props__.__dict__["rotation_configuration"] = rotation_configuration
            if scopes is None and not opts.urn:
                raise TypeError("Missing required property 'scopes'")
            __props__.__dict__["scopes"] = scopes
            if user_id is None and not opts.urn:
                raise TypeError("Missing required property 'user_id'")
            __props__.__dict__["user_id"] = user_id
            __props__.__dict__["validate_past_expiration_date"] = validate_past_expiration_date
            __props__.__dict__["active"] = None
            __props__.__dict__["created_at"] = None
            __props__.__dict__["revoked"] = None
            __props__.__dict__["token"] = None
        secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["token"])
        opts = pulumi.ResourceOptions.merge(opts, secret_opts)
        super(GroupServiceAccountAccessToken, __self__).__init__(
            'gitlab:index/groupServiceAccountAccessToken:GroupServiceAccountAccessToken',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            active: Optional[pulumi.Input[_builtins.bool]] = None,
            created_at: Optional[pulumi.Input[_builtins.str]] = None,
            expires_at: Optional[pulumi.Input[_builtins.str]] = None,
            group: Optional[pulumi.Input[_builtins.str]] = None,
            name: Optional[pulumi.Input[_builtins.str]] = None,
            revoked: Optional[pulumi.Input[_builtins.bool]] = None,
            rotation_configuration: Optional[pulumi.Input[Union['GroupServiceAccountAccessTokenRotationConfigurationArgs', 'GroupServiceAccountAccessTokenRotationConfigurationArgsDict']]] = None,
            scopes: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
            token: Optional[pulumi.Input[_builtins.str]] = None,
            user_id: Optional[pulumi.Input[_builtins.int]] = None,
            validate_past_expiration_date: Optional[pulumi.Input[_builtins.bool]] = None) -> 'GroupServiceAccountAccessToken':
        """
        Get an existing GroupServiceAccountAccessToken resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.bool] active: True if the token is active.
        :param pulumi.Input[_builtins.str] created_at: Time the token has been created, RFC3339 format.
        :param pulumi.Input[_builtins.str] expires_at: The service account access token expiry date. When left blank, the token follows the standard rule of expiry for personal access tokens.
        :param pulumi.Input[_builtins.str] group: The ID or URL-encoded path of the group containing the service account. Must be a top level group.
        :param pulumi.Input[_builtins.str] name: The name of the personal access token.
        :param pulumi.Input[_builtins.bool] revoked: True if the token is revoked.
        :param pulumi.Input[Union['GroupServiceAccountAccessTokenRotationConfigurationArgs', 'GroupServiceAccountAccessTokenRotationConfigurationArgsDict']] rotation_configuration: The configuration for when to rotate a token automatically. Will not rotate a token until `pulumi up` is run.
        :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] scopes: The scopes of the group service account access token. Valid values are: `api`, `read_user`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, `read_virtual_registry`, `write_virtual_registry`, `sudo`, `admin_mode`, `create_runner`, `manage_runner`, `ai_features`, `k8s_proxy`, `self_rotate`, `read_service_ping`. If `self_rotate` is included, you must also provide either `expires_at` or `rotation_configuration`.
        :param pulumi.Input[_builtins.str] token: The token of the group service account access token. **Note**: the token is not available for imported resources.
        :param pulumi.Input[_builtins.int] user_id: The ID of a service account user.
        :param pulumi.Input[_builtins.bool] validate_past_expiration_date: Wether to validate if the expiration date is in the future.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _GroupServiceAccountAccessTokenState.__new__(_GroupServiceAccountAccessTokenState)

        __props__.__dict__["active"] = active
        __props__.__dict__["created_at"] = created_at
        __props__.__dict__["expires_at"] = expires_at
        __props__.__dict__["group"] = group
        __props__.__dict__["name"] = name
        __props__.__dict__["revoked"] = revoked
        __props__.__dict__["rotation_configuration"] = rotation_configuration
        __props__.__dict__["scopes"] = scopes
        __props__.__dict__["token"] = token
        __props__.__dict__["user_id"] = user_id
        __props__.__dict__["validate_past_expiration_date"] = validate_past_expiration_date
        return GroupServiceAccountAccessToken(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter
    def active(self) -> pulumi.Output[_builtins.bool]:
        """
        True if the token is active.
        """
        return pulumi.get(self, "active")

    @_builtins.property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> pulumi.Output[_builtins.str]:
        """
        Time the token has been created, RFC3339 format.
        """
        return pulumi.get(self, "created_at")

    @_builtins.property
    @pulumi.getter(name="expiresAt")
    def expires_at(self) -> pulumi.Output[_builtins.str]:
        """
        The service account access token expiry date. When left blank, the token follows the standard rule of expiry for personal access tokens.
        """
        return pulumi.get(self, "expires_at")

    @_builtins.property
    @pulumi.getter
    def group(self) -> pulumi.Output[_builtins.str]:
        """
        The ID or URL-encoded path of the group containing the service account. Must be a top level group.
        """
        return pulumi.get(self, "group")

    @_builtins.property
    @pulumi.getter
    def name(self) -> pulumi.Output[_builtins.str]:
        """
        The name of the personal access token.
        """
        return pulumi.get(self, "name")

    @_builtins.property
    @pulumi.getter
    def revoked(self) -> pulumi.Output[_builtins.bool]:
        """
        True if the token is revoked.
        """
        return pulumi.get(self, "revoked")

    @_builtins.property
    @pulumi.getter(name="rotationConfiguration")
    def rotation_configuration(self) -> pulumi.Output[Optional['outputs.GroupServiceAccountAccessTokenRotationConfiguration']]:
        """
        The configuration for when to rotate a token automatically. Will not rotate a token until `pulumi up` is run.
        """
        return pulumi.get(self, "rotation_configuration")

    @_builtins.property
    @pulumi.getter
    def scopes(self) -> pulumi.Output[Sequence[_builtins.str]]:
        """
        The scopes of the group service account access token. Valid values are: `api`, `read_user`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, `read_virtual_registry`, `write_virtual_registry`, `sudo`, `admin_mode`, `create_runner`, `manage_runner`, `ai_features`, `k8s_proxy`, `self_rotate`, `read_service_ping`. If `self_rotate` is included, you must also provide either `expires_at` or `rotation_configuration`.
        """
        return pulumi.get(self, "scopes")

    @_builtins.property
    @pulumi.getter
    def token(self) -> pulumi.Output[_builtins.str]:
        """
        The token of the group service account access token. **Note**: the token is not available for imported resources.
        """
        return pulumi.get(self, "token")

    @_builtins.property
    @pulumi.getter(name="userId")
    def user_id(self) -> pulumi.Output[_builtins.int]:
        """
        The ID of a service account user.
        """
        return pulumi.get(self, "user_id")

    @_builtins.property
    @pulumi.getter(name="validatePastExpirationDate")
    def validate_past_expiration_date(self) -> pulumi.Output[_builtins.bool]:
        """
        Wether to validate if the expiration date is in the future.
        """
        return pulumi.get(self, "validate_past_expiration_date")

