# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from . import outputs
from ._inputs import *

__all__ = ['Elastigroup']


class Elastigroup(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 backend_services: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupBackendServiceArgs']]]]] = None,
                 cluster_id: Optional[pulumi.Input[str]] = None,
                 cluster_zone_name: Optional[pulumi.Input[str]] = None,
                 desired_capacity: Optional[pulumi.Input[int]] = None,
                 disks: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupDiskArgs']]]]] = None,
                 draining_timeout: Optional[pulumi.Input[int]] = None,
                 fallback_to_ondemand: Optional[pulumi.Input[bool]] = None,
                 gpu: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupGpuArgs']]]]] = None,
                 instance_types_customs: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupInstanceTypesCustomArgs']]]]] = None,
                 instance_types_ondemand: Optional[pulumi.Input[str]] = None,
                 instance_types_preemptibles: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 integration_docker_swarm: Optional[pulumi.Input[pulumi.InputType['ElastigroupIntegrationDockerSwarmArgs']]] = None,
                 integration_gke: Optional[pulumi.Input[pulumi.InputType['ElastigroupIntegrationGkeArgs']]] = None,
                 ip_forwarding: Optional[pulumi.Input[bool]] = None,
                 labels: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupLabelArgs']]]]] = None,
                 max_size: Optional[pulumi.Input[int]] = None,
                 metadatas: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupMetadataArgs']]]]] = None,
                 min_size: Optional[pulumi.Input[int]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 network_interfaces: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupNetworkInterfaceArgs']]]]] = None,
                 node_image: Optional[pulumi.Input[str]] = None,
                 ondemand_count: Optional[pulumi.Input[int]] = None,
                 preemptible_percentage: Optional[pulumi.Input[int]] = None,
                 scaling_down_policies: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupScalingDownPolicyArgs']]]]] = None,
                 scaling_up_policies: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupScalingUpPolicyArgs']]]]] = None,
                 service_account: Optional[pulumi.Input[str]] = None,
                 shutdown_script: Optional[pulumi.Input[str]] = None,
                 startup_script: Optional[pulumi.Input[str]] = None,
                 tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Provides a Spotinst Elastigroup GKE resource. Please see [Importing a GKE cluster](https://api.spotinst.com/elastigroup-for-google-cloud/tutorials/import-a-gke-cluster-as-an-elastigroup/) for detailed information.

        ## Example Usage

        A gke.Elastigroup supports all of the fields defined in spotinst_elastigroup_gcp.

        There are two main differences:

        * you must include `cluster_zone_name` and `cluster_id`
        * a handful of parameters are created remotely and will not appear in the diff. A complete list can be found below.

        ```python
        import pulumi
        import pulumi_spotinst as spotinst

        example_gke_elastigroup = spotinst.gke.Elastigroup("example-gke-elastigroup",
            backend_services=[spotinst.gke.ElastigroupBackendServiceArgs(
                location_type="global",
                named_ports=[spotinst.gke.ElastigroupBackendServiceNamedPortArgs(
                    name="http",
                    ports=[
                        "80",
                        "8080",
                    ],
                )],
                service_name="backend-service",
            )],
            cluster_zone_name="us-central1-a",
            desired_capacity=3,
            instance_types_ondemand="n1-standard-1",
            instance_types_preemptibles=[
                "n1-standard-1",
                "n1-standard-2",
            ],
            integration_gke=spotinst.gke.ElastigroupIntegrationGkeArgs(
                autoscale_cooldown=300,
                autoscale_down=spotinst.gke.ElastigroupIntegrationGkeAutoscaleDownArgs(
                    evaluation_periods=300,
                ),
                autoscale_headroom=spotinst.gke.ElastigroupIntegrationGkeAutoscaleHeadroomArgs(
                    cpu_per_unit=1024,
                    memory_per_unit=512,
                    num_of_units=2,
                ),
                autoscale_is_auto_config=False,
                autoscale_is_enabled=True,
                autoscale_labels=[spotinst.gke.ElastigroupIntegrationGkeAutoscaleLabelArgs(
                    key="label_key",
                    value="label_value",
                )],
                cluster_id="example-cluster-id",
                location="us-central1-a",
            ),
            max_size=5,
            min_size=1,
            node_image="COS",
            preemptible_percentage=100)
        ```
        ## Third-Party Integrations

        * `integration_gke` - (Required) Describes the GKE integration.
          
            * `location` - (Optional) The location of your GKE cluster.
            * `cluster_id` - (Optional) The GKE cluster ID you wish to import.
            * `autoscale_is_enabled` -  (Optional, Default: `false`) Specifies whether the auto scaling feature is enabled.
            * `autoscale_is_autoconfig` - (Optional, Default: `false`) Enabling the automatic auto-scaler functionality. For more information please see: .
            * `autoscale_cooldown` - (Optional, Default: `300`) The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
          
            * `autoscale_headroom` - (Optional) Headroom for the cluster.
                * `cpu_per_unit` - (Optional, Default: `0`) Cpu units for compute.
                * `memory_per_unit` - (Optional, Default: `0`) RAM units for compute.
                * `num_of_units` - (Optional, Default: `0`) Amount of units for compute.
          
            * `autoscale_down` - (Optional) Enabling scale down.
                * `evaluation_periods` - (Optional, Default: `5`) Amount of cooldown evaluation periods for scale down.
          
            * `autoscale_labels` - (Optional) Labels to assign to the resource.
                * `key` - (Optional) The label name.
                * `value` - (Optional) The label value.

        Usage:

        ```python
        import pulumi
        ```

        <a id="diff-suppressed-parameters"></a>
        ## Diff-suppressed Parameters

        The following parameters are created remotely and imported. The diffs have been suppressed in order to maintain plan legibility. You may update the values of these
        imported parameters by defining them in your template with your desired new value (including null values).

        * `backend_services`
            * `service_name`
            * `location_type`
            * `scheme`
            * `named_port`
                * `port_name`
                * `ports`
        * `labels`
            * `key`
            * `value`
        * `metadata`
            * `key`
            * `value`
        * `tags`
            * `key`
            * `value`
        * `service_account`
        * `ip_forwarding`
        * `fallback_to_od`
        * `subnets`
            * `region`
            * `subnet_name`

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] cluster_id: The name of the GKE cluster you wish to import.
        :param pulumi.Input[str] cluster_zone_name: The zone where the cluster is hosted.
        :param pulumi.Input[str] node_image: The image that will be used for the node VMs. Possible values: COS, UBUNTU.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        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__ = dict()

            __props__['backend_services'] = backend_services
            if cluster_id is not None:
                warnings.warn("""Please define cluster_id under integration_gke""", DeprecationWarning)
                pulumi.log.warn("cluster_id is deprecated: Please define cluster_id under integration_gke")
            __props__['cluster_id'] = cluster_id
            if cluster_zone_name is None:
                raise TypeError("Missing required property 'cluster_zone_name'")
            __props__['cluster_zone_name'] = cluster_zone_name
            if desired_capacity is None:
                raise TypeError("Missing required property 'desired_capacity'")
            __props__['desired_capacity'] = desired_capacity
            __props__['disks'] = disks
            __props__['draining_timeout'] = draining_timeout
            __props__['fallback_to_ondemand'] = fallback_to_ondemand
            __props__['gpu'] = gpu
            __props__['instance_types_customs'] = instance_types_customs
            __props__['instance_types_ondemand'] = instance_types_ondemand
            __props__['instance_types_preemptibles'] = instance_types_preemptibles
            __props__['integration_docker_swarm'] = integration_docker_swarm
            __props__['integration_gke'] = integration_gke
            __props__['ip_forwarding'] = ip_forwarding
            __props__['labels'] = labels
            __props__['max_size'] = max_size
            __props__['metadatas'] = metadatas
            __props__['min_size'] = min_size
            __props__['name'] = name
            __props__['network_interfaces'] = network_interfaces
            __props__['node_image'] = node_image
            __props__['ondemand_count'] = ondemand_count
            __props__['preemptible_percentage'] = preemptible_percentage
            __props__['scaling_down_policies'] = scaling_down_policies
            __props__['scaling_up_policies'] = scaling_up_policies
            __props__['service_account'] = service_account
            __props__['shutdown_script'] = shutdown_script
            __props__['startup_script'] = startup_script
            __props__['tags'] = tags
        super(Elastigroup, __self__).__init__(
            'spotinst:gke/elastigroup:Elastigroup',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            backend_services: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupBackendServiceArgs']]]]] = None,
            cluster_id: Optional[pulumi.Input[str]] = None,
            cluster_zone_name: Optional[pulumi.Input[str]] = None,
            desired_capacity: Optional[pulumi.Input[int]] = None,
            disks: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupDiskArgs']]]]] = None,
            draining_timeout: Optional[pulumi.Input[int]] = None,
            fallback_to_ondemand: Optional[pulumi.Input[bool]] = None,
            gpu: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupGpuArgs']]]]] = None,
            instance_types_customs: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupInstanceTypesCustomArgs']]]]] = None,
            instance_types_ondemand: Optional[pulumi.Input[str]] = None,
            instance_types_preemptibles: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
            integration_docker_swarm: Optional[pulumi.Input[pulumi.InputType['ElastigroupIntegrationDockerSwarmArgs']]] = None,
            integration_gke: Optional[pulumi.Input[pulumi.InputType['ElastigroupIntegrationGkeArgs']]] = None,
            ip_forwarding: Optional[pulumi.Input[bool]] = None,
            labels: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupLabelArgs']]]]] = None,
            max_size: Optional[pulumi.Input[int]] = None,
            metadatas: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupMetadataArgs']]]]] = None,
            min_size: Optional[pulumi.Input[int]] = None,
            name: Optional[pulumi.Input[str]] = None,
            network_interfaces: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupNetworkInterfaceArgs']]]]] = None,
            node_image: Optional[pulumi.Input[str]] = None,
            ondemand_count: Optional[pulumi.Input[int]] = None,
            preemptible_percentage: Optional[pulumi.Input[int]] = None,
            scaling_down_policies: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupScalingDownPolicyArgs']]]]] = None,
            scaling_up_policies: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ElastigroupScalingUpPolicyArgs']]]]] = None,
            service_account: Optional[pulumi.Input[str]] = None,
            shutdown_script: Optional[pulumi.Input[str]] = None,
            startup_script: Optional[pulumi.Input[str]] = None,
            tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None) -> 'Elastigroup':
        """
        Get an existing Elastigroup 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] cluster_id: The name of the GKE cluster you wish to import.
        :param pulumi.Input[str] cluster_zone_name: The zone where the cluster is hosted.
        :param pulumi.Input[str] node_image: The image that will be used for the node VMs. Possible values: COS, UBUNTU.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["backend_services"] = backend_services
        __props__["cluster_id"] = cluster_id
        __props__["cluster_zone_name"] = cluster_zone_name
        __props__["desired_capacity"] = desired_capacity
        __props__["disks"] = disks
        __props__["draining_timeout"] = draining_timeout
        __props__["fallback_to_ondemand"] = fallback_to_ondemand
        __props__["gpu"] = gpu
        __props__["instance_types_customs"] = instance_types_customs
        __props__["instance_types_ondemand"] = instance_types_ondemand
        __props__["instance_types_preemptibles"] = instance_types_preemptibles
        __props__["integration_docker_swarm"] = integration_docker_swarm
        __props__["integration_gke"] = integration_gke
        __props__["ip_forwarding"] = ip_forwarding
        __props__["labels"] = labels
        __props__["max_size"] = max_size
        __props__["metadatas"] = metadatas
        __props__["min_size"] = min_size
        __props__["name"] = name
        __props__["network_interfaces"] = network_interfaces
        __props__["node_image"] = node_image
        __props__["ondemand_count"] = ondemand_count
        __props__["preemptible_percentage"] = preemptible_percentage
        __props__["scaling_down_policies"] = scaling_down_policies
        __props__["scaling_up_policies"] = scaling_up_policies
        __props__["service_account"] = service_account
        __props__["shutdown_script"] = shutdown_script
        __props__["startup_script"] = startup_script
        __props__["tags"] = tags
        return Elastigroup(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="backendServices")
    def backend_services(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupBackendService']]]:
        return pulumi.get(self, "backend_services")

    @property
    @pulumi.getter(name="clusterId")
    def cluster_id(self) -> pulumi.Output[Optional[str]]:
        """
        The name of the GKE cluster you wish to import.
        """
        return pulumi.get(self, "cluster_id")

    @property
    @pulumi.getter(name="clusterZoneName")
    def cluster_zone_name(self) -> pulumi.Output[str]:
        """
        The zone where the cluster is hosted.
        """
        return pulumi.get(self, "cluster_zone_name")

    @property
    @pulumi.getter(name="desiredCapacity")
    def desired_capacity(self) -> pulumi.Output[int]:
        return pulumi.get(self, "desired_capacity")

    @property
    @pulumi.getter
    def disks(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupDisk']]]:
        return pulumi.get(self, "disks")

    @property
    @pulumi.getter(name="drainingTimeout")
    def draining_timeout(self) -> pulumi.Output[Optional[int]]:
        return pulumi.get(self, "draining_timeout")

    @property
    @pulumi.getter(name="fallbackToOndemand")
    def fallback_to_ondemand(self) -> pulumi.Output[Optional[bool]]:
        return pulumi.get(self, "fallback_to_ondemand")

    @property
    @pulumi.getter
    def gpu(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupGpu']]]:
        return pulumi.get(self, "gpu")

    @property
    @pulumi.getter(name="instanceTypesCustoms")
    def instance_types_customs(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupInstanceTypesCustom']]]:
        return pulumi.get(self, "instance_types_customs")

    @property
    @pulumi.getter(name="instanceTypesOndemand")
    def instance_types_ondemand(self) -> pulumi.Output[Optional[str]]:
        return pulumi.get(self, "instance_types_ondemand")

    @property
    @pulumi.getter(name="instanceTypesPreemptibles")
    def instance_types_preemptibles(self) -> pulumi.Output[Optional[Sequence[str]]]:
        return pulumi.get(self, "instance_types_preemptibles")

    @property
    @pulumi.getter(name="integrationDockerSwarm")
    def integration_docker_swarm(self) -> pulumi.Output[Optional['outputs.ElastigroupIntegrationDockerSwarm']]:
        return pulumi.get(self, "integration_docker_swarm")

    @property
    @pulumi.getter(name="integrationGke")
    def integration_gke(self) -> pulumi.Output[Optional['outputs.ElastigroupIntegrationGke']]:
        return pulumi.get(self, "integration_gke")

    @property
    @pulumi.getter(name="ipForwarding")
    def ip_forwarding(self) -> pulumi.Output[Optional[bool]]:
        return pulumi.get(self, "ip_forwarding")

    @property
    @pulumi.getter
    def labels(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupLabel']]]:
        return pulumi.get(self, "labels")

    @property
    @pulumi.getter(name="maxSize")
    def max_size(self) -> pulumi.Output[int]:
        return pulumi.get(self, "max_size")

    @property
    @pulumi.getter
    def metadatas(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupMetadata']]]:
        return pulumi.get(self, "metadatas")

    @property
    @pulumi.getter(name="minSize")
    def min_size(self) -> pulumi.Output[int]:
        return pulumi.get(self, "min_size")

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

    @property
    @pulumi.getter(name="networkInterfaces")
    def network_interfaces(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupNetworkInterface']]]:
        return pulumi.get(self, "network_interfaces")

    @property
    @pulumi.getter(name="nodeImage")
    def node_image(self) -> pulumi.Output[Optional[str]]:
        """
        The image that will be used for the node VMs. Possible values: COS, UBUNTU.
        """
        return pulumi.get(self, "node_image")

    @property
    @pulumi.getter(name="ondemandCount")
    def ondemand_count(self) -> pulumi.Output[Optional[int]]:
        return pulumi.get(self, "ondemand_count")

    @property
    @pulumi.getter(name="preemptiblePercentage")
    def preemptible_percentage(self) -> pulumi.Output[Optional[int]]:
        return pulumi.get(self, "preemptible_percentage")

    @property
    @pulumi.getter(name="scalingDownPolicies")
    def scaling_down_policies(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupScalingDownPolicy']]]:
        return pulumi.get(self, "scaling_down_policies")

    @property
    @pulumi.getter(name="scalingUpPolicies")
    def scaling_up_policies(self) -> pulumi.Output[Optional[Sequence['outputs.ElastigroupScalingUpPolicy']]]:
        return pulumi.get(self, "scaling_up_policies")

    @property
    @pulumi.getter(name="serviceAccount")
    def service_account(self) -> pulumi.Output[Optional[str]]:
        return pulumi.get(self, "service_account")

    @property
    @pulumi.getter(name="shutdownScript")
    def shutdown_script(self) -> pulumi.Output[Optional[str]]:
        return pulumi.get(self, "shutdown_script")

    @property
    @pulumi.getter(name="startupScript")
    def startup_script(self) -> pulumi.Output[Optional[str]]:
        return pulumi.get(self, "startup_script")

    @property
    @pulumi.getter
    def tags(self) -> pulumi.Output[Optional[Sequence[str]]]:
        return pulumi.get(self, "tags")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

