# 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

__all__ = ['UserAvatarArgs', 'UserAvatar']

@pulumi.input_type
class UserAvatarArgs:
    def __init__(__self__, *,
                 avatar: pulumi.Input[_builtins.str],
                 user_id: pulumi.Input[_builtins.int],
                 avatar_hash: Optional[pulumi.Input[_builtins.str]] = None,
                 token: Optional[pulumi.Input[_builtins.str]] = None):
        """
        The set of arguments for constructing a UserAvatar resource.
        :param pulumi.Input[_builtins.str] avatar: A local path to the avatar image to upload. **Note**: the avatar is not available for imported resources.
        :param pulumi.Input[_builtins.int] user_id: The ID of the user.
        :param pulumi.Input[_builtins.str] avatar_hash: The hash of the avatar image.  This is used to track changes to the avatar image if the image contents change but the image name remains the same. Use `filesha256("path/to/avatar.png")` whenever possible.
        :param pulumi.Input[_builtins.str] token: The access token of the user. If this field is omitted, a GitLab token with administrator scope is required to manage the avatar for the specified user. **Note**: the token is not available for imported resources.
        """
        pulumi.set(__self__, "avatar", avatar)
        pulumi.set(__self__, "user_id", user_id)
        if avatar_hash is not None:
            pulumi.set(__self__, "avatar_hash", avatar_hash)
        if token is not None:
            pulumi.set(__self__, "token", token)

    @_builtins.property
    @pulumi.getter
    def avatar(self) -> pulumi.Input[_builtins.str]:
        """
        A local path to the avatar image to upload. **Note**: the avatar is not available for imported resources.
        """
        return pulumi.get(self, "avatar")

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

    @_builtins.property
    @pulumi.getter(name="userId")
    def user_id(self) -> pulumi.Input[_builtins.int]:
        """
        The ID of the 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="avatarHash")
    def avatar_hash(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The hash of the avatar image.  This is used to track changes to the avatar image if the image contents change but the image name remains the same. Use `filesha256("path/to/avatar.png")` whenever possible.
        """
        return pulumi.get(self, "avatar_hash")

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

    @_builtins.property
    @pulumi.getter
    def token(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The access token of the user. If this field is omitted, a GitLab token with administrator scope is required to manage the avatar for the specified user. **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)


