# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities

__all__ = ['GitTokenArgs', 'GitToken']

@pulumi.input_type
class GitTokenArgs:
    def __init__(__self__, *,
                 organization_id: pulumi.Input[str],
                 token: pulumi.Input[str],
                 type: pulumi.Input[str],
                 bitbucket_workspace: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a GitToken resource.
        :param pulumi.Input[str] organization_id: Id of the organization.
        :param pulumi.Input[str] token: Value of the git token.
        :param pulumi.Input[str] type: Type of the git token. - Can be: `BITBUCKET`, `GITHUB`, `GITLAB`.
        :param pulumi.Input[str] bitbucket_workspace: (Mandatory only for Bitbucket git token) Workspace where the token has permissions .
        :param pulumi.Input[str] description: Description of the git token.
        :param pulumi.Input[str] name: Name of the git token.
        """
        pulumi.set(__self__, "organization_id", organization_id)
        pulumi.set(__self__, "token", token)
        pulumi.set(__self__, "type", type)
        if bitbucket_workspace is not None:
            pulumi.set(__self__, "bitbucket_workspace", bitbucket_workspace)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @property
    @pulumi.getter(name="organizationId")
    def organization_id(self) -> pulumi.Input[str]:
        """
        Id of the organization.
        """
        return pulumi.get(self, "organization_id")

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

    @property
    @pulumi.getter
    def token(self) -> pulumi.Input[str]:
        """
        Value of the git token.
        """
        return pulumi.get(self, "token")

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

    @property
    @pulumi.getter
    def type(self) -> pulumi.Input[str]:
        """
        Type of the git token. - Can be: `BITBUCKET`, `GITHUB`, `GITLAB`.
        """
        return pulumi.get(self, "type")

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

    @property
    @pulumi.getter(name="bitbucketWorkspace")
    def bitbucket_workspace(self) -> Optional[pulumi.Input[str]]:
        """
        (Mandatory only for Bitbucket git token) Workspace where the token has permissions .
        """
        return pulumi.get(self, "bitbucket_workspace")

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

    @property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[str]]:
        """
        Description of the git token.
        """
        return pulumi.get(self, "description")

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

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

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


@pulumi.input_type
class _GitTokenState:
    def __init__(__self__, *,
                 bitbucket_workspace: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 organization_id: Optional[pulumi.Input[str]] = None,
                 token: Optional[pulumi.Input[str]] = None,
                 type: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering GitToken resources.
        :param pulumi.Input[str] bitbucket_workspace: (Mandatory only for Bitbucket git token) Workspace where the token has permissions .
        :param pulumi.Input[str] description: Description of the git token.
        :param pulumi.Input[str] name: Name of the git token.
        :param pulumi.Input[str] organization_id: Id of the organization.
        :param pulumi.Input[str] token: Value of the git token.
        :param pulumi.Input[str] type: Type of the git token. - Can be: `BITBUCKET`, `GITHUB`, `GITLAB`.
        """
        if bitbucket_workspace is not None:
            pulumi.set(__self__, "bitbucket_workspace", bitbucket_workspace)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if organization_id is not None:
            pulumi.set(__self__, "organization_id", organization_id)
        if token is not None:
            pulumi.set(__self__, "token", token)
        if type is not None:
            pulumi.set(__self__, "type", type)

    @property
    @pulumi.getter(name="bitbucketWorkspace")
    def bitbucket_workspace(self) -> Optional[pulumi.Input[str]]:
        """
        (Mandatory only for Bitbucket git token) Workspace where the token has permissions .
        """
        return pulumi.get(self, "bitbucket_workspace")

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

    @property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[str]]:
        """
        Description of the git token.
        """
        return pulumi.get(self, "description")

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

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

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

    @property
    @pulumi.getter(name="organizationId")
    def organization_id(self) -> Optional[pulumi.Input[str]]:
        """
        Id of the organization.
        """
        return pulumi.get(self, "organization_id")

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

    @property
    @pulumi.getter
    def token(self) -> Optional[pulumi.Input[str]]:
        """
        Value of the git token.
        """
        return pulumi.get(self, "token")

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

    @property
    @pulumi.getter
    def type(self) -> Optional[pulumi.Input[str]]:
        """
        Type of the git token. - Can be: `BITBUCKET`, `GITHUB`, `GITLAB`.
        """
        return pulumi.get(self, "type")

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


