# 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
from . import outputs
from ._inputs import *

__all__ = ['ConnectionArgs', 'Connection']

@pulumi.input_type
class ConnectionArgs:
    def __init__(__self__, *,
                 action: pulumi.Input[_builtins.str],
                 base_url: pulumi.Input[_builtins.str],
                 id_property: pulumi.Input[_builtins.str],
                 profile: Optional[pulumi.Input['ConnectionProfileArgs']] = None):
        """
        The set of arguments for constructing a Connection resource.
        :param pulumi.Input[_builtins.str] action: The action to perform on the connection. Valid values are `activate` or `deactivate`.
        :param pulumi.Input[_builtins.str] base_url: The base URL for the provisioning connection.
        :param pulumi.Input[_builtins.str] id_property: The application ID.
        :param pulumi.Input['ConnectionProfileArgs'] profile: Profile configuration for the app connection.
        """
        pulumi.set(__self__, "action", action)
        pulumi.set(__self__, "base_url", base_url)
        pulumi.set(__self__, "id_property", id_property)
        if profile is not None:
            pulumi.set(__self__, "profile", profile)

    @_builtins.property
    @pulumi.getter
    def action(self) -> pulumi.Input[_builtins.str]:
        """
        The action to perform on the connection. Valid values are `activate` or `deactivate`.
        """
        return pulumi.get(self, "action")

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

    @_builtins.property
    @pulumi.getter(name="baseUrl")
    def base_url(self) -> pulumi.Input[_builtins.str]:
        """
        The base URL for the provisioning connection.
        """
        return pulumi.get(self, "base_url")

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

    @_builtins.property
    @pulumi.getter(name="idProperty")
    def id_property(self) -> pulumi.Input[_builtins.str]:
        """
        The application ID.
        """
        return pulumi.get(self, "id_property")

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

    @_builtins.property
    @pulumi.getter
    def profile(self) -> Optional[pulumi.Input['ConnectionProfileArgs']]:
        """
        Profile configuration for the app connection.
        """
        return pulumi.get(self, "profile")

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


