# 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 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__ = ['SentryOrganizationCodeMappingArgs', 'SentryOrganizationCodeMapping']

@pulumi.input_type
class SentryOrganizationCodeMappingArgs:
    def __init__(__self__, *,
                 default_branch: pulumi.Input[str],
                 integration_id: pulumi.Input[str],
                 organization: pulumi.Input[str],
                 project_id: pulumi.Input[str],
                 repository_id: pulumi.Input[str],
                 source_root: Optional[pulumi.Input[str]] = None,
                 stack_root: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a SentryOrganizationCodeMapping resource.
        :param pulumi.Input[str] default_branch: Default branch of your code we fall back to if you do not have commit tracking set up.
        :param pulumi.Input[str] integration_id: Sentry Organization Integration ID.
        :param pulumi.Input[str] organization: The slug of the organization the code mapping is under.
        :param pulumi.Input[str] project_id: Sentry Project ID.
        :param pulumi.Input[str] repository_id: Sentry Organization Repository ID.
        :param pulumi.Input[str] source_root: https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        :param pulumi.Input[str] stack_root: https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        pulumi.set(__self__, "default_branch", default_branch)
        pulumi.set(__self__, "integration_id", integration_id)
        pulumi.set(__self__, "organization", organization)
        pulumi.set(__self__, "project_id", project_id)
        pulumi.set(__self__, "repository_id", repository_id)
        if source_root is not None:
            pulumi.set(__self__, "source_root", source_root)
        if stack_root is not None:
            pulumi.set(__self__, "stack_root", stack_root)

    @property
    @pulumi.getter(name="defaultBranch")
    def default_branch(self) -> pulumi.Input[str]:
        """
        Default branch of your code we fall back to if you do not have commit tracking set up.
        """
        return pulumi.get(self, "default_branch")

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

    @property
    @pulumi.getter(name="integrationId")
    def integration_id(self) -> pulumi.Input[str]:
        """
        Sentry Organization Integration ID.
        """
        return pulumi.get(self, "integration_id")

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

    @property
    @pulumi.getter
    def organization(self) -> pulumi.Input[str]:
        """
        The slug of the organization the code mapping is under.
        """
        return pulumi.get(self, "organization")

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

    @property
    @pulumi.getter(name="projectId")
    def project_id(self) -> pulumi.Input[str]:
        """
        Sentry Project ID.
        """
        return pulumi.get(self, "project_id")

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

    @property
    @pulumi.getter(name="repositoryId")
    def repository_id(self) -> pulumi.Input[str]:
        """
        Sentry Organization Repository ID.
        """
        return pulumi.get(self, "repository_id")

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

    @property
    @pulumi.getter(name="sourceRoot")
    def source_root(self) -> Optional[pulumi.Input[str]]:
        """
        https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        return pulumi.get(self, "source_root")

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

    @property
    @pulumi.getter(name="stackRoot")
    def stack_root(self) -> Optional[pulumi.Input[str]]:
        """
        https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        return pulumi.get(self, "stack_root")

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


@pulumi.input_type
class _SentryOrganizationCodeMappingState:
    def __init__(__self__, *,
                 default_branch: Optional[pulumi.Input[str]] = None,
                 integration_id: Optional[pulumi.Input[str]] = None,
                 internal_id: Optional[pulumi.Input[str]] = None,
                 organization: Optional[pulumi.Input[str]] = None,
                 project_id: Optional[pulumi.Input[str]] = None,
                 repository_id: Optional[pulumi.Input[str]] = None,
                 source_root: Optional[pulumi.Input[str]] = None,
                 stack_root: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering SentryOrganizationCodeMapping resources.
        :param pulumi.Input[str] default_branch: Default branch of your code we fall back to if you do not have commit tracking set up.
        :param pulumi.Input[str] integration_id: Sentry Organization Integration ID.
        :param pulumi.Input[str] internal_id: The internal ID for this resource.
        :param pulumi.Input[str] organization: The slug of the organization the code mapping is under.
        :param pulumi.Input[str] project_id: Sentry Project ID.
        :param pulumi.Input[str] repository_id: Sentry Organization Repository ID.
        :param pulumi.Input[str] source_root: https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        :param pulumi.Input[str] stack_root: https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        if default_branch is not None:
            pulumi.set(__self__, "default_branch", default_branch)
        if integration_id is not None:
            pulumi.set(__self__, "integration_id", integration_id)
        if internal_id is not None:
            pulumi.set(__self__, "internal_id", internal_id)
        if organization is not None:
            pulumi.set(__self__, "organization", organization)
        if project_id is not None:
            pulumi.set(__self__, "project_id", project_id)
        if repository_id is not None:
            pulumi.set(__self__, "repository_id", repository_id)
        if source_root is not None:
            pulumi.set(__self__, "source_root", source_root)
        if stack_root is not None:
            pulumi.set(__self__, "stack_root", stack_root)

    @property
    @pulumi.getter(name="defaultBranch")
    def default_branch(self) -> Optional[pulumi.Input[str]]:
        """
        Default branch of your code we fall back to if you do not have commit tracking set up.
        """
        return pulumi.get(self, "default_branch")

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

    @property
    @pulumi.getter(name="integrationId")
    def integration_id(self) -> Optional[pulumi.Input[str]]:
        """
        Sentry Organization Integration ID.
        """
        return pulumi.get(self, "integration_id")

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

    @property
    @pulumi.getter(name="internalId")
    def internal_id(self) -> Optional[pulumi.Input[str]]:
        """
        The internal ID for this resource.
        """
        return pulumi.get(self, "internal_id")

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

    @property
    @pulumi.getter
    def organization(self) -> Optional[pulumi.Input[str]]:
        """
        The slug of the organization the code mapping is under.
        """
        return pulumi.get(self, "organization")

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

    @property
    @pulumi.getter(name="projectId")
    def project_id(self) -> Optional[pulumi.Input[str]]:
        """
        Sentry Project ID.
        """
        return pulumi.get(self, "project_id")

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

    @property
    @pulumi.getter(name="repositoryId")
    def repository_id(self) -> Optional[pulumi.Input[str]]:
        """
        Sentry Organization Repository ID.
        """
        return pulumi.get(self, "repository_id")

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

    @property
    @pulumi.getter(name="sourceRoot")
    def source_root(self) -> Optional[pulumi.Input[str]]:
        """
        https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        return pulumi.get(self, "source_root")

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

    @property
    @pulumi.getter(name="stackRoot")
    def stack_root(self) -> Optional[pulumi.Input[str]]:
        """
        https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        return pulumi.get(self, "stack_root")

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


class SentryOrganizationCodeMapping(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 default_branch: Optional[pulumi.Input[str]] = None,
                 integration_id: Optional[pulumi.Input[str]] = None,
                 organization: Optional[pulumi.Input[str]] = None,
                 project_id: Optional[pulumi.Input[str]] = None,
                 repository_id: Optional[pulumi.Input[str]] = None,
                 source_root: Optional[pulumi.Input[str]] = None,
                 stack_root: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Sentry Organization Code Mapping resource.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_sentry as sentry
        import pulumiverse_sentry as sentry

        # Retrieve the Github organization integration
        github = sentry.get_sentry_organization_integration(organization="my-organization",
            provider_key="github",
            name="my-github-organization")
        this = sentry.SentryProject("this",
            organization="my-organization",
            team="my-team",
            name="Web App",
            slug="web-app",
            platform="javascript",
            resolve_age=720)
        this_sentry_organization_repository_github = sentry.SentryOrganizationRepositoryGithub("this",
            organization="my-organization",
            integration_id=github.internal_id,
            identifier="my-github-organization/my-github-repo")
        this_sentry_organization_code_mapping = sentry.SentryOrganizationCodeMapping("this",
            organization="my-organization",
            integration_id=github.internal_id,
            repository_id=this_sentry_organization_repository_github.internal_id,
            project_id=this.internal_id,
            default_branch="main",
            stack_root="/",
            source_root="src/")
        ```

        ## Import

        import using the organization slug from the URL:

        https://sentry.io/settings/[org-slug]/integrations/github/[org-integration-id]/

        and inspect network tab for request to https://sentry.io/api/0/organizations/[org-slug]/code-mappings/

        find the corresponding list element and reference [code-mapping-id] from the key "id"

        ```sh
        $ pulumi import sentry:index/sentryOrganizationCodeMapping:SentryOrganizationCodeMapping this org-slug/31347
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] default_branch: Default branch of your code we fall back to if you do not have commit tracking set up.
        :param pulumi.Input[str] integration_id: Sentry Organization Integration ID.
        :param pulumi.Input[str] organization: The slug of the organization the code mapping is under.
        :param pulumi.Input[str] project_id: Sentry Project ID.
        :param pulumi.Input[str] repository_id: Sentry Organization Repository ID.
        :param pulumi.Input[str] source_root: https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        :param pulumi.Input[str] stack_root: https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: SentryOrganizationCodeMappingArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Sentry Organization Code Mapping resource.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_sentry as sentry
        import pulumiverse_sentry as sentry

        # Retrieve the Github organization integration
        github = sentry.get_sentry_organization_integration(organization="my-organization",
            provider_key="github",
            name="my-github-organization")
        this = sentry.SentryProject("this",
            organization="my-organization",
            team="my-team",
            name="Web App",
            slug="web-app",
            platform="javascript",
            resolve_age=720)
        this_sentry_organization_repository_github = sentry.SentryOrganizationRepositoryGithub("this",
            organization="my-organization",
            integration_id=github.internal_id,
            identifier="my-github-organization/my-github-repo")
        this_sentry_organization_code_mapping = sentry.SentryOrganizationCodeMapping("this",
            organization="my-organization",
            integration_id=github.internal_id,
            repository_id=this_sentry_organization_repository_github.internal_id,
            project_id=this.internal_id,
            default_branch="main",
            stack_root="/",
            source_root="src/")
        ```

        ## Import

        import using the organization slug from the URL:

        https://sentry.io/settings/[org-slug]/integrations/github/[org-integration-id]/

        and inspect network tab for request to https://sentry.io/api/0/organizations/[org-slug]/code-mappings/

        find the corresponding list element and reference [code-mapping-id] from the key "id"

        ```sh
        $ pulumi import sentry:index/sentryOrganizationCodeMapping:SentryOrganizationCodeMapping this org-slug/31347
        ```

        :param str resource_name: The name of the resource.
        :param SentryOrganizationCodeMappingArgs 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(SentryOrganizationCodeMappingArgs, 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,
                 default_branch: Optional[pulumi.Input[str]] = None,
                 integration_id: Optional[pulumi.Input[str]] = None,
                 organization: Optional[pulumi.Input[str]] = None,
                 project_id: Optional[pulumi.Input[str]] = None,
                 repository_id: Optional[pulumi.Input[str]] = None,
                 source_root: Optional[pulumi.Input[str]] = None,
                 stack_root: 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__ = SentryOrganizationCodeMappingArgs.__new__(SentryOrganizationCodeMappingArgs)

            if default_branch is None and not opts.urn:
                raise TypeError("Missing required property 'default_branch'")
            __props__.__dict__["default_branch"] = default_branch
            if integration_id is None and not opts.urn:
                raise TypeError("Missing required property 'integration_id'")
            __props__.__dict__["integration_id"] = integration_id
            if organization is None and not opts.urn:
                raise TypeError("Missing required property 'organization'")
            __props__.__dict__["organization"] = organization
            if project_id is None and not opts.urn:
                raise TypeError("Missing required property 'project_id'")
            __props__.__dict__["project_id"] = project_id
            if repository_id is None and not opts.urn:
                raise TypeError("Missing required property 'repository_id'")
            __props__.__dict__["repository_id"] = repository_id
            __props__.__dict__["source_root"] = source_root
            __props__.__dict__["stack_root"] = stack_root
            __props__.__dict__["internal_id"] = None
        super(SentryOrganizationCodeMapping, __self__).__init__(
            'sentry:index/sentryOrganizationCodeMapping:SentryOrganizationCodeMapping',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            default_branch: Optional[pulumi.Input[str]] = None,
            integration_id: Optional[pulumi.Input[str]] = None,
            internal_id: Optional[pulumi.Input[str]] = None,
            organization: Optional[pulumi.Input[str]] = None,
            project_id: Optional[pulumi.Input[str]] = None,
            repository_id: Optional[pulumi.Input[str]] = None,
            source_root: Optional[pulumi.Input[str]] = None,
            stack_root: Optional[pulumi.Input[str]] = None) -> 'SentryOrganizationCodeMapping':
        """
        Get an existing SentryOrganizationCodeMapping 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] default_branch: Default branch of your code we fall back to if you do not have commit tracking set up.
        :param pulumi.Input[str] integration_id: Sentry Organization Integration ID.
        :param pulumi.Input[str] internal_id: The internal ID for this resource.
        :param pulumi.Input[str] organization: The slug of the organization the code mapping is under.
        :param pulumi.Input[str] project_id: Sentry Project ID.
        :param pulumi.Input[str] repository_id: Sentry Organization Repository ID.
        :param pulumi.Input[str] source_root: https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        :param pulumi.Input[str] stack_root: https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _SentryOrganizationCodeMappingState.__new__(_SentryOrganizationCodeMappingState)

        __props__.__dict__["default_branch"] = default_branch
        __props__.__dict__["integration_id"] = integration_id
        __props__.__dict__["internal_id"] = internal_id
        __props__.__dict__["organization"] = organization
        __props__.__dict__["project_id"] = project_id
        __props__.__dict__["repository_id"] = repository_id
        __props__.__dict__["source_root"] = source_root
        __props__.__dict__["stack_root"] = stack_root
        return SentryOrganizationCodeMapping(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="defaultBranch")
    def default_branch(self) -> pulumi.Output[str]:
        """
        Default branch of your code we fall back to if you do not have commit tracking set up.
        """
        return pulumi.get(self, "default_branch")

    @property
    @pulumi.getter(name="integrationId")
    def integration_id(self) -> pulumi.Output[str]:
        """
        Sentry Organization Integration ID.
        """
        return pulumi.get(self, "integration_id")

    @property
    @pulumi.getter(name="internalId")
    def internal_id(self) -> pulumi.Output[str]:
        """
        The internal ID for this resource.
        """
        return pulumi.get(self, "internal_id")

    @property
    @pulumi.getter
    def organization(self) -> pulumi.Output[str]:
        """
        The slug of the organization the code mapping is under.
        """
        return pulumi.get(self, "organization")

    @property
    @pulumi.getter(name="projectId")
    def project_id(self) -> pulumi.Output[str]:
        """
        Sentry Project ID.
        """
        return pulumi.get(self, "project_id")

    @property
    @pulumi.getter(name="repositoryId")
    def repository_id(self) -> pulumi.Output[str]:
        """
        Sentry Organization Repository ID.
        """
        return pulumi.get(self, "repository_id")

    @property
    @pulumi.getter(name="sourceRoot")
    def source_root(self) -> pulumi.Output[Optional[str]]:
        """
        https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        return pulumi.get(self, "source_root")

    @property
    @pulumi.getter(name="stackRoot")
    def stack_root(self) -> pulumi.Output[Optional[str]]:
        """
        https://docs.sentry.io/product/integrations/source-code-mgmt/github/#stack-trace-linking
        """
        return pulumi.get(self, "stack_root")

