# 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__ = ['SecretAclArgs', 'SecretAcl']

@pulumi.input_type
class SecretAclArgs:
    def __init__(__self__, *,
                 permission: pulumi.Input[_builtins.str],
                 principal: pulumi.Input[_builtins.str],
                 scope: pulumi.Input[_builtins.str],
                 provider_config: Optional[pulumi.Input['SecretAclProviderConfigArgs']] = None):
        """
        The set of arguments for constructing a SecretAcl resource.
        :param pulumi.Input[_builtins.str] permission: `READ`, `WRITE` or `MANAGE`.
        :param pulumi.Input[_builtins.str] principal: principal's identifier. It can be:
        :param pulumi.Input[_builtins.str] scope: name of the scope
        :param pulumi.Input['SecretAclProviderConfigArgs'] provider_config: Configure the provider for management through account provider. This block consists of the following fields:
        """
        pulumi.set(__self__, "permission", permission)
        pulumi.set(__self__, "principal", principal)
        pulumi.set(__self__, "scope", scope)
        if provider_config is not None:
            pulumi.set(__self__, "provider_config", provider_config)

    @_builtins.property
    @pulumi.getter
    def permission(self) -> pulumi.Input[_builtins.str]:
        """
        `READ`, `WRITE` or `MANAGE`.
        """
        return pulumi.get(self, "permission")

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

    @_builtins.property
    @pulumi.getter
    def principal(self) -> pulumi.Input[_builtins.str]:
        """
        principal's identifier. It can be:
        """
        return pulumi.get(self, "principal")

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

    @_builtins.property
    @pulumi.getter
    def scope(self) -> pulumi.Input[_builtins.str]:
        """
        name of the scope
        """
        return pulumi.get(self, "scope")

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

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> Optional[pulumi.Input['SecretAclProviderConfigArgs']]:
        """
        Configure the provider for management through account provider. This block consists of the following fields:
        """
        return pulumi.get(self, "provider_config")

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


