# 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__ = ['ProjectIssueLinkArgs', 'ProjectIssueLink']

@pulumi.input_type
class ProjectIssueLinkArgs:
    def __init__(__self__, *,
                 issue_iid: pulumi.Input[_builtins.int],
                 link_type: pulumi.Input[_builtins.str],
                 project: pulumi.Input[_builtins.str],
                 target_issue_iid: pulumi.Input[_builtins.int],
                 target_project_id: pulumi.Input[_builtins.str]):
        """
        The set of arguments for constructing a ProjectIssueLink resource.
        :param pulumi.Input[_builtins.int] issue_iid: The internal ID of a project's issue.
        :param pulumi.Input[_builtins.str] link_type: Type of the relationship. Valid values are `relates_to`, `blocks`, `is_blocked_by`.
        :param pulumi.Input[_builtins.str] project: The ID or URL-encoded path of the project.
        :param pulumi.Input[_builtins.int] target_issue_iid: The internal ID of the target issue.
        :param pulumi.Input[_builtins.str] target_project_id: The ID or URL-encoded path of the target project.
        """
        pulumi.set(__self__, "issue_iid", issue_iid)
        pulumi.set(__self__, "link_type", link_type)
        pulumi.set(__self__, "project", project)
        pulumi.set(__self__, "target_issue_iid", target_issue_iid)
        pulumi.set(__self__, "target_project_id", target_project_id)

    @_builtins.property
    @pulumi.getter(name="issueIid")
    def issue_iid(self) -> pulumi.Input[_builtins.int]:
        """
        The internal ID of a project's issue.
        """
        return pulumi.get(self, "issue_iid")

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

    @_builtins.property
    @pulumi.getter(name="linkType")
    def link_type(self) -> pulumi.Input[_builtins.str]:
        """
        Type of the relationship. Valid values are `relates_to`, `blocks`, `is_blocked_by`.
        """
        return pulumi.get(self, "link_type")

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

    @_builtins.property
    @pulumi.getter
    def project(self) -> pulumi.Input[_builtins.str]:
        """
        The ID or URL-encoded path of the project.
        """
        return pulumi.get(self, "project")

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

    @_builtins.property
    @pulumi.getter(name="targetIssueIid")
    def target_issue_iid(self) -> pulumi.Input[_builtins.int]:
        """
        The internal ID of the target issue.
        """
        return pulumi.get(self, "target_issue_iid")

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

    @_builtins.property
    @pulumi.getter(name="targetProjectId")
    def target_project_id(self) -> pulumi.Input[_builtins.str]:
        """
        The ID or URL-encoded path of the target project.
        """
        return pulumi.get(self, "target_project_id")

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