@pulumi.input_type
class _ConnectionState:
    def __init__(__self__, *,
                 action: Optional[pulumi.Input[_builtins.str]] = None,
                 base_url: Optional[pulumi.Input[_builtins.str]] = None,
                 id_property: Optional[pulumi.Input[_builtins.str]] = None,
                 profile: Optional[pulumi.Input['ConnectionProfileArgs']] = None,
                 status: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering Connection resources.
        :param pulumi.Input[_builtins.str] action: The action to perform on the connection. Valid values are `activate` or `deactivate`.
        :param pulumi.Input[_builtins.str] base_url: The base URL for the provisioning connection.
        :param pulumi.Input[_builtins.str] id_property: The application ID.
        :param pulumi.Input['ConnectionProfileArgs'] profile: Profile configuration for the app connection.
        :param pulumi.Input[_builtins.str] status: Provisioning connection status.
        """
        if action is not None:
            pulumi.set(__self__, "action", action)
        if base_url is not None:
            pulumi.set(__self__, "base_url", base_url)
        if id_property is not None:
            pulumi.set(__self__, "id_property", id_property)
        if profile is not None:
            pulumi.set(__self__, "profile", profile)
        if status is not None:
            pulumi.set(__self__, "status", status)

    @_builtins.property
    @pulumi.getter
    def action(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The action to perform on the connection. Valid values are `activate` or `deactivate`.
        """
        return pulumi.get(self, "action")

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

    @_builtins.property
    @pulumi.getter(name="baseUrl")
    def base_url(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The base URL for the provisioning connection.
        """
        return pulumi.get(self, "base_url")

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

    @_builtins.property
    @pulumi.getter(name="idProperty")
    def id_property(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The application ID.
        """
        return pulumi.get(self, "id_property")

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

    @_builtins.property
    @pulumi.getter
    def profile(self) -> Optional[pulumi.Input['ConnectionProfileArgs']]:
        """
        Profile configuration for the app connection.
        """
        return pulumi.get(self, "profile")

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

    @_builtins.property
    @pulumi.getter
    def status(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Provisioning connection status.
        """
        return pulumi.get(self, "status")

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


@pulumi.type_token("okta:app/connection:Connection")
class Connection(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 action: Optional[pulumi.Input[_builtins.str]] = None,
                 base_url: Optional[pulumi.Input[_builtins.str]] = None,
                 id_property: Optional[pulumi.Input[_builtins.str]] = None,
                 profile: Optional[pulumi.Input[Union['ConnectionProfileArgs', 'ConnectionProfileArgsDict']]] = None,
                 __props__=None):
        """
        Manages Okta App Connection configurations for provisioning. This resource allows you to configure and manage provisioning connections for applications, including authentication schemes and connection activation/deactivation.

        ## Example Usage

        ### TOKEN Authentication

        ```python
        import pulumi
        import pulumi_okta as okta

        token_example = okta.app.Connection("token_example",
            id_property="0oa1234567890abcdef",
            base_url="https://api.example.com/scim/v2",
            action="activate",
            profile={
                "auth_scheme": "TOKEN",
                "token": "your-bearer-token-here",
            })
        ```

        ### OAUTH2 Authentication

        ```python
        import pulumi
        import pulumi_okta as okta

        oauth2_example = okta.app.Connection("oauth2_example",
            id_property="0oa1234567890abcdef",
            action="activate",
            profile={
                "auth_scheme": "OAUTH2",
                "client_id": "oauth2-client-id",
                "settings": {
                    "admin_username": "admin@example.com",
                    "admin_password": "secure-password",
                },
                "signing": {
                    "rotation_mode": "MANUAL",
                },
            })
        ```

        ### Deactivated Connection

        ```python
        import pulumi
        import pulumi_okta as okta

        deactivated_example = okta.app.Connection("deactivated_example",
            id_property="0oa1234567890abcdef",
            base_url="https://api.example.com/scim/v2",
            action="deactivate",
            profile={
                "auth_scheme": "TOKEN",
                "token": "your-bearer-token-here",
            })
        ```

        ## Import

        App connections can be imported using the application ID:

        ```sh
        $ pulumi import okta:app/connection:Connection example <application_id>
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] action: The action to perform on the connection. Valid values are `activate` or `deactivate`.
        :param pulumi.Input[_builtins.str] base_url: The base URL for the provisioning connection.
        :param pulumi.Input[_builtins.str] id_property: The application ID.
        :param pulumi.Input[Union['ConnectionProfileArgs', 'ConnectionProfileArgsDict']] profile: Profile configuration for the app connection.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ConnectionArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages Okta App Connection configurations for provisioning. This resource allows you to configure and manage provisioning connections for applications, including authentication schemes and connection activation/deactivation.

        ## Example Usage

        ### TOKEN Authentication

        ```python
        import pulumi
        import pulumi_okta as okta

        token_example = okta.app.Connection("token_example",
            id_property="0oa1234567890abcdef",
            base_url="https://api.example.com/scim/v2",
            action="activate",
            profile={
                "auth_scheme": "TOKEN",
                "token": "your-bearer-token-here",
            })
        ```

        ### OAUTH2 Authentication

        ```python
        import pulumi
        import pulumi_okta as okta

        oauth2_example = okta.app.Connection("oauth2_example",
            id_property="0oa1234567890abcdef",
            action="activate",
            profile={
                "auth_scheme": "OAUTH2",
                "client_id": "oauth2-client-id",
                "settings": {
                    "admin_username": "admin@example.com",
                    "admin_password": "secure-password",
                },
                "signing": {
                    "rotation_mode": "MANUAL",
                },
            })
        ```

        ### Deactivated Connection

        ```python
        import pulumi
        import pulumi_okta as okta

        deactivated_example = okta.app.Connection("deactivated_example",
            id_property="0oa1234567890abcdef",
            base_url="https://api.example.com/scim/v2",
            action="deactivate",
            profile={
                "auth_scheme": "TOKEN",
                "token": "your-bearer-token-here",
            })
        ```

        ## Import

        App connections can be imported using the application ID:

        ```sh
        $ pulumi import okta:app/connection:Connection example <application_id>
        ```

        :param str resource_name: The name of the resource.
        :param ConnectionArgs 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(ConnectionArgs, 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,
                 action: Optional[pulumi.Input[_builtins.str]] = None,
                 base_url: Optional[pulumi.Input[_builtins.str]] = None,
                 id_property: Optional[pulumi.Input[_builtins.str]] = None,
                 profile: Optional[pulumi.Input[Union['ConnectionProfileArgs', 'ConnectionProfileArgsDict']]] = 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__ = ConnectionArgs.__new__(ConnectionArgs)

            if action is None and not opts.urn:
                raise TypeError("Missing required property 'action'")
            __props__.__dict__["action"] = action
            if base_url is None and not opts.urn:
                raise TypeError("Missing required property 'base_url'")
            __props__.__dict__["base_url"] = base_url
            if id_property is None and not opts.urn:
                raise TypeError("Missing required property 'id_property'")
            __props__.__dict__["id_property"] = id_property
            __props__.__dict__["profile"] = profile
            __props__.__dict__["status"] = None
        super(Connection, __self__).__init__(
            'okta:app/connection:Connection',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            action: Optional[pulumi.Input[_builtins.str]] = None,
            base_url: Optional[pulumi.Input[_builtins.str]] = None,
            id_property: Optional[pulumi.Input[_builtins.str]] = None,
            profile: Optional[pulumi.Input[Union['ConnectionProfileArgs', 'ConnectionProfileArgsDict']]] = None,
            status: Optional[pulumi.Input[_builtins.str]] = None) -> 'Connection':
        """
        Get an existing Connection 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] action: The action to perform on the connection. Valid values are `activate` or `deactivate`.
        :param pulumi.Input[_builtins.str] base_url: The base URL for the provisioning connection.
        :param pulumi.Input[_builtins.str] id_property: The application ID.
        :param pulumi.Input[Union['ConnectionProfileArgs', 'ConnectionProfileArgsDict']] profile: Profile configuration for the app connection.
        :param pulumi.Input[_builtins.str] status: Provisioning connection status.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ConnectionState.__new__(_ConnectionState)

        __props__.__dict__["action"] = action
        __props__.__dict__["base_url"] = base_url
        __props__.__dict__["id_property"] = id_property
        __props__.__dict__["profile"] = profile
        __props__.__dict__["status"] = status
        return Connection(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter
    def action(self) -> pulumi.Output[_builtins.str]:
        """
        The action to perform on the connection. Valid values are `activate` or `deactivate`.
        """
        return pulumi.get(self, "action")

    @_builtins.property
    @pulumi.getter(name="baseUrl")
    def base_url(self) -> pulumi.Output[_builtins.str]:
        """
        The base URL for the provisioning connection.
        """
        return pulumi.get(self, "base_url")

    @_builtins.property
    @pulumi.getter(name="idProperty")
    def id_property(self) -> pulumi.Output[_builtins.str]:
        """
        The application ID.
        """
        return pulumi.get(self, "id_property")

    @_builtins.property
    @pulumi.getter
    def profile(self) -> pulumi.Output[Optional['outputs.ConnectionProfile']]:
        """
        Profile configuration for the app connection.
        """
        return pulumi.get(self, "profile")

    @_builtins.property
    @pulumi.getter
    def status(self) -> pulumi.Output[_builtins.str]:
        """
        Provisioning connection status.
        """
        return pulumi.get(self, "status")