@pulumi.input_type
class _UserAvatarState:
    def __init__(__self__, *,
                 avatar: Optional[pulumi.Input[_builtins.str]] = None,
                 avatar_hash: Optional[pulumi.Input[_builtins.str]] = None,
                 avatar_url: Optional[pulumi.Input[_builtins.str]] = None,
                 token: Optional[pulumi.Input[_builtins.str]] = None,
                 user_id: Optional[pulumi.Input[_builtins.int]] = None):
        """
        Input properties used for looking up and filtering UserAvatar resources.
        :param pulumi.Input[_builtins.str] avatar: A local path to the avatar image to upload. **Note**: the avatar is not available for imported resources.
        :param pulumi.Input[_builtins.str] avatar_hash: The hash of the avatar image.  This is used to track changes to the avatar image if the image contents change but the image name remains the same. Use `filesha256("path/to/avatar.png")` whenever possible.
        :param pulumi.Input[_builtins.str] avatar_url: The URL of the avatar image.
        :param pulumi.Input[_builtins.str] token: The access token of the user. If this field is omitted, a GitLab token with administrator scope is required to manage the avatar for the specified user. **Note**: the token is not available for imported resources.
        :param pulumi.Input[_builtins.int] user_id: The ID of the user.
        """
        if avatar is not None:
            pulumi.set(__self__, "avatar", avatar)
        if avatar_hash is not None:
            pulumi.set(__self__, "avatar_hash", avatar_hash)
        if avatar_url is not None:
            pulumi.set(__self__, "avatar_url", avatar_url)
        if token is not None:
            pulumi.set(__self__, "token", token)
        if user_id is not None:
            pulumi.set(__self__, "user_id", user_id)

    @_builtins.property
    @pulumi.getter
    def avatar(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        A local path to the avatar image to upload. **Note**: the avatar is not available for imported resources.
        """
        return pulumi.get(self, "avatar")

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

    @_builtins.property
    @pulumi.getter(name="avatarHash")
    def avatar_hash(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The hash of the avatar image.  This is used to track changes to the avatar image if the image contents change but the image name remains the same. Use `filesha256("path/to/avatar.png")` whenever possible.
        """
        return pulumi.get(self, "avatar_hash")

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

    @_builtins.property
    @pulumi.getter(name="avatarUrl")
    def avatar_url(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The URL of the avatar image.
        """
        return pulumi.get(self, "avatar_url")

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

    @_builtins.property
    @pulumi.getter
    def token(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The access token of the user. If this field is omitted, a GitLab token with administrator scope is required to manage the avatar for the specified user. **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 the 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)


@pulumi.type_token("gitlab:index/userAvatar:UserAvatar")
class UserAvatar(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 avatar: Optional[pulumi.Input[_builtins.str]] = None,
                 avatar_hash: Optional[pulumi.Input[_builtins.str]] = None,
                 token: Optional[pulumi.Input[_builtins.str]] = None,
                 user_id: Optional[pulumi.Input[_builtins.int]] = None,
                 __props__=None):
        """
        The `UserAvatar` resource allows users to manage the lifecycle of a user avatar.
        The resource can also be used to set the avatar on project or group access tokens, as well as on service accounts.

        > The `token` attribute is optional only when the GitLab token used by the provider has an administrator scope, as this allows an administrator to manage user avatars.

        > The provided `token` must have the `api` scope in order to set the avatar.

        **Upstream API**: [GitLab API docs](https://docs.gitlab.com/api/users/#upload-an-avatar-for-yourself)

        ## Import

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

        terraform

        import {

          to = gitlab_user_avatar.example

          id = "see CLI command below for ID"

        }

        Importing using the CLI is supported with the following syntax:

        A GitLab User Avatar can be imported using the user id, e.g.

        ```sh
        $ pulumi import gitlab:index/userAvatar:UserAvatar example "12345"
        ```

        NOTE: the `token` and `avatar` resource attributes are not available for imported resources as this information cannot be read from the GitLab API.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] avatar: A local path to the avatar image to upload. **Note**: the avatar is not available for imported resources.
        :param pulumi.Input[_builtins.str] avatar_hash: The hash of the avatar image.  This is used to track changes to the avatar image if the image contents change but the image name remains the same. Use `filesha256("path/to/avatar.png")` whenever possible.
        :param pulumi.Input[_builtins.str] token: The access token of the user. If this field is omitted, a GitLab token with administrator scope is required to manage the avatar for the specified user. **Note**: the token is not available for imported resources.
        :param pulumi.Input[_builtins.int] user_id: The ID of the user.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: UserAvatarArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        The `UserAvatar` resource allows users to manage the lifecycle of a user avatar.
        The resource can also be used to set the avatar on project or group access tokens, as well as on service accounts.

        > The `token` attribute is optional only when the GitLab token used by the provider has an administrator scope, as this allows an administrator to manage user avatars.

        > The provided `token` must have the `api` scope in order to set the avatar.

        **Upstream API**: [GitLab API docs](https://docs.gitlab.com/api/users/#upload-an-avatar-for-yourself)

        ## Import

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

        terraform

        import {

          to = gitlab_user_avatar.example

          id = "see CLI command below for ID"

        }

        Importing using the CLI is supported with the following syntax:

        A GitLab User Avatar can be imported using the user id, e.g.

        ```sh
        $ pulumi import gitlab:index/userAvatar:UserAvatar example "12345"
        ```

        NOTE: the `token` and `avatar` resource attributes are not available for imported resources as this information cannot be read from the GitLab API.

        :param str resource_name: The name of the resource.
        :param UserAvatarArgs 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(UserAvatarArgs, 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,
                 avatar: Optional[pulumi.Input[_builtins.str]] = None,
                 avatar_hash: Optional[pulumi.Input[_builtins.str]] = None,
                 token: Optional[pulumi.Input[_builtins.str]] = None,
                 user_id: Optional[pulumi.Input[_builtins.int]] = 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__ = UserAvatarArgs.__new__(UserAvatarArgs)

            if avatar is None and not opts.urn:
                raise TypeError("Missing required property 'avatar'")
            __props__.__dict__["avatar"] = avatar
            __props__.__dict__["avatar_hash"] = avatar_hash
            __props__.__dict__["token"] = None if token is None else pulumi.Output.secret(token)
            if user_id is None and not opts.urn:
                raise TypeError("Missing required property 'user_id'")
            __props__.__dict__["user_id"] = user_id
            __props__.__dict__["avatar_url"] = None
        secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["token"])
        opts = pulumi.ResourceOptions.merge(opts, secret_opts)
        super(UserAvatar, __self__).__init__(
            'gitlab:index/userAvatar:UserAvatar',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            avatar: Optional[pulumi.Input[_builtins.str]] = None,
            avatar_hash: Optional[pulumi.Input[_builtins.str]] = None,
            avatar_url: Optional[pulumi.Input[_builtins.str]] = None,
            token: Optional[pulumi.Input[_builtins.str]] = None,
            user_id: Optional[pulumi.Input[_builtins.int]] = None) -> 'UserAvatar':
        """
        Get an existing UserAvatar 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.str] avatar: A local path to the avatar image to upload. **Note**: the avatar is not available for imported resources.
        :param pulumi.Input[_builtins.str] avatar_hash: The hash of the avatar image.  This is used to track changes to the avatar image if the image contents change but the image name remains the same. Use `filesha256("path/to/avatar.png")` whenever possible.
        :param pulumi.Input[_builtins.str] avatar_url: The URL of the avatar image.
        :param pulumi.Input[_builtins.str] token: The access token of the user. If this field is omitted, a GitLab token with administrator scope is required to manage the avatar for the specified user. **Note**: the token is not available for imported resources.
        :param pulumi.Input[_builtins.int] user_id: The ID of the user.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _UserAvatarState.__new__(_UserAvatarState)

        __props__.__dict__["avatar"] = avatar
        __props__.__dict__["avatar_hash"] = avatar_hash
        __props__.__dict__["avatar_url"] = avatar_url
        __props__.__dict__["token"] = token
        __props__.__dict__["user_id"] = user_id
        return UserAvatar(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter
    def avatar(self) -> pulumi.Output[_builtins.str]:
        """
        A local path to the avatar image to upload. **Note**: the avatar is not available for imported resources.
        """
        return pulumi.get(self, "avatar")

    @_builtins.property
    @pulumi.getter(name="avatarHash")
    def avatar_hash(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The hash of the avatar image.  This is used to track changes to the avatar image if the image contents change but the image name remains the same. Use `filesha256("path/to/avatar.png")` whenever possible.
        """
        return pulumi.get(self, "avatar_hash")

    @_builtins.property
    @pulumi.getter(name="avatarUrl")
    def avatar_url(self) -> pulumi.Output[_builtins.str]:
        """
        The URL of the avatar image.
        """
        return pulumi.get(self, "avatar_url")

    @_builtins.property
    @pulumi.getter
    def token(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The access token of the user. If this field is omitted, a GitLab token with administrator scope is required to manage the avatar for the specified user. **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 the user.
        """
        return pulumi.get(self, "user_id")

