# 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 pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities

__all__ = ['SecretAclArgs', 'SecretAcl']

@pulumi.input_type
class SecretAclArgs:
    def __init__(__self__, *,
                 permission: pulumi.Input[str],
                 principal: pulumi.Input[str],
                 scope: pulumi.Input[str]):
        """
        The set of arguments for constructing a SecretAcl resource.
        :param pulumi.Input[str] permission: `READ`, `WRITE` or `MANAGE`.
        :param pulumi.Input[str] principal: name of the principals. It can be `users` for all users or name or `display_name` of databricks_group
        :param pulumi.Input[str] scope: name of the scope
        """
        pulumi.set(__self__, "permission", permission)
        pulumi.set(__self__, "principal", principal)
        pulumi.set(__self__, "scope", scope)

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

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

    @property
    @pulumi.getter
    def principal(self) -> pulumi.Input[str]:
        """
        name of the principals. It can be `users` for all users or name or `display_name` of databricks_group
        """
        return pulumi.get(self, "principal")

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

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

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


@pulumi.input_type
class _SecretAclState:
    def __init__(__self__, *,
                 permission: Optional[pulumi.Input[str]] = None,
                 principal: Optional[pulumi.Input[str]] = None,
                 scope: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering SecretAcl resources.
        :param pulumi.Input[str] permission: `READ`, `WRITE` or `MANAGE`.
        :param pulumi.Input[str] principal: name of the principals. It can be `users` for all users or name or `display_name` of databricks_group
        :param pulumi.Input[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 scope is not None:
            pulumi.set(__self__, "scope", scope)

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

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

    @property
    @pulumi.getter
    def principal(self) -> Optional[pulumi.Input[str]]:
        """
        name of the principals. It can be `users` for all users or name or `display_name` of databricks_group
        """
        return pulumi.get(self, "principal")

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

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

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


class SecretAcl(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 permission: Optional[pulumi.Input[str]] = None,
                 principal: Optional[pulumi.Input[str]] = None,
                 scope: Optional[pulumi.Input[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.

        ## Example Usage

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

        ```python
        import pulumi
        import pulumi_databricks as databricks

        ds = databricks.Group("ds")
        app = databricks.SecretScope("app")
        my_secret_acl = databricks.SecretAcl("mySecretAcl",
            principal=ds.display_name,
            permission="READ",
            scope=app.name)
        publishing_api = databricks.Secret("publishingApi",
            key="publishing_api",
            string_value=data["azurerm_key_vault_secret"]["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.

        ## Import

        The resource secret acl can be imported using `scopeName|||principalName` combination. bash

        ```sh
         $ pulumi import databricks:index/secretAcl:SecretAcl object `scopeName|||principalName`
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] permission: `READ`, `WRITE` or `MANAGE`.
        :param pulumi.Input[str] principal: name of the principals. It can be `users` for all users or name or `display_name` of databricks_group
        :param pulumi.Input[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.

        ## Example Usage

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

        ```python
        import pulumi
        import pulumi_databricks as databricks

        ds = databricks.Group("ds")
        app = databricks.SecretScope("app")
        my_secret_acl = databricks.SecretAcl("mySecretAcl",
            principal=ds.display_name,
            permission="READ",
            scope=app.name)
        publishing_api = databricks.Secret("publishingApi",
            key="publishing_api",
            string_value=data["azurerm_key_vault_secret"]["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.

        ## Import

        The resource secret acl can be imported using `scopeName|||principalName` combination. bash

        ```sh
         $ pulumi import databricks:index/secretAcl:SecretAcl object `scopeName|||principalName`
        ```

        :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[str]] = None,
                 principal: Optional[pulumi.Input[str]] = None,
                 scope: 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__ = 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
            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[str]] = None,
            principal: Optional[pulumi.Input[str]] = None,
            scope: Optional[pulumi.Input[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[str] permission: `READ`, `WRITE` or `MANAGE`.
        :param pulumi.Input[str] principal: name of the principals. It can be `users` for all users or name or `display_name` of databricks_group
        :param pulumi.Input[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__["scope"] = scope
        return SecretAcl(resource_name, opts=opts, __props__=__props__)

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

    @property
    @pulumi.getter
    def principal(self) -> pulumi.Output[str]:
        """
        name of the principals. It can be `users` for all users or name or `display_name` of databricks_group
        """
        return pulumi.get(self, "principal")

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