@pulumi.input_type
class _SecretAclState:
    def __init__(__self__, *,
                 permission: Optional[pulumi.Input[_builtins.str]] = None,
                 principal: Optional[pulumi.Input[_builtins.str]] = None,
                 provider_config: Optional[pulumi.Input['SecretAclProviderConfigArgs']] = None,
                 scope: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering SecretAcl resources.
        :param pulumi.Input[_builtins.str] permission: `READ`, `WRITE` or `MANAGE`.
        :param pulumi.Input[_builtins.str] principal: principal's identifier. It can be:
        :param pulumi.Input['SecretAclProviderConfigArgs'] provider_config: Configure the provider for management through account provider. This block consists of the following fields:
        :param pulumi.Input[_builtins.str] scope: name of the scope
        """
        if permission is not None:
            pulumi.set(__self__, "permission", permission)
        if principal is not None:
            pulumi.set(__self__, "principal", principal)
        if provider_config is not None:
            pulumi.set(__self__, "provider_config", provider_config)
        if scope is not None:
            pulumi.set(__self__, "scope", scope)

    @_builtins.property
    @pulumi.getter
    def permission(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        `READ`, `WRITE` or `MANAGE`.
        """
        return pulumi.get(self, "permission")

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

    @_builtins.property
    @pulumi.getter
    def principal(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        principal's identifier. It can be:
        """
        return pulumi.get(self, "principal")

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

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> Optional[pulumi.Input['SecretAclProviderConfigArgs']]:
        """
        Configure the provider for management through account provider. This block consists of the following fields:
        """
        return pulumi.get(self, "provider_config")

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

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

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


@pulumi.type_token("databricks:index/secretAcl:SecretAcl")
class SecretAcl(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 permission: Optional[pulumi.Input[_builtins.str]] = None,
                 principal: Optional[pulumi.Input[_builtins.str]] = None,
                 provider_config: Optional[pulumi.Input[Union['SecretAclProviderConfigArgs', 'SecretAclProviderConfigArgsDict']]] = None,
                 scope: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        Create or overwrite the ACL associated with the given principal (user or group) on the specified databricks_secret_scope. Please consult [Secrets User Guide](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) for more details.

        > This resource can only be used with a workspace-level provider!

        ## Example Usage

        This way, data scientists can read the Publishing API key that is synchronized from, for example, Azure Key Vault.

        ```python
        import pulumi
        import pulumi_databricks as databricks

        ds = databricks.Group("ds", display_name="data-scientists")
        app = databricks.SecretScope("app", name="app-secret-scope")
        my_secret_acl = databricks.SecretAcl("my_secret_acl",
            principal=ds.display_name,
            permission="READ",
            scope=app.name)
        publishing_api = databricks.Secret("publishing_api",
            key="publishing_api",
            string_value=example["value"],
            scope=app.name)
        ```

        ## Related Resources

        The following resources are often used in the same context:

        * End to end workspace management guide.
        * Notebook to manage [Databricks Notebooks](https://docs.databricks.com/notebooks/index.html).
        * Permissions to manage [access control](https://docs.databricks.com/security/access-control/index.html) in Databricks workspace.
        * Repo to manage [Databricks Repos](https://docs.databricks.com/repos.html).
        * Secret to manage [secrets](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) in Databricks workspace.
        * SecretScope to create [secret scopes](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) in Databricks workspace.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] permission: `READ`, `WRITE` or `MANAGE`.
        :param pulumi.Input[_builtins.str] principal: principal's identifier. It can be:
        :param pulumi.Input[Union['SecretAclProviderConfigArgs', 'SecretAclProviderConfigArgsDict']] provider_config: Configure the provider for management through account provider. This block consists of the following fields:
        :param pulumi.Input[_builtins.str] scope: name of the scope
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: SecretAclArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Create or overwrite the ACL associated with the given principal (user or group) on the specified databricks_secret_scope. Please consult [Secrets User Guide](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) for more details.

        > This resource can only be used with a workspace-level provider!

        ## Example Usage

        This way, data scientists can read the Publishing API key that is synchronized from, for example, Azure Key Vault.

        ```python
        import pulumi
        import pulumi_databricks as databricks

        ds = databricks.Group("ds", display_name="data-scientists")
        app = databricks.SecretScope("app", name="app-secret-scope")
        my_secret_acl = databricks.SecretAcl("my_secret_acl",
            principal=ds.display_name,
            permission="READ",
            scope=app.name)
        publishing_api = databricks.Secret("publishing_api",
            key="publishing_api",
            string_value=example["value"],
            scope=app.name)
        ```

        ## Related Resources

        The following resources are often used in the same context:

        * End to end workspace management guide.
        * Notebook to manage [Databricks Notebooks](https://docs.databricks.com/notebooks/index.html).
        * Permissions to manage [access control](https://docs.databricks.com/security/access-control/index.html) in Databricks workspace.
        * Repo to manage [Databricks Repos](https://docs.databricks.com/repos.html).
        * Secret to manage [secrets](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) in Databricks workspace.
        * SecretScope to create [secret scopes](https://docs.databricks.com/security/secrets/index.html#secrets-user-guide) in Databricks workspace.

        :param str resource_name: The name of the resource.
        :param SecretAclArgs 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(SecretAclArgs, 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,
                 permission: Optional[pulumi.Input[_builtins.str]] = None,
                 principal: Optional[pulumi.Input[_builtins.str]] = None,
                 provider_config: Optional[pulumi.Input[Union['SecretAclProviderConfigArgs', 'SecretAclProviderConfigArgsDict']]] = None,
                 scope: 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__ = SecretAclArgs.__new__(SecretAclArgs)

            if permission is None and not opts.urn:
                raise TypeError("Missing required property 'permission'")
            __props__.__dict__["permission"] = permission
            if principal is None and not opts.urn:
                raise TypeError("Missing required property 'principal'")
            __props__.__dict__["principal"] = principal
            __props__.__dict__["provider_config"] = provider_config
            if scope is None and not opts.urn:
                raise TypeError("Missing required property 'scope'")
            __props__.__dict__["scope"] = scope
        super(SecretAcl, __self__).__init__(
            'databricks:index/secretAcl:SecretAcl',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            permission: Optional[pulumi.Input[_builtins.str]] = None,
            principal: Optional[pulumi.Input[_builtins.str]] = None,
            provider_config: Optional[pulumi.Input[Union['SecretAclProviderConfigArgs', 'SecretAclProviderConfigArgsDict']]] = None,
            scope: Optional[pulumi.Input[_builtins.str]] = None) -> 'SecretAcl':
        """
        Get an existing SecretAcl 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] permission: `READ`, `WRITE` or `MANAGE`.
        :param pulumi.Input[_builtins.str] principal: principal's identifier. It can be:
        :param pulumi.Input[Union['SecretAclProviderConfigArgs', 'SecretAclProviderConfigArgsDict']] provider_config: Configure the provider for management through account provider. This block consists of the following fields:
        :param pulumi.Input[_builtins.str] scope: name of the scope
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _SecretAclState.__new__(_SecretAclState)

        __props__.__dict__["permission"] = permission
        __props__.__dict__["principal"] = principal
        __props__.__dict__["provider_config"] = provider_config
        __props__.__dict__["scope"] = scope
        return SecretAcl(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter
    def permission(self) -> pulumi.Output[_builtins.str]:
        """
        `READ`, `WRITE` or `MANAGE`.
        """
        return pulumi.get(self, "permission")

    @_builtins.property
    @pulumi.getter
    def principal(self) -> pulumi.Output[_builtins.str]:
        """
        principal's identifier. It can be:
        """
        return pulumi.get(self, "principal")

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> pulumi.Output[Optional['outputs.SecretAclProviderConfig']]:
        """
        Configure the provider for management through account provider. This block consists of the following fields:
        """
        return pulumi.get(self, "provider_config")

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