@pulumi.input_type
class _ProjectIssueLinkState:
    def __init__(__self__, *,
                 issue_iid: Optional[pulumi.Input[_builtins.int]] = None,
                 issue_link_id: Optional[pulumi.Input[_builtins.int]] = None,
                 link_type: Optional[pulumi.Input[_builtins.str]] = None,
                 project: Optional[pulumi.Input[_builtins.str]] = None,
                 target_issue_iid: Optional[pulumi.Input[_builtins.int]] = None,
                 target_project_id: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering ProjectIssueLink resources.
        :param pulumi.Input[_builtins.int] issue_iid: The internal ID of a project's issue.
        :param pulumi.Input[_builtins.int] issue_link_id: ID of an issue relationship.
        :param pulumi.Input[_builtins.str] link_type: Type of the relationship. Valid values are `relates_to`, `blocks`, `is_blocked_by`.
        :param pulumi.Input[_builtins.str] project: The ID or URL-encoded path of the project.
        :param pulumi.Input[_builtins.int] target_issue_iid: The internal ID of the target issue.
        :param pulumi.Input[_builtins.str] target_project_id: The ID or URL-encoded path of the target project.
        """
        if issue_iid is not None:
            pulumi.set(__self__, "issue_iid", issue_iid)
        if issue_link_id is not None:
            pulumi.set(__self__, "issue_link_id", issue_link_id)
        if link_type is not None:
            pulumi.set(__self__, "link_type", link_type)
        if project is not None:
            pulumi.set(__self__, "project", project)
        if target_issue_iid is not None:
            pulumi.set(__self__, "target_issue_iid", target_issue_iid)
        if target_project_id is not None:
            pulumi.set(__self__, "target_project_id", target_project_id)

    @_builtins.property
    @pulumi.getter(name="issueIid")
    def issue_iid(self) -> Optional[pulumi.Input[_builtins.int]]:
        """
        The internal ID of a project's issue.
        """
        return pulumi.get(self, "issue_iid")

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

    @_builtins.property
    @pulumi.getter(name="issueLinkId")
    def issue_link_id(self) -> Optional[pulumi.Input[_builtins.int]]:
        """
        ID of an issue relationship.
        """
        return pulumi.get(self, "issue_link_id")

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

    @_builtins.property
    @pulumi.getter(name="linkType")
    def link_type(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Type of the relationship. Valid values are `relates_to`, `blocks`, `is_blocked_by`.
        """
        return pulumi.get(self, "link_type")

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

    @_builtins.property
    @pulumi.getter
    def project(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The ID or URL-encoded path of the project.
        """
        return pulumi.get(self, "project")

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

    @_builtins.property
    @pulumi.getter(name="targetIssueIid")
    def target_issue_iid(self) -> Optional[pulumi.Input[_builtins.int]]:
        """
        The internal ID of the target issue.
        """
        return pulumi.get(self, "target_issue_iid")

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

    @_builtins.property
    @pulumi.getter(name="targetProjectId")
    def target_project_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The ID or URL-encoded path of the target project.
        """
        return pulumi.get(self, "target_project_id")

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


@pulumi.type_token("gitlab:index/projectIssueLink:ProjectIssueLink")
class ProjectIssueLink(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 issue_iid: Optional[pulumi.Input[_builtins.int]] = None,
                 link_type: Optional[pulumi.Input[_builtins.str]] = None,
                 project: Optional[pulumi.Input[_builtins.str]] = None,
                 target_issue_iid: Optional[pulumi.Input[_builtins.int]] = None,
                 target_project_id: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        The `ProjectIssueLink` resource allows to manage the lifecycle of project issue links.

        **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/issue_links/)

        ## Example Usage

        ```python
        import pulumi
        import pulumi_gitlab as gitlab

        # Create a project
        example = gitlab.Project("example",
            name="example",
            description="An example project",
            visibility_level="public")
        # Create source issue
        source = gitlab.ProjectIssue("source",
            project=example.id,
            title="Source Issue")
        # Create target issue
        target = gitlab.ProjectIssue("target",
            project=example.id,
            title="Target Issue")
        # Link issues with "relates_to" link type (default)
        relates_to = gitlab.ProjectIssueLink("relates_to",
            project=example.id,
            issue_iid=source.iid,
            target_project_id=example.id,
            target_issue_iid=target.iid,
            link_type="relates_to")
        # Cross-project linking example
        other_project = gitlab.Project("other_project",
            name="other_project",
            description="Another project for cross-project linking")
        cross_target = gitlab.ProjectIssue("cross_target",
            project=other_project.id,
            title="Cross-Project Target Issue")
        cross_project_relates_to = gitlab.ProjectIssueLink("cross_project_relates_to",
            project=example.id,
            issue_iid=source.iid,
            target_project_id=other_project.id,
            target_issue_iid=cross_target.iid,
            link_type="relates_to")
        ```

        ## Import

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

        terraform

        import {

          to = gitlab_project_issue_link.example

          id = "see CLI command below for ID"

        }

        Importing using the CLI is supported with the following syntax:

        You can import this resource with an id made up of `{project-id}:{source-issue-iid}:{target-issue-iid}`, e.g.

        ```sh
        $ pulumi import gitlab:index/projectIssueLink:ProjectIssueLink example 42:1001:1002
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.int] issue_iid: The internal ID of a project's issue.
        :param pulumi.Input[_builtins.str] link_type: Type of the relationship. Valid values are `relates_to`, `blocks`, `is_blocked_by`.
        :param pulumi.Input[_builtins.str] project: The ID or URL-encoded path of the project.
        :param pulumi.Input[_builtins.int] target_issue_iid: The internal ID of the target issue.
        :param pulumi.Input[_builtins.str] target_project_id: The ID or URL-encoded path of the target project.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ProjectIssueLinkArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        The `ProjectIssueLink` resource allows to manage the lifecycle of project issue links.

        **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/issue_links/)

        ## Example Usage

        ```python
        import pulumi
        import pulumi_gitlab as gitlab

        # Create a project
        example = gitlab.Project("example",
            name="example",
            description="An example project",
            visibility_level="public")
        # Create source issue
        source = gitlab.ProjectIssue("source",
            project=example.id,
            title="Source Issue")
        # Create target issue
        target = gitlab.ProjectIssue("target",
            project=example.id,
            title="Target Issue")
        # Link issues with "relates_to" link type (default)
        relates_to = gitlab.ProjectIssueLink("relates_to",
            project=example.id,
            issue_iid=source.iid,
            target_project_id=example.id,
            target_issue_iid=target.iid,
            link_type="relates_to")
        # Cross-project linking example
        other_project = gitlab.Project("other_project",
            name="other_project",
            description="Another project for cross-project linking")
        cross_target = gitlab.ProjectIssue("cross_target",
            project=other_project.id,
            title="Cross-Project Target Issue")
        cross_project_relates_to = gitlab.ProjectIssueLink("cross_project_relates_to",
            project=example.id,
            issue_iid=source.iid,
            target_project_id=other_project.id,
            target_issue_iid=cross_target.iid,
            link_type="relates_to")
        ```

        ## Import

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

        terraform

        import {

          to = gitlab_project_issue_link.example

          id = "see CLI command below for ID"

        }

        Importing using the CLI is supported with the following syntax:

        You can import this resource with an id made up of `{project-id}:{source-issue-iid}:{target-issue-iid}`, e.g.

        ```sh
        $ pulumi import gitlab:index/projectIssueLink:ProjectIssueLink example 42:1001:1002
        ```

        :param str resource_name: The name of the resource.
        :param ProjectIssueLinkArgs 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(ProjectIssueLinkArgs, 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,
                 issue_iid: Optional[pulumi.Input[_builtins.int]] = None,
                 link_type: Optional[pulumi.Input[_builtins.str]] = None,
                 project: Optional[pulumi.Input[_builtins.str]] = None,
                 target_issue_iid: Optional[pulumi.Input[_builtins.int]] = None,
                 target_project_id: Optional[pulumi.Input[_builtins.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__ = ProjectIssueLinkArgs.__new__(ProjectIssueLinkArgs)

            if issue_iid is None and not opts.urn:
                raise TypeError("Missing required property 'issue_iid'")
            __props__.__dict__["issue_iid"] = issue_iid
            if link_type is None and not opts.urn:
                raise TypeError("Missing required property 'link_type'")
            __props__.__dict__["link_type"] = link_type
            if project is None and not opts.urn:
                raise TypeError("Missing required property 'project'")
            __props__.__dict__["project"] = project
            if target_issue_iid is None and not opts.urn:
                raise TypeError("Missing required property 'target_issue_iid'")
            __props__.__dict__["target_issue_iid"] = target_issue_iid
            if target_project_id is None and not opts.urn:
                raise TypeError("Missing required property 'target_project_id'")
            __props__.__dict__["target_project_id"] = target_project_id
            __props__.__dict__["issue_link_id"] = None
        super(ProjectIssueLink, __self__).__init__(
            'gitlab:index/projectIssueLink:ProjectIssueLink',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            issue_iid: Optional[pulumi.Input[_builtins.int]] = None,
            issue_link_id: Optional[pulumi.Input[_builtins.int]] = None,
            link_type: Optional[pulumi.Input[_builtins.str]] = None,
            project: Optional[pulumi.Input[_builtins.str]] = None,
            target_issue_iid: Optional[pulumi.Input[_builtins.int]] = None,
            target_project_id: Optional[pulumi.Input[_builtins.str]] = None) -> 'ProjectIssueLink':
        """
        Get an existing ProjectIssueLink 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.int] issue_iid: The internal ID of a project's issue.
        :param pulumi.Input[_builtins.int] issue_link_id: ID of an issue relationship.
        :param pulumi.Input[_builtins.str] link_type: Type of the relationship. Valid values are `relates_to`, `blocks`, `is_blocked_by`.
        :param pulumi.Input[_builtins.str] project: The ID or URL-encoded path of the project.
        :param pulumi.Input[_builtins.int] target_issue_iid: The internal ID of the target issue.
        :param pulumi.Input[_builtins.str] target_project_id: The ID or URL-encoded path of the target project.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ProjectIssueLinkState.__new__(_ProjectIssueLinkState)

        __props__.__dict__["issue_iid"] = issue_iid
        __props__.__dict__["issue_link_id"] = issue_link_id
        __props__.__dict__["link_type"] = link_type
        __props__.__dict__["project"] = project
        __props__.__dict__["target_issue_iid"] = target_issue_iid
        __props__.__dict__["target_project_id"] = target_project_id
        return ProjectIssueLink(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="issueIid")
    def issue_iid(self) -> pulumi.Output[_builtins.int]:
        """
        The internal ID of a project's issue.
        """
        return pulumi.get(self, "issue_iid")

    @_builtins.property
    @pulumi.getter(name="issueLinkId")
    def issue_link_id(self) -> pulumi.Output[_builtins.int]:
        """
        ID of an issue relationship.
        """
        return pulumi.get(self, "issue_link_id")

    @_builtins.property
    @pulumi.getter(name="linkType")
    def link_type(self) -> pulumi.Output[_builtins.str]:
        """
        Type of the relationship. Valid values are `relates_to`, `blocks`, `is_blocked_by`.
        """
        return pulumi.get(self, "link_type")

    @_builtins.property
    @pulumi.getter
    def project(self) -> pulumi.Output[_builtins.str]:
        """
        The ID or URL-encoded path of the project.
        """
        return pulumi.get(self, "project")

    @_builtins.property
    @pulumi.getter(name="targetIssueIid")
    def target_issue_iid(self) -> pulumi.Output[_builtins.int]:
        """
        The internal ID of the target issue.
        """
        return pulumi.get(self, "target_issue_iid")

    @_builtins.property
    @pulumi.getter(name="targetProjectId")
    def target_project_id(self) -> pulumi.Output[_builtins.str]:
        """
        The ID or URL-encoded path of the target project.
        """
        return pulumi.get(self, "target_project_id")

