# 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__ = ['HAResourceArgs', 'HAResource']

@pulumi.input_type
class HAResourceArgs:
    def __init__(__self__, *,
                 resource_id: pulumi.Input[str],
                 comment: Optional[pulumi.Input[str]] = None,
                 group: Optional[pulumi.Input[str]] = None,
                 max_relocate: Optional[pulumi.Input[int]] = None,
                 max_restart: Optional[pulumi.Input[int]] = None,
                 state: Optional[pulumi.Input[str]] = None,
                 type: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a HAResource resource.
        :param pulumi.Input[str] resource_id: The Proxmox HA resource identifier
        :param pulumi.Input[str] comment: The comment associated with this resource.
        :param pulumi.Input[str] group: The identifier of the High Availability group this resource is a member of.
        :param pulumi.Input[int] max_relocate: The maximal number of relocation attempts.
        :param pulumi.Input[int] max_restart: The maximal number of restart attempts.
        :param pulumi.Input[str] state: The desired state of the resource.
        :param pulumi.Input[str] type: The type of HA resources to create. If unset, it will be deduced from the `resource_id`.
        """
        pulumi.set(__self__, "resource_id", resource_id)
        if comment is not None:
            pulumi.set(__self__, "comment", comment)
        if group is not None:
            pulumi.set(__self__, "group", group)
        if max_relocate is not None:
            pulumi.set(__self__, "max_relocate", max_relocate)
        if max_restart is not None:
            pulumi.set(__self__, "max_restart", max_restart)
        if state is not None:
            pulumi.set(__self__, "state", state)
        if type is not None:
            pulumi.set(__self__, "type", type)

    @property
    @pulumi.getter(name="resourceId")
    def resource_id(self) -> pulumi.Input[str]:
        """
        The Proxmox HA resource identifier
        """
        return pulumi.get(self, "resource_id")

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

    @property
    @pulumi.getter
    def comment(self) -> Optional[pulumi.Input[str]]:
        """
        The comment associated with this resource.
        """
        return pulumi.get(self, "comment")

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

    @property
    @pulumi.getter
    def group(self) -> Optional[pulumi.Input[str]]:
        """
        The identifier of the High Availability group this resource is a member of.
        """
        return pulumi.get(self, "group")

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

    @property
    @pulumi.getter(name="maxRelocate")
    def max_relocate(self) -> Optional[pulumi.Input[int]]:
        """
        The maximal number of relocation attempts.
        """
        return pulumi.get(self, "max_relocate")

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

    @property
    @pulumi.getter(name="maxRestart")
    def max_restart(self) -> Optional[pulumi.Input[int]]:
        """
        The maximal number of restart attempts.
        """
        return pulumi.get(self, "max_restart")

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

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

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

    @property
    @pulumi.getter
    def type(self) -> Optional[pulumi.Input[str]]:
        """
        The type of HA resources to create. If unset, it will be deduced from the `resource_id`.
        """
        return pulumi.get(self, "type")

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


@pulumi.input_type
class _HAResourceState:
    def __init__(__self__, *,
                 comment: Optional[pulumi.Input[str]] = None,
                 group: Optional[pulumi.Input[str]] = None,
                 max_relocate: Optional[pulumi.Input[int]] = None,
                 max_restart: Optional[pulumi.Input[int]] = None,
                 resource_id: Optional[pulumi.Input[str]] = None,
                 state: Optional[pulumi.Input[str]] = None,
                 type: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering HAResource resources.
        :param pulumi.Input[str] comment: The comment associated with this resource.
        :param pulumi.Input[str] group: The identifier of the High Availability group this resource is a member of.
        :param pulumi.Input[int] max_relocate: The maximal number of relocation attempts.
        :param pulumi.Input[int] max_restart: The maximal number of restart attempts.
        :param pulumi.Input[str] resource_id: The Proxmox HA resource identifier
        :param pulumi.Input[str] state: The desired state of the resource.
        :param pulumi.Input[str] type: The type of HA resources to create. If unset, it will be deduced from the `resource_id`.
        """
        if comment is not None:
            pulumi.set(__self__, "comment", comment)
        if group is not None:
            pulumi.set(__self__, "group", group)
        if max_relocate is not None:
            pulumi.set(__self__, "max_relocate", max_relocate)
        if max_restart is not None:
            pulumi.set(__self__, "max_restart", max_restart)
        if resource_id is not None:
            pulumi.set(__self__, "resource_id", resource_id)
        if state is not None:
            pulumi.set(__self__, "state", state)
        if type is not None:
            pulumi.set(__self__, "type", type)

    @property
    @pulumi.getter
    def comment(self) -> Optional[pulumi.Input[str]]:
        """
        The comment associated with this resource.
        """
        return pulumi.get(self, "comment")

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

    @property
    @pulumi.getter
    def group(self) -> Optional[pulumi.Input[str]]:
        """
        The identifier of the High Availability group this resource is a member of.
        """
        return pulumi.get(self, "group")

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

    @property
    @pulumi.getter(name="maxRelocate")
    def max_relocate(self) -> Optional[pulumi.Input[int]]:
        """
        The maximal number of relocation attempts.
        """
        return pulumi.get(self, "max_relocate")

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

    @property
    @pulumi.getter(name="maxRestart")
    def max_restart(self) -> Optional[pulumi.Input[int]]:
        """
        The maximal number of restart attempts.
        """
        return pulumi.get(self, "max_restart")

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

    @property
    @pulumi.getter(name="resourceId")
    def resource_id(self) -> Optional[pulumi.Input[str]]:
        """
        The Proxmox HA resource identifier
        """
        return pulumi.get(self, "resource_id")

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

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

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

    @property
    @pulumi.getter
    def type(self) -> Optional[pulumi.Input[str]]:
        """
        The type of HA resources to create. If unset, it will be deduced from the `resource_id`.
        """
        return pulumi.get(self, "type")

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


class HAResource(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 comment: Optional[pulumi.Input[str]] = None,
                 group: Optional[pulumi.Input[str]] = None,
                 max_relocate: Optional[pulumi.Input[int]] = None,
                 max_restart: Optional[pulumi.Input[int]] = None,
                 resource_id: Optional[pulumi.Input[str]] = None,
                 state: Optional[pulumi.Input[str]] = None,
                 type: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Manages Proxmox HA resources.

        ## Example Usage

        <!--Start PulumiCodeChooser -->
        ```python
        import pulumi
        import pulumi_proxmoxve as proxmoxve

        example = proxmoxve.ha.HAResource("example",
            resource_id="vm:123",
            state="started",
            group="example",
            comment="Managed by Terraform",
            opts=pulumi.ResourceOptions(depends_on=[proxmox_virtual_environment_hagroup["example"]]))
        ```
        <!--End PulumiCodeChooser -->

        ## Import

        #!/usr/bin/env sh

        HA resources can be imported using their identifiers, e.g.:

        ```sh
        $ pulumi import proxmoxve:HA/hAResource:HAResource example vm:123
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] comment: The comment associated with this resource.
        :param pulumi.Input[str] group: The identifier of the High Availability group this resource is a member of.
        :param pulumi.Input[int] max_relocate: The maximal number of relocation attempts.
        :param pulumi.Input[int] max_restart: The maximal number of restart attempts.
        :param pulumi.Input[str] resource_id: The Proxmox HA resource identifier
        :param pulumi.Input[str] state: The desired state of the resource.
        :param pulumi.Input[str] type: The type of HA resources to create. If unset, it will be deduced from the `resource_id`.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: HAResourceArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages Proxmox HA resources.

        ## Example Usage

        <!--Start PulumiCodeChooser -->
        ```python
        import pulumi
        import pulumi_proxmoxve as proxmoxve

        example = proxmoxve.ha.HAResource("example",
            resource_id="vm:123",
            state="started",
            group="example",
            comment="Managed by Terraform",
            opts=pulumi.ResourceOptions(depends_on=[proxmox_virtual_environment_hagroup["example"]]))
        ```
        <!--End PulumiCodeChooser -->

        ## Import

        #!/usr/bin/env sh

        HA resources can be imported using their identifiers, e.g.:

        ```sh
        $ pulumi import proxmoxve:HA/hAResource:HAResource example vm:123
        ```

        :param str resource_name: The name of the resource.
        :param HAResourceArgs 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(HAResourceArgs, 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,
                 comment: Optional[pulumi.Input[str]] = None,
                 group: Optional[pulumi.Input[str]] = None,
                 max_relocate: Optional[pulumi.Input[int]] = None,
                 max_restart: Optional[pulumi.Input[int]] = None,
                 resource_id: Optional[pulumi.Input[str]] = None,
                 state: Optional[pulumi.Input[str]] = None,
                 type: 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__ = HAResourceArgs.__new__(HAResourceArgs)

            __props__.__dict__["comment"] = comment
            __props__.__dict__["group"] = group
            __props__.__dict__["max_relocate"] = max_relocate
            __props__.__dict__["max_restart"] = max_restart
            if resource_id is None and not opts.urn:
                raise TypeError("Missing required property 'resource_id'")
            __props__.__dict__["resource_id"] = resource_id
            __props__.__dict__["state"] = state
            __props__.__dict__["type"] = type
        super(HAResource, __self__).__init__(
            'proxmoxve:HA/hAResource:HAResource',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            comment: Optional[pulumi.Input[str]] = None,
            group: Optional[pulumi.Input[str]] = None,
            max_relocate: Optional[pulumi.Input[int]] = None,
            max_restart: Optional[pulumi.Input[int]] = None,
            resource_id: Optional[pulumi.Input[str]] = None,
            state: Optional[pulumi.Input[str]] = None,
            type: Optional[pulumi.Input[str]] = None) -> 'HAResource':
        """
        Get an existing HAResource 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] comment: The comment associated with this resource.
        :param pulumi.Input[str] group: The identifier of the High Availability group this resource is a member of.
        :param pulumi.Input[int] max_relocate: The maximal number of relocation attempts.
        :param pulumi.Input[int] max_restart: The maximal number of restart attempts.
        :param pulumi.Input[str] resource_id: The Proxmox HA resource identifier
        :param pulumi.Input[str] state: The desired state of the resource.
        :param pulumi.Input[str] type: The type of HA resources to create. If unset, it will be deduced from the `resource_id`.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _HAResourceState.__new__(_HAResourceState)

        __props__.__dict__["comment"] = comment
        __props__.__dict__["group"] = group
        __props__.__dict__["max_relocate"] = max_relocate
        __props__.__dict__["max_restart"] = max_restart
        __props__.__dict__["resource_id"] = resource_id
        __props__.__dict__["state"] = state
        __props__.__dict__["type"] = type
        return HAResource(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def comment(self) -> pulumi.Output[Optional[str]]:
        """
        The comment associated with this resource.
        """
        return pulumi.get(self, "comment")

    @property
    @pulumi.getter
    def group(self) -> pulumi.Output[Optional[str]]:
        """
        The identifier of the High Availability group this resource is a member of.
        """
        return pulumi.get(self, "group")

    @property
    @pulumi.getter(name="maxRelocate")
    def max_relocate(self) -> pulumi.Output[Optional[int]]:
        """
        The maximal number of relocation attempts.
        """
        return pulumi.get(self, "max_relocate")

    @property
    @pulumi.getter(name="maxRestart")
    def max_restart(self) -> pulumi.Output[Optional[int]]:
        """
        The maximal number of restart attempts.
        """
        return pulumi.get(self, "max_restart")

    @property
    @pulumi.getter(name="resourceId")
    def resource_id(self) -> pulumi.Output[str]:
        """
        The Proxmox HA resource identifier
        """
        return pulumi.get(self, "resource_id")

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

    @property
    @pulumi.getter
    def type(self) -> pulumi.Output[str]:
        """
        The type of HA resources to create. If unset, it will be deduced from the `resource_id`.
        """
        return pulumi.get(self, "type")