class GitToken(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 bitbucket_workspace: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 organization_id: Optional[pulumi.Input[str]] = None,
                 token: Optional[pulumi.Input[str]] = None,
                 type: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        ## # GitToken (Resource)

        Provides a Qovery git token resource. This can be used to create and manage Qovery git token.

        ## Example

        ```python
        import pulumi
        import ediri_qovery as qovery

        my_git_token = qovery.GitToken("myGitToken",
            organization_id=qovery_organization["my_organization"]["id"],
            type="GITHUB",
            token="my-git-provider-token",
            description="Github token",
            bitbucket_workspace="workspace-bitbucket")
        ```

        ## Import

        ```sh
         $ pulumi import qovery:index/gitToken:GitToken my_git_token "<organization_id>,<git_token_id>"
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] bitbucket_workspace: (Mandatory only for Bitbucket git token) Workspace where the token has permissions .
        :param pulumi.Input[str] description: Description of the git token.
        :param pulumi.Input[str] name: Name of the git token.
        :param pulumi.Input[str] organization_id: Id of the organization.
        :param pulumi.Input[str] token: Value of the git token.
        :param pulumi.Input[str] type: Type of the git token. - Can be: `BITBUCKET`, `GITHUB`, `GITLAB`.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: GitTokenArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        ## # GitToken (Resource)

        Provides a Qovery git token resource. This can be used to create and manage Qovery git token.

        ## Example

        ```python
        import pulumi
        import ediri_qovery as qovery

        my_git_token = qovery.GitToken("myGitToken",
            organization_id=qovery_organization["my_organization"]["id"],
            type="GITHUB",
            token="my-git-provider-token",
            description="Github token",
            bitbucket_workspace="workspace-bitbucket")
        ```

        ## Import

        ```sh
         $ pulumi import qovery:index/gitToken:GitToken my_git_token "<organization_id>,<git_token_id>"
        ```

        :param str resource_name: The name of the resource.
        :param GitTokenArgs 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(GitTokenArgs, 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,
                 bitbucket_workspace: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 organization_id: Optional[pulumi.Input[str]] = None,
                 token: Optional[pulumi.Input[str]] = None,
                 type: Optional[pulumi.Input[str]] = 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__ = GitTokenArgs.__new__(GitTokenArgs)

            __props__.__dict__["bitbucket_workspace"] = bitbucket_workspace
            __props__.__dict__["description"] = description
            __props__.__dict__["name"] = name
            if organization_id is None and not opts.urn:
                raise TypeError("Missing required property 'organization_id'")
            __props__.__dict__["organization_id"] = organization_id
            if token is None and not opts.urn:
                raise TypeError("Missing required property 'token'")
            __props__.__dict__["token"] = None if token is None else pulumi.Output.secret(token)
            if type is None and not opts.urn:
                raise TypeError("Missing required property 'type'")
            __props__.__dict__["type"] = type
        secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["token"])
        opts = pulumi.ResourceOptions.merge(opts, secret_opts)
        super(GitToken, __self__).__init__(
            'qovery:index/gitToken:GitToken',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            bitbucket_workspace: Optional[pulumi.Input[str]] = None,
            description: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            organization_id: Optional[pulumi.Input[str]] = None,
            token: Optional[pulumi.Input[str]] = None,
            type: Optional[pulumi.Input[str]] = None) -> 'GitToken':
        """
        Get an existing GitToken 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[str] bitbucket_workspace: (Mandatory only for Bitbucket git token) Workspace where the token has permissions .
        :param pulumi.Input[str] description: Description of the git token.
        :param pulumi.Input[str] name: Name of the git token.
        :param pulumi.Input[str] organization_id: Id of the organization.
        :param pulumi.Input[str] token: Value of the git token.
        :param pulumi.Input[str] type: Type of the git token. - Can be: `BITBUCKET`, `GITHUB`, `GITLAB`.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _GitTokenState.__new__(_GitTokenState)

        __props__.__dict__["bitbucket_workspace"] = bitbucket_workspace
        __props__.__dict__["description"] = description
        __props__.__dict__["name"] = name
        __props__.__dict__["organization_id"] = organization_id
        __props__.__dict__["token"] = token
        __props__.__dict__["type"] = type
        return GitToken(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="bitbucketWorkspace")
    def bitbucket_workspace(self) -> pulumi.Output[str]:
        """
        (Mandatory only for Bitbucket git token) Workspace where the token has permissions .
        """
        return pulumi.get(self, "bitbucket_workspace")

    @property
    @pulumi.getter
    def description(self) -> pulumi.Output[str]:
        """
        Description of the git token.
        """
        return pulumi.get(self, "description")

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

    @property
    @pulumi.getter(name="organizationId")
    def organization_id(self) -> pulumi.Output[str]:
        """
        Id of the organization.
        """
        return pulumi.get(self, "organization_id")

    @property
    @pulumi.getter
    def token(self) -> pulumi.Output[str]:
        """
        Value of the git token.
        """
        return pulumi.get(self, "token")

    @property
    @pulumi.getter
    def type(self) -> pulumi.Output[str]:
        """
        Type of the git token. - Can be: `BITBUCKET`, `GITHUB`, `GITLAB`.
        """
        return pulumi.get(self, "type")

