# 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__ = ['AclArgs', 'Acl']

@pulumi.input_type
class AclArgs:
    def __init__(__self__, *,
                 path: pulumi.Input[str],
                 role_id: pulumi.Input[str],
                 group_id: Optional[pulumi.Input[str]] = None,
                 propagate: Optional[pulumi.Input[bool]] = None,
                 token_id: Optional[pulumi.Input[str]] = None,
                 user_id: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a Acl resource.
        :param pulumi.Input[str] path: Access control path
        :param pulumi.Input[str] role_id: The role to apply
        :param pulumi.Input[str] group_id: The group the ACL should apply to (mutually exclusive with `token_id` and `user_id`)
        :param pulumi.Input[bool] propagate: Allow to propagate (inherit) permissions.
        :param pulumi.Input[str] token_id: The token the ACL should apply to (mutually exclusive with `group_id` and `user_id`)
        :param pulumi.Input[str] user_id: The user the ACL should apply to (mutually exclusive with `group_id` and `token_id`)
        """
        pulumi.set(__self__, "path", path)
        pulumi.set(__self__, "role_id", role_id)
        if group_id is not None:
            pulumi.set(__self__, "group_id", group_id)
        if propagate is not None:
            pulumi.set(__self__, "propagate", propagate)
        if token_id is not None:
            pulumi.set(__self__, "token_id", token_id)
        if user_id is not None:
            pulumi.set(__self__, "user_id", user_id)

    @property
    @pulumi.getter
    def path(self) -> pulumi.Input[str]:
        """
        Access control path
        """
        return pulumi.get(self, "path")

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

    @property
    @pulumi.getter(name="roleId")
    def role_id(self) -> pulumi.Input[str]:
        """
        The role to apply
        """
        return pulumi.get(self, "role_id")

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

    @property
    @pulumi.getter(name="groupId")
    def group_id(self) -> Optional[pulumi.Input[str]]:
        """
        The group the ACL should apply to (mutually exclusive with `token_id` and `user_id`)
        """
        return pulumi.get(self, "group_id")

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

    @property
    @pulumi.getter
    def propagate(self) -> Optional[pulumi.Input[bool]]:
        """
        Allow to propagate (inherit) permissions.
        """
        return pulumi.get(self, "propagate")

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

    @property
    @pulumi.getter(name="tokenId")
    def token_id(self) -> Optional[pulumi.Input[str]]:
        """
        The token the ACL should apply to (mutually exclusive with `group_id` and `user_id`)
        """
        return pulumi.get(self, "token_id")

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

    @property
    @pulumi.getter(name="userId")
    def user_id(self) -> Optional[pulumi.Input[str]]:
        """
        The user the ACL should apply to (mutually exclusive with `group_id` and `token_id`)
        """
        return pulumi.get(self, "user_id")

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


@pulumi.input_type
class _AclState:
    def __init__(__self__, *,
                 group_id: Optional[pulumi.Input[str]] = None,
                 path: Optional[pulumi.Input[str]] = None,
                 propagate: Optional[pulumi.Input[bool]] = None,
                 role_id: Optional[pulumi.Input[str]] = None,
                 token_id: Optional[pulumi.Input[str]] = None,
                 user_id: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering Acl resources.
        :param pulumi.Input[str] group_id: The group the ACL should apply to (mutually exclusive with `token_id` and `user_id`)
        :param pulumi.Input[str] path: Access control path
        :param pulumi.Input[bool] propagate: Allow to propagate (inherit) permissions.
        :param pulumi.Input[str] role_id: The role to apply
        :param pulumi.Input[str] token_id: The token the ACL should apply to (mutually exclusive with `group_id` and `user_id`)
        :param pulumi.Input[str] user_id: The user the ACL should apply to (mutually exclusive with `group_id` and `token_id`)
        """
        if group_id is not None:
            pulumi.set(__self__, "group_id", group_id)
        if path is not None:
            pulumi.set(__self__, "path", path)
        if propagate is not None:
            pulumi.set(__self__, "propagate", propagate)
        if role_id is not None:
            pulumi.set(__self__, "role_id", role_id)
        if token_id is not None:
            pulumi.set(__self__, "token_id", token_id)
        if user_id is not None:
            pulumi.set(__self__, "user_id", user_id)

    @property
    @pulumi.getter(name="groupId")
    def group_id(self) -> Optional[pulumi.Input[str]]:
        """
        The group the ACL should apply to (mutually exclusive with `token_id` and `user_id`)
        """
        return pulumi.get(self, "group_id")

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

    @property
    @pulumi.getter
    def path(self) -> Optional[pulumi.Input[str]]:
        """
        Access control path
        """
        return pulumi.get(self, "path")

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

    @property
    @pulumi.getter
    def propagate(self) -> Optional[pulumi.Input[bool]]:
        """
        Allow to propagate (inherit) permissions.
        """
        return pulumi.get(self, "propagate")

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

    @property
    @pulumi.getter(name="roleId")
    def role_id(self) -> Optional[pulumi.Input[str]]:
        """
        The role to apply
        """
        return pulumi.get(self, "role_id")

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

    @property
    @pulumi.getter(name="tokenId")
    def token_id(self) -> Optional[pulumi.Input[str]]:
        """
        The token the ACL should apply to (mutually exclusive with `group_id` and `user_id`)
        """
        return pulumi.get(self, "token_id")

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

    @property
    @pulumi.getter(name="userId")
    def user_id(self) -> Optional[pulumi.Input[str]]:
        """
        The user the ACL should apply to (mutually exclusive with `group_id` and `token_id`)
        """
        return pulumi.get(self, "user_id")

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


class Acl(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 group_id: Optional[pulumi.Input[str]] = None,
                 path: Optional[pulumi.Input[str]] = None,
                 propagate: Optional[pulumi.Input[bool]] = None,
                 role_id: Optional[pulumi.Input[str]] = None,
                 token_id: Optional[pulumi.Input[str]] = None,
                 user_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Manages ACLs on the Proxmox cluster.

        ACLs are used to control access to resources in the Proxmox cluster.
        Each ACL consists of a path, a user, group or token, a role, and a flag to allow propagation of permissions.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_proxmoxve as proxmoxve

        operations_automation = proxmoxve.permission.User("operationsAutomation",
            comment="Managed by Terraform",
            password="a-strong-password",
            user_id="operations-automation@pve")
        operations_monitoring = proxmoxve.permission.Role("operationsMonitoring",
            role_id="operations-monitoring",
            privileges=["VM.Monitor"])
        operations_automation_monitoring = proxmoxve.Acl("operationsAutomationMonitoring",
            user_id=operations_automation.user_id,
            role_id=operations_monitoring.role_id,
            path="/vms/1234",
            propagate=True)
        ```

        ## Import

        #!/usr/bin/env sh

        ACL can be imported using its unique identifier, e.g.: {path}?{group|user@realm|user@realm!token}?{role}

        ```sh
        $ pulumi import proxmoxve:index/acl:Acl operations_automation_monitoring /?monitor@pve?operations-monitoring
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] group_id: The group the ACL should apply to (mutually exclusive with `token_id` and `user_id`)
        :param pulumi.Input[str] path: Access control path
        :param pulumi.Input[bool] propagate: Allow to propagate (inherit) permissions.
        :param pulumi.Input[str] role_id: The role to apply
        :param pulumi.Input[str] token_id: The token the ACL should apply to (mutually exclusive with `group_id` and `user_id`)
        :param pulumi.Input[str] user_id: The user the ACL should apply to (mutually exclusive with `group_id` and `token_id`)
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: AclArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages ACLs on the Proxmox cluster.

        ACLs are used to control access to resources in the Proxmox cluster.
        Each ACL consists of a path, a user, group or token, a role, and a flag to allow propagation of permissions.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_proxmoxve as proxmoxve

        operations_automation = proxmoxve.permission.User("operationsAutomation",
            comment="Managed by Terraform",
            password="a-strong-password",
            user_id="operations-automation@pve")
        operations_monitoring = proxmoxve.permission.Role("operationsMonitoring",
            role_id="operations-monitoring",
            privileges=["VM.Monitor"])
        operations_automation_monitoring = proxmoxve.Acl("operationsAutomationMonitoring",
            user_id=operations_automation.user_id,
            role_id=operations_monitoring.role_id,
            path="/vms/1234",
            propagate=True)
        ```

        ## Import

        #!/usr/bin/env sh

        ACL can be imported using its unique identifier, e.g.: {path}?{group|user@realm|user@realm!token}?{role}

        ```sh
        $ pulumi import proxmoxve:index/acl:Acl operations_automation_monitoring /?monitor@pve?operations-monitoring
        ```

        :param str resource_name: The name of the resource.
        :param AclArgs 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(AclArgs, 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,
                 group_id: Optional[pulumi.Input[str]] = None,
                 path: Optional[pulumi.Input[str]] = None,
                 propagate: Optional[pulumi.Input[bool]] = None,
                 role_id: Optional[pulumi.Input[str]] = None,
                 token_id: Optional[pulumi.Input[str]] = None,
                 user_id: 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__ = AclArgs.__new__(AclArgs)

            __props__.__dict__["group_id"] = group_id
            if path is None and not opts.urn:
                raise TypeError("Missing required property 'path'")
            __props__.__dict__["path"] = path
            __props__.__dict__["propagate"] = propagate
            if role_id is None and not opts.urn:
                raise TypeError("Missing required property 'role_id'")
            __props__.__dict__["role_id"] = role_id
            __props__.__dict__["token_id"] = token_id
            __props__.__dict__["user_id"] = user_id
        super(Acl, __self__).__init__(
            'proxmoxve:index/acl:Acl',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            group_id: Optional[pulumi.Input[str]] = None,
            path: Optional[pulumi.Input[str]] = None,
            propagate: Optional[pulumi.Input[bool]] = None,
            role_id: Optional[pulumi.Input[str]] = None,
            token_id: Optional[pulumi.Input[str]] = None,
            user_id: Optional[pulumi.Input[str]] = None) -> 'Acl':
        """
        Get an existing Acl 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] group_id: The group the ACL should apply to (mutually exclusive with `token_id` and `user_id`)
        :param pulumi.Input[str] path: Access control path
        :param pulumi.Input[bool] propagate: Allow to propagate (inherit) permissions.
        :param pulumi.Input[str] role_id: The role to apply
        :param pulumi.Input[str] token_id: The token the ACL should apply to (mutually exclusive with `group_id` and `user_id`)
        :param pulumi.Input[str] user_id: The user the ACL should apply to (mutually exclusive with `group_id` and `token_id`)
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _AclState.__new__(_AclState)

        __props__.__dict__["group_id"] = group_id
        __props__.__dict__["path"] = path
        __props__.__dict__["propagate"] = propagate
        __props__.__dict__["role_id"] = role_id
        __props__.__dict__["token_id"] = token_id
        __props__.__dict__["user_id"] = user_id
        return Acl(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="groupId")
    def group_id(self) -> pulumi.Output[Optional[str]]:
        """
        The group the ACL should apply to (mutually exclusive with `token_id` and `user_id`)
        """
        return pulumi.get(self, "group_id")

    @property
    @pulumi.getter
    def path(self) -> pulumi.Output[str]:
        """
        Access control path
        """
        return pulumi.get(self, "path")

    @property
    @pulumi.getter
    def propagate(self) -> pulumi.Output[bool]:
        """
        Allow to propagate (inherit) permissions.
        """
        return pulumi.get(self, "propagate")

    @property
    @pulumi.getter(name="roleId")
    def role_id(self) -> pulumi.Output[str]:
        """
        The role to apply
        """
        return pulumi.get(self, "role_id")

    @property
    @pulumi.getter(name="tokenId")
    def token_id(self) -> pulumi.Output[Optional[str]]:
        """
        The token the ACL should apply to (mutually exclusive with `group_id` and `user_id`)
        """
        return pulumi.get(self, "token_id")

    @property
    @pulumi.getter(name="userId")
    def user_id(self) -> pulumi.Output[Optional[str]]:
        """
        The user the ACL should apply to (mutually exclusive with `group_id` and `token_id`)
        """
        return pulumi.get(self, "user_id")

