# 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 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__ = ['ResourceSetArgs', 'ResourceSet']

@pulumi.input_type
class ResourceSetArgs:
    def __init__(__self__, *,
                 limits: pulumi.Input[Sequence[pulumi.Input['ResourceSetLimitArgs']]],
                 name: Optional[pulumi.Input[str]] = None,
                 objects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 subjects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
        """
        The set of arguments for constructing a ResourceSet resource.
        :param pulumi.Input[Sequence[pulumi.Input['ResourceSetLimitArgs']]] limits: The limit applied to the resource set.
        :param pulumi.Input[str] name: The name of the resource set.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] objects: The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] subjects: The uuids of the user accounts that should have access to the resource set.
        """
        pulumi.set(__self__, "limits", limits)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if objects is not None:
            pulumi.set(__self__, "objects", objects)
        if subjects is not None:
            pulumi.set(__self__, "subjects", subjects)

    @property
    @pulumi.getter
    def limits(self) -> pulumi.Input[Sequence[pulumi.Input['ResourceSetLimitArgs']]]:
        """
        The limit applied to the resource set.
        """
        return pulumi.get(self, "limits")

    @limits.setter
    def limits(self, value: pulumi.Input[Sequence[pulumi.Input['ResourceSetLimitArgs']]]):
        pulumi.set(self, "limits", value)

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

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

    @property
    @pulumi.getter
    def objects(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        """
        The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
        """
        return pulumi.get(self, "objects")

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

    @property
    @pulumi.getter
    def subjects(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        """
        The uuids of the user accounts that should have access to the resource set.
        """
        return pulumi.get(self, "subjects")

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


@pulumi.input_type
class _ResourceSetState:
    def __init__(__self__, *,
                 limits: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceSetLimitArgs']]]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 objects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 subjects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
        """
        Input properties used for looking up and filtering ResourceSet resources.
        :param pulumi.Input[Sequence[pulumi.Input['ResourceSetLimitArgs']]] limits: The limit applied to the resource set.
        :param pulumi.Input[str] name: The name of the resource set.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] objects: The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] subjects: The uuids of the user accounts that should have access to the resource set.
        """
        if limits is not None:
            pulumi.set(__self__, "limits", limits)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if objects is not None:
            pulumi.set(__self__, "objects", objects)
        if subjects is not None:
            pulumi.set(__self__, "subjects", subjects)

    @property
    @pulumi.getter
    def limits(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceSetLimitArgs']]]]:
        """
        The limit applied to the resource set.
        """
        return pulumi.get(self, "limits")

    @limits.setter
    def limits(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ResourceSetLimitArgs']]]]):
        pulumi.set(self, "limits", value)

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

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

    @property
    @pulumi.getter
    def objects(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        """
        The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
        """
        return pulumi.get(self, "objects")

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

    @property
    @pulumi.getter
    def subjects(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
        """
        The uuids of the user accounts that should have access to the resource set.
        """
        return pulumi.get(self, "subjects")

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


class ResourceSet(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 limits: Optional[pulumi.Input[Sequence[pulumi.Input[Union['ResourceSetLimitArgs', 'ResourceSetLimitArgsDict']]]]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 objects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 subjects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 __props__=None):
        """
        Creates a Xen Orchestra resource set.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_xenorchestra as xenorchestra

        template = xenorchestra.get_xoa_template(name_label="Ubuntu Bionic Beaver 18.04")
        sr = xenorchestra.get_xoa_storage_repository(name_label="Your storage repository label")
        eth0 = xenorchestra.get_xoa_pif(device="eth0",
            vlan=-1)
        user = xenorchestra.get_xoa_user(username="test_user")
        rs = xenorchestra.ResourceSet("rs",
            name="new-resource-set",
            subjects=[user.id],
            objects=[
                template.id,
                sr.id,
                eth0.network,
            ],
            limits=[
                {
                    "type": "cpus",
                    "quantity": 20,
                },
                {
                    "type": "disk",
                    "quantity": 107374182400,
                },
                {
                    "type": "memory",
                    "quantity": 12884901888,
                },
            ])
        ```

        ## Import

        ID can be found from the following command:

        $ xo-cli resourceSet.getAll

        ```sh
        $ pulumi import xenorchestra:index/resourceSet:ResourceSet rs MGSpuwnbtUE
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Sequence[pulumi.Input[Union['ResourceSetLimitArgs', 'ResourceSetLimitArgsDict']]]] limits: The limit applied to the resource set.
        :param pulumi.Input[str] name: The name of the resource set.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] objects: The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] subjects: The uuids of the user accounts that should have access to the resource set.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ResourceSetArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Creates a Xen Orchestra resource set.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_xenorchestra as xenorchestra

        template = xenorchestra.get_xoa_template(name_label="Ubuntu Bionic Beaver 18.04")
        sr = xenorchestra.get_xoa_storage_repository(name_label="Your storage repository label")
        eth0 = xenorchestra.get_xoa_pif(device="eth0",
            vlan=-1)
        user = xenorchestra.get_xoa_user(username="test_user")
        rs = xenorchestra.ResourceSet("rs",
            name="new-resource-set",
            subjects=[user.id],
            objects=[
                template.id,
                sr.id,
                eth0.network,
            ],
            limits=[
                {
                    "type": "cpus",
                    "quantity": 20,
                },
                {
                    "type": "disk",
                    "quantity": 107374182400,
                },
                {
                    "type": "memory",
                    "quantity": 12884901888,
                },
            ])
        ```

        ## Import

        ID can be found from the following command:

        $ xo-cli resourceSet.getAll

        ```sh
        $ pulumi import xenorchestra:index/resourceSet:ResourceSet rs MGSpuwnbtUE
        ```

        :param str resource_name: The name of the resource.
        :param ResourceSetArgs 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(ResourceSetArgs, 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,
                 limits: Optional[pulumi.Input[Sequence[pulumi.Input[Union['ResourceSetLimitArgs', 'ResourceSetLimitArgsDict']]]]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 objects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 subjects: Optional[pulumi.Input[Sequence[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__ = ResourceSetArgs.__new__(ResourceSetArgs)

            if limits is None and not opts.urn:
                raise TypeError("Missing required property 'limits'")
            __props__.__dict__["limits"] = limits
            __props__.__dict__["name"] = name
            __props__.__dict__["objects"] = objects
            __props__.__dict__["subjects"] = subjects
        super(ResourceSet, __self__).__init__(
            'xenorchestra:index/resourceSet:ResourceSet',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            limits: Optional[pulumi.Input[Sequence[pulumi.Input[Union['ResourceSetLimitArgs', 'ResourceSetLimitArgsDict']]]]] = None,
            name: Optional[pulumi.Input[str]] = None,
            objects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
            subjects: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None) -> 'ResourceSet':
        """
        Get an existing ResourceSet 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[Sequence[pulumi.Input[Union['ResourceSetLimitArgs', 'ResourceSetLimitArgsDict']]]] limits: The limit applied to the resource set.
        :param pulumi.Input[str] name: The name of the resource set.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] objects: The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] subjects: The uuids of the user accounts that should have access to the resource set.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ResourceSetState.__new__(_ResourceSetState)

        __props__.__dict__["limits"] = limits
        __props__.__dict__["name"] = name
        __props__.__dict__["objects"] = objects
        __props__.__dict__["subjects"] = subjects
        return ResourceSet(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def limits(self) -> pulumi.Output[Sequence['outputs.ResourceSetLimit']]:
        """
        The limit applied to the resource set.
        """
        return pulumi.get(self, "limits")

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

    @property
    @pulumi.getter
    def objects(self) -> pulumi.Output[Optional[Sequence[str]]]:
        """
        The uuids of the objects that are within scope of the resource set. A minimum of a storage repository, network and VM template are required for users to launch VMs.
        """
        return pulumi.get(self, "objects")

    @property
    @pulumi.getter
    def subjects(self) -> pulumi.Output[Optional[Sequence[str]]]:
        """
        The uuids of the user accounts that should have access to the resource set.
        """
        return pulumi.get(self, "subjects")

