# 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__ = ['OceanImport']


class OceanImport(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 autoscaler: Optional[pulumi.Input[pulumi.InputType['OceanImportAutoscalerArgs']]] = None,
                 backend_services: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['OceanImportBackendServiceArgs']]]]] = None,
                 cluster_name: Optional[pulumi.Input[str]] = None,
                 controller_cluster_id: Optional[pulumi.Input[str]] = None,
                 desired_capacity: Optional[pulumi.Input[int]] = None,
                 location: Optional[pulumi.Input[str]] = None,
                 max_size: Optional[pulumi.Input[int]] = None,
                 min_size: Optional[pulumi.Input[int]] = None,
                 scheduled_tasks: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['OceanImportScheduledTaskArgs']]]]] = None,
                 whitelists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Manages a Spotinst Ocean GKE resource.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_spotinst as spotinst

        example = spotinst.gke.OceanImport("example",
            backend_services=[spotinst.gke.OceanImportBackendServiceArgs(
                location_type="regional",
                named_ports=[spotinst.gke.OceanImportBackendServiceNamedPortArgs(
                    name="http",
                    ports=[
                        "80",
                        "8080",
                    ],
                )],
                scheme="INTERNAL",
                service_name="example-backend-service",
            )],
            cluster_name="example-cluster-name",
            desired_capacity=0,
            location="us-central1-a",
            max_size=2,
            min_size=0,
            whitelists=[
                "n1-standard-1",
                "n1-standard-2",
            ])
        ```

        ```python
        import pulumi

        pulumi.export("oceanId", spotinst_ocean_gke_import["example"]["id"])
        ```
        ## scheduled task

        * `scheduled_task` - (Optional) Set scheduling object.
            * `shutdown_hours` - (Optional) Set shutdown hours for cluster object.
                * `is_enabled` - (Optional)  Flag to enable / disable the shutdown hours.
                                             Example: True
                * `time_windows` - (Required) Set time windows for shutdown hours. specify a list of 'timeWindows' with at least one time window Each string is in the format of - ddd:hh:mm-ddd:hh:mm ddd = day of week = Sun | Mon | Tue | Wed | Thu | Fri | Sat hh = hour 24 = 0 -23 mm = minute = 0 - 59. Time windows should not overlap. required on cluster.scheduling.isEnabled = True. API Times are in UTC
                                              Example: Fri:15:30-Wed:14:30
            * `tasks` - (Optional) The scheduling tasks for the cluster.
                * `is_enabled` - (Required)  Describes whether the task is enabled. When true the task should run when false it should not run. Required for cluster.scheduling.tasks object.
                * `cron_expression` - (Required) A valid cron expression. For example : " * * * * * ".The cron is running in UTC time zone and is in Unix cron format Cron Expression Validator Script. Only one of ‘frequency’ or ‘cronExpression’ should be used at a time. Required for cluster.scheduling.tasks object
                                                 Example: 0 1 * * *
                * `task_type` - (Required) Valid values: "clusterRoll". Required for cluster.scheduling.tasks object.
                * `batch_size_percentage` - (Optional)  Value in % to set size of batch in roll. Valid values are 0-100
                                                        Example: 20.

        ```python
        import pulumi
        ```

        <a id="autoscaler"></a>
        ## Autoscaler

        * `autoscaler` - (Optional) The Ocean Kubernetes Autoscaler object.
        * `is_enabled` - (Optional, Default: `true`) Enable the Ocean Kubernetes Autoscaler.
        * `is_auto_config` - (Optional, Default: `true`) Automatically configure and optimize headroom resources.
        * `auto_headroom_percentage` - Optionally set the auto headroom percentage, set a number between 0-200 to control the headroom % from the cluster. Relevant when isAutoConfig=true.
        * `cooldown` - (Optional, Default: `null`) Cooldown period between scaling actions.
        * `headroom` - (Optional) Spare resource capacity management enabling fast assignment of Pods without waiting for new resources to launch.
        * `cpu_per_unit` - (Optional) Optionally configure the number of CPUs to allocate the headroom. CPUs are denoted in millicores, where 1000 millicores = 1 vCPU.
        * `memory_per_unit` - (Optional) Optionally configure the amount of memory (MiB) to allocate the headroom.
        * `gpu_per_unit` - (Optional) How much GPU allocate for headroom unit.
        * `num_of_units` - (Optional) The number of units to retain as headroom, where each unit has the defined headroom CPU and memory.
        * `down` - (Optional) Auto Scaling scale down operations.
        * `evaluation_periods` - (Optional, Default: `null`) The number of evaluation periods that should accumulate before a scale down action takes place.
        * `max_scale_down_percentage` - (Optional) Would represent the maximum % to scale-down. Number between 1-100.
        * `resource_limits` - (Optional) Optionally set upper and lower bounds on the resource usage of the cluster.
        * `max_vcpu` - (Optional) The maximum cpu in vCpu units that can be allocated to the cluster.
        * `max_memory_gib` - (Optional) The maximum memory in GiB units that can be allocated to the cluster.

        ```python
        import pulumi
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['OceanImportBackendServiceArgs']]]] backend_services: Describes the backend service configurations.
        :param pulumi.Input[str] cluster_name: The GKE cluster name.
        :param pulumi.Input[int] desired_capacity: The number of instances to launch and maintain in the cluster.
        :param pulumi.Input[str] location: The zone the master cluster is located in.
        :param pulumi.Input[int] max_size: The upper limit of instances the cluster can scale up to.
        :param pulumi.Input[int] min_size: The lower limit of instances the cluster can scale down to.
        """
        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__['autoscaler'] = autoscaler
            __props__['backend_services'] = backend_services
            if cluster_name is None:
                raise TypeError("Missing required property 'cluster_name'")
            __props__['cluster_name'] = cluster_name
            __props__['controller_cluster_id'] = controller_cluster_id
            __props__['desired_capacity'] = desired_capacity
            if location is None:
                raise TypeError("Missing required property 'location'")
            __props__['location'] = location
            __props__['max_size'] = max_size
            __props__['min_size'] = min_size
            __props__['scheduled_tasks'] = scheduled_tasks
            __props__['whitelists'] = whitelists
            __props__['cluster_controller_id'] = None
        super(OceanImport, __self__).__init__(
            'spotinst:gke/oceanImport:OceanImport',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            autoscaler: Optional[pulumi.Input[pulumi.InputType['OceanImportAutoscalerArgs']]] = None,
            backend_services: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['OceanImportBackendServiceArgs']]]]] = None,
            cluster_controller_id: Optional[pulumi.Input[str]] = None,
            cluster_name: Optional[pulumi.Input[str]] = None,
            controller_cluster_id: Optional[pulumi.Input[str]] = None,
            desired_capacity: Optional[pulumi.Input[int]] = None,
            location: Optional[pulumi.Input[str]] = None,
            max_size: Optional[pulumi.Input[int]] = None,
            min_size: Optional[pulumi.Input[int]] = None,
            scheduled_tasks: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['OceanImportScheduledTaskArgs']]]]] = None,
            whitelists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None) -> 'OceanImport':
        """
        Get an existing OceanImport 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[pulumi.InputType['OceanImportBackendServiceArgs']]]] backend_services: Describes the backend service configurations.
        :param pulumi.Input[str] cluster_name: The GKE cluster name.
        :param pulumi.Input[int] desired_capacity: The number of instances to launch and maintain in the cluster.
        :param pulumi.Input[str] location: The zone the master cluster is located in.
        :param pulumi.Input[int] max_size: The upper limit of instances the cluster can scale up to.
        :param pulumi.Input[int] min_size: The lower limit of instances the cluster can scale down to.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["autoscaler"] = autoscaler
        __props__["backend_services"] = backend_services
        __props__["cluster_controller_id"] = cluster_controller_id
        __props__["cluster_name"] = cluster_name
        __props__["controller_cluster_id"] = controller_cluster_id
        __props__["desired_capacity"] = desired_capacity
        __props__["location"] = location
        __props__["max_size"] = max_size
        __props__["min_size"] = min_size
        __props__["scheduled_tasks"] = scheduled_tasks
        __props__["whitelists"] = whitelists
        return OceanImport(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def autoscaler(self) -> pulumi.Output['outputs.OceanImportAutoscaler']:
        return pulumi.get(self, "autoscaler")

    @property
    @pulumi.getter(name="backendServices")
    def backend_services(self) -> pulumi.Output[Optional[Sequence['outputs.OceanImportBackendService']]]:
        """
        Describes the backend service configurations.
        """
        return pulumi.get(self, "backend_services")

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

    @property
    @pulumi.getter(name="clusterName")
    def cluster_name(self) -> pulumi.Output[str]:
        """
        The GKE cluster name.
        """
        return pulumi.get(self, "cluster_name")

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

    @property
    @pulumi.getter(name="desiredCapacity")
    def desired_capacity(self) -> pulumi.Output[int]:
        """
        The number of instances to launch and maintain in the cluster.
        """
        return pulumi.get(self, "desired_capacity")

    @property
    @pulumi.getter
    def location(self) -> pulumi.Output[str]:
        """
        The zone the master cluster is located in.
        """
        return pulumi.get(self, "location")

    @property
    @pulumi.getter(name="maxSize")
    def max_size(self) -> pulumi.Output[int]:
        """
        The upper limit of instances the cluster can scale up to.
        """
        return pulumi.get(self, "max_size")

    @property
    @pulumi.getter(name="minSize")
    def min_size(self) -> pulumi.Output[int]:
        """
        The lower limit of instances the cluster can scale down to.
        """
        return pulumi.get(self, "min_size")

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

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

    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

