# 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__ = ['GroupAssignmentArgs', 'GroupAssignment']

@pulumi.input_type
class GroupAssignmentArgs:
    def __init__(__self__, *,
                 app_id: pulumi.Input[_builtins.str],
                 group_id: pulumi.Input[_builtins.str],
                 priority: Optional[pulumi.Input[_builtins.int]] = None,
                 profile: Optional[pulumi.Input[_builtins.str]] = None,
                 retain_assignment: Optional[pulumi.Input[_builtins.bool]] = None):
        """
        The set of arguments for constructing a GroupAssignment resource.

        :param pulumi.Input[_builtins.str] app_id: App to associate group with
        :param pulumi.Input[_builtins.str] group_id: Group associated with the application
        :param pulumi.Input[_builtins.int] priority: Priority of group assignment.
        :param pulumi.Input[_builtins.str] profile: JSON document containing [application profile](https://developer.okta.com/docs/reference/api/apps/#profile-object)
        :param pulumi.Input[_builtins.bool] retain_assignment: Retain the group assignment on destroy. If set to true, the resource will be removed from state but not from the Okta app.
        """
        pulumi.set(__self__, "app_id", app_id)
        pulumi.set(__self__, "group_id", group_id)
        if priority is not None:
            pulumi.set(__self__, "priority", priority)
        if profile is not None:
            pulumi.set(__self__, "profile", profile)
        if retain_assignment is not None:
            pulumi.set(__self__, "retain_assignment", retain_assignment)

    @_builtins.property
    @pulumi.getter(name="appId")
    def app_id(self) -> pulumi.Input[_builtins.str]:
        """
        App to associate group with
        """
        return pulumi.get(self, "app_id")

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

    @_builtins.property
    @pulumi.getter(name="groupId")
    def group_id(self) -> pulumi.Input[_builtins.str]:
        """
        Group associated with the application
        """
        return pulumi.get(self, "group_id")

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

    @_builtins.property
    @pulumi.getter
    def priority(self) -> Optional[pulumi.Input[_builtins.int]]:
        """
        Priority of group assignment.
        """
        return pulumi.get(self, "priority")

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

    @_builtins.property
    @pulumi.getter
    def profile(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        JSON document containing [application profile](https://developer.okta.com/docs/reference/api/apps/#profile-object)
        """
        return pulumi.get(self, "profile")

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

    @_builtins.property
    @pulumi.getter(name="retainAssignment")
    def retain_assignment(self) -> Optional[pulumi.Input[_builtins.bool]]:
        """
        Retain the group assignment on destroy. If set to true, the resource will be removed from state but not from the Okta app.
        """
        return pulumi.get(self, "retain_assignment")

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


@pulumi.input_type
class _GroupAssignmentState:
    def __init__(__self__, *,
                 app_id: Optional[pulumi.Input[_builtins.str]] = None,
                 group_id: Optional[pulumi.Input[_builtins.str]] = None,
                 priority: Optional[pulumi.Input[_builtins.int]] = None,
                 profile: Optional[pulumi.Input[_builtins.str]] = None,
                 retain_assignment: Optional[pulumi.Input[_builtins.bool]] = None):
        """
        Input properties used for looking up and filtering GroupAssignment resources.

        :param pulumi.Input[_builtins.str] app_id: App to associate group with
        :param pulumi.Input[_builtins.str] group_id: Group associated with the application
        :param pulumi.Input[_builtins.int] priority: Priority of group assignment.
        :param pulumi.Input[_builtins.str] profile: JSON document containing [application profile](https://developer.okta.com/docs/reference/api/apps/#profile-object)
        :param pulumi.Input[_builtins.bool] retain_assignment: Retain the group assignment on destroy. If set to true, the resource will be removed from state but not from the Okta app.
        """
        if app_id is not None:
            pulumi.set(__self__, "app_id", app_id)
        if group_id is not None:
            pulumi.set(__self__, "group_id", group_id)
        if priority is not None:
            pulumi.set(__self__, "priority", priority)
        if profile is not None:
            pulumi.set(__self__, "profile", profile)
        if retain_assignment is not None:
            pulumi.set(__self__, "retain_assignment", retain_assignment)

    @_builtins.property
    @pulumi.getter(name="appId")
    def app_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        App to associate group with
        """
        return pulumi.get(self, "app_id")

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

    @_builtins.property
    @pulumi.getter(name="groupId")
    def group_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Group associated with the application
        """
        return pulumi.get(self, "group_id")

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

    @_builtins.property
    @pulumi.getter
    def priority(self) -> Optional[pulumi.Input[_builtins.int]]:
        """
        Priority of group assignment.
        """
        return pulumi.get(self, "priority")

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

    @_builtins.property
    @pulumi.getter
    def profile(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        JSON document containing [application profile](https://developer.okta.com/docs/reference/api/apps/#profile-object)
        """
        return pulumi.get(self, "profile")

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

    @_builtins.property
    @pulumi.getter(name="retainAssignment")
    def retain_assignment(self) -> Optional[pulumi.Input[_builtins.bool]]:
        """
        Retain the group assignment on destroy. If set to true, the resource will be removed from state but not from the Okta app.
        """
        return pulumi.get(self, "retain_assignment")

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


@pulumi.type_token("okta:app/groupAssignment:GroupAssignment")
class GroupAssignment(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 app_id: Optional[pulumi.Input[_builtins.str]] = None,
                 group_id: Optional[pulumi.Input[_builtins.str]] = None,
                 priority: Optional[pulumi.Input[_builtins.int]] = None,
                 profile: Optional[pulumi.Input[_builtins.str]] = None,
                 retain_assignment: Optional[pulumi.Input[_builtins.bool]] = None,
                 __props__=None):
        """
        Assigns a group to an application. This resource allows you to create an App Group assignment.

        > **IMPORTANT:** When the `app_group_assignment` is retained, by
        setting `retain_assignment` to `true`, it is no longer managed by
        Terraform after it is destroyed. To truly delete the assignment,
        you will need to remove it either through the Okta Console or API.
        This argument exists for the use case where the same group is
        assigned in multiple places in order to prevent a single
        destruction removing all of them.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_okta as okta

        example = okta.app.GroupAssignment("example",
            app_id="<app id>",
            group_id="<group id>",
            profile=\"\"\"{
          \\"<app_profile_field>\\": \\"<value>\\"
        }
        \"\"\")
        ```

        ## Import

        ```sh
        $ pulumi import okta:app/groupAssignment:GroupAssignment example <app_id>/<group_id>
        ```


        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] app_id: App to associate group with
        :param pulumi.Input[_builtins.str] group_id: Group associated with the application
        :param pulumi.Input[_builtins.int] priority: Priority of group assignment.
        :param pulumi.Input[_builtins.str] profile: JSON document containing [application profile](https://developer.okta.com/docs/reference/api/apps/#profile-object)
        :param pulumi.Input[_builtins.bool] retain_assignment: Retain the group assignment on destroy. If set to true, the resource will be removed from state but not from the Okta app.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: GroupAssignmentArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Assigns a group to an application. This resource allows you to create an App Group assignment.

        > **IMPORTANT:** When the `app_group_assignment` is retained, by
        setting `retain_assignment` to `true`, it is no longer managed by
        Terraform after it is destroyed. To truly delete the assignment,
        you will need to remove it either through the Okta Console or API.
        This argument exists for the use case where the same group is
        assigned in multiple places in order to prevent a single
        destruction removing all of them.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_okta as okta

        example = okta.app.GroupAssignment("example",
            app_id="<app id>",
            group_id="<group id>",
            profile=\"\"\"{
          \\"<app_profile_field>\\": \\"<value>\\"
        }
        \"\"\")
        ```

        ## Import

        ```sh
        $ pulumi import okta:app/groupAssignment:GroupAssignment example <app_id>/<group_id>
        ```


        :param str resource_name: The name of the resource.
        :param GroupAssignmentArgs 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(GroupAssignmentArgs, 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,
                 app_id: Optional[pulumi.Input[_builtins.str]] = None,
                 group_id: Optional[pulumi.Input[_builtins.str]] = None,
                 priority: Optional[pulumi.Input[_builtins.int]] = None,
                 profile: Optional[pulumi.Input[_builtins.str]] = None,
                 retain_assignment: 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__ = GroupAssignmentArgs.__new__(GroupAssignmentArgs)

            if app_id is None and not opts.urn:
                raise TypeError("Missing required property 'app_id'")
            __props__.__dict__["app_id"] = app_id
            if group_id is None and not opts.urn:
                raise TypeError("Missing required property 'group_id'")
            __props__.__dict__["group_id"] = group_id
            __props__.__dict__["priority"] = priority
            __props__.__dict__["profile"] = profile
            __props__.__dict__["retain_assignment"] = retain_assignment
        super(GroupAssignment, __self__).__init__(
            'okta:app/groupAssignment:GroupAssignment',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            app_id: Optional[pulumi.Input[_builtins.str]] = None,
            group_id: Optional[pulumi.Input[_builtins.str]] = None,
            priority: Optional[pulumi.Input[_builtins.int]] = None,
            profile: Optional[pulumi.Input[_builtins.str]] = None,
            retain_assignment: Optional[pulumi.Input[_builtins.bool]] = None) -> 'GroupAssignment':
        """
        Get an existing GroupAssignment 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] app_id: App to associate group with
        :param pulumi.Input[_builtins.str] group_id: Group associated with the application
        :param pulumi.Input[_builtins.int] priority: Priority of group assignment.
        :param pulumi.Input[_builtins.str] profile: JSON document containing [application profile](https://developer.okta.com/docs/reference/api/apps/#profile-object)
        :param pulumi.Input[_builtins.bool] retain_assignment: Retain the group assignment on destroy. If set to true, the resource will be removed from state but not from the Okta app.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _GroupAssignmentState.__new__(_GroupAssignmentState)

        __props__.__dict__["app_id"] = app_id
        __props__.__dict__["group_id"] = group_id
        __props__.__dict__["priority"] = priority
        __props__.__dict__["profile"] = profile
        __props__.__dict__["retain_assignment"] = retain_assignment
        return GroupAssignment(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="appId")
    def app_id(self) -> pulumi.Output[_builtins.str]:
        """
        App to associate group with
        """
        return pulumi.get(self, "app_id")

    @_builtins.property
    @pulumi.getter(name="groupId")
    def group_id(self) -> pulumi.Output[_builtins.str]:
        """
        Group associated with the application
        """
        return pulumi.get(self, "group_id")

    @_builtins.property
    @pulumi.getter
    def priority(self) -> pulumi.Output[Optional[_builtins.int]]:
        """
        Priority of group assignment.
        """
        return pulumi.get(self, "priority")

    @_builtins.property
    @pulumi.getter
    def profile(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        JSON document containing [application profile](https://developer.okta.com/docs/reference/api/apps/#profile-object)
        """
        return pulumi.get(self, "profile")

    @_builtins.property
    @pulumi.getter(name="retainAssignment")
    def retain_assignment(self) -> pulumi.Output[Optional[_builtins.bool]]:
        """
        Retain the group assignment on destroy. If set to true, the resource will be removed from state but not from the Okta app.
        """
        return pulumi.get(self, "retain_assignment")

