# 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 Union
from . import utilities, tables


class MonitoringJob(pulumi.CustomResource):
    active: pulumi.Output[bool]
    """
    Indicates if the job is active or temporarily disabled.
    """
    config: pulumi.Output[dict]
    """
    A configuration dictionary with keys and values depending on the jobs' type.
    """
    frequency: pulumi.Output[float]
    """
    The frequency, in seconds, at which to run the monitoring job in each region.
    """
    job_type: pulumi.Output[str]
    """
    The type of monitoring job to be run. See NS1 API
    docs for supported values.
    """
    name: pulumi.Output[str]
    """
    The free-form display name for the monitoring job.
    """
    notes: pulumi.Output[str]
    """
    Freeform notes to be included in any notifications about this job.
    """
    notify_delay: pulumi.Output[float]
    """
    The time in seconds after a failure to wait before sending a notification.
    """
    notify_failback: pulumi.Output[bool]
    """
    If true, a notification is sent when a job returns to an "up" state.
    """
    notify_list: pulumi.Output[str]
    """
    The id of the notification list to send notifications to.
    """
    notify_regional: pulumi.Output[bool]
    """
    If true, notifications are sent for any regional failure (and failback if desired), in addition to global state notifications.
    """
    notify_repeat: pulumi.Output[float]
    """
    The time in seconds between repeat notifications of a failed job.
    """
    policy: pulumi.Output[str]
    """
    The policy for determining the monitor's global status
    based on the status of the job in all regions. See NS1 API docs for supported values.
    """
    rapid_recheck: pulumi.Output[bool]
    """
    If true, on any apparent state change, the job is quickly re-run after one second to confirm the state change before notification.
    """
    regions: pulumi.Output[list]
    """
    The list of region codes in which to run the monitoring
    job. See NS1 API docs for supported values.
    """
    rules: pulumi.Output[list]
    """
    A list of rules for determining failure conditions. Job Rules are documented below.

      * `comparison` (`str`) - The comparison to perform on the the output.
      * `key` (`str`) - The output key.
      * `value` (`str`) - The value to compare to.
    """
    def __init__(__self__, resource_name, opts=None, active=None, config=None, frequency=None, job_type=None, name=None, notes=None, notify_delay=None, notify_failback=None, notify_list=None, notify_regional=None, notify_repeat=None, policy=None, rapid_recheck=None, regions=None, rules=None, __props__=None, __name__=None, __opts__=None):
        """
        Provides a NS1 Monitoring Job resource. This can be used to create, modify, and delete monitoring jobs.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_ns1 as ns1

        uswest_monitor = ns1.MonitoringJob("uswestMonitor",
            active=True,
            config={
                "host": "example-elb-uswest.aws.amazon.com",
                "port": 443,
                "send": \"\"\"HEAD / HTTP/1.0
        

        \"\"\",
                "ssl": 1,
            },
            frequency=60,
            job_type="tcp",
            policy="quorum",
            rapid_recheck=True,
            regions=[
                "sjc",
                "sin",
                "lga",
            ],
            rules=[{
                "comparison": "contains",
                "key": "output",
                "value": "200 OK",
            }])
        ```
        ## NS1 Documentation

        [MonitoringJob Api Doc](https://ns1.com/api#monitoring-jobs)

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[bool] active: Indicates if the job is active or temporarily disabled.
        :param pulumi.Input[dict] config: A configuration dictionary with keys and values depending on the jobs' type.
        :param pulumi.Input[float] frequency: The frequency, in seconds, at which to run the monitoring job in each region.
        :param pulumi.Input[str] job_type: The type of monitoring job to be run. See NS1 API
               docs for supported values.
        :param pulumi.Input[str] name: The free-form display name for the monitoring job.
        :param pulumi.Input[str] notes: Freeform notes to be included in any notifications about this job.
        :param pulumi.Input[float] notify_delay: The time in seconds after a failure to wait before sending a notification.
        :param pulumi.Input[bool] notify_failback: If true, a notification is sent when a job returns to an "up" state.
        :param pulumi.Input[str] notify_list: The id of the notification list to send notifications to.
        :param pulumi.Input[bool] notify_regional: If true, notifications are sent for any regional failure (and failback if desired), in addition to global state notifications.
        :param pulumi.Input[float] notify_repeat: The time in seconds between repeat notifications of a failed job.
        :param pulumi.Input[str] policy: The policy for determining the monitor's global status
               based on the status of the job in all regions. See NS1 API docs for supported values.
        :param pulumi.Input[bool] rapid_recheck: If true, on any apparent state change, the job is quickly re-run after one second to confirm the state change before notification.
        :param pulumi.Input[list] regions: The list of region codes in which to run the monitoring
               job. See NS1 API docs for supported values.
        :param pulumi.Input[list] rules: A list of rules for determining failure conditions. Job Rules are documented below.

        The **rules** object supports the following:

          * `comparison` (`pulumi.Input[str]`) - The comparison to perform on the the output.
          * `key` (`pulumi.Input[str]`) - The output key.
          * `value` (`pulumi.Input[str]`) - The value to compare 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__['active'] = active
            if config is None:
                raise TypeError("Missing required property 'config'")
            __props__['config'] = config
            if frequency is None:
                raise TypeError("Missing required property 'frequency'")
            __props__['frequency'] = frequency
            if job_type is None:
                raise TypeError("Missing required property 'job_type'")
            __props__['job_type'] = job_type
            __props__['name'] = name
            __props__['notes'] = notes
            __props__['notify_delay'] = notify_delay
            __props__['notify_failback'] = notify_failback
            __props__['notify_list'] = notify_list
            __props__['notify_regional'] = notify_regional
            __props__['notify_repeat'] = notify_repeat
            __props__['policy'] = policy
            __props__['rapid_recheck'] = rapid_recheck
            if regions is None:
                raise TypeError("Missing required property 'regions'")
            __props__['regions'] = regions
            __props__['rules'] = rules
        super(MonitoringJob, __self__).__init__(
            'ns1:index/monitoringJob:MonitoringJob',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, active=None, config=None, frequency=None, job_type=None, name=None, notes=None, notify_delay=None, notify_failback=None, notify_list=None, notify_regional=None, notify_repeat=None, policy=None, rapid_recheck=None, regions=None, rules=None):
        """
        Get an existing MonitoringJob 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 str id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[bool] active: Indicates if the job is active or temporarily disabled.
        :param pulumi.Input[dict] config: A configuration dictionary with keys and values depending on the jobs' type.
        :param pulumi.Input[float] frequency: The frequency, in seconds, at which to run the monitoring job in each region.
        :param pulumi.Input[str] job_type: The type of monitoring job to be run. See NS1 API
               docs for supported values.
        :param pulumi.Input[str] name: The free-form display name for the monitoring job.
        :param pulumi.Input[str] notes: Freeform notes to be included in any notifications about this job.
        :param pulumi.Input[float] notify_delay: The time in seconds after a failure to wait before sending a notification.
        :param pulumi.Input[bool] notify_failback: If true, a notification is sent when a job returns to an "up" state.
        :param pulumi.Input[str] notify_list: The id of the notification list to send notifications to.
        :param pulumi.Input[bool] notify_regional: If true, notifications are sent for any regional failure (and failback if desired), in addition to global state notifications.
        :param pulumi.Input[float] notify_repeat: The time in seconds between repeat notifications of a failed job.
        :param pulumi.Input[str] policy: The policy for determining the monitor's global status
               based on the status of the job in all regions. See NS1 API docs for supported values.
        :param pulumi.Input[bool] rapid_recheck: If true, on any apparent state change, the job is quickly re-run after one second to confirm the state change before notification.
        :param pulumi.Input[list] regions: The list of region codes in which to run the monitoring
               job. See NS1 API docs for supported values.
        :param pulumi.Input[list] rules: A list of rules for determining failure conditions. Job Rules are documented below.

        The **rules** object supports the following:

          * `comparison` (`pulumi.Input[str]`) - The comparison to perform on the the output.
          * `key` (`pulumi.Input[str]`) - The output key.
          * `value` (`pulumi.Input[str]`) - The value to compare to.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["active"] = active
        __props__["config"] = config
        __props__["frequency"] = frequency
        __props__["job_type"] = job_type
        __props__["name"] = name
        __props__["notes"] = notes
        __props__["notify_delay"] = notify_delay
        __props__["notify_failback"] = notify_failback
        __props__["notify_list"] = notify_list
        __props__["notify_regional"] = notify_regional
        __props__["notify_repeat"] = notify_repeat
        __props__["policy"] = policy
        __props__["rapid_recheck"] = rapid_recheck
        __props__["regions"] = regions
        __props__["rules"] = rules
        return MonitoringJob(resource_name, opts=opts, __props__=__props__)

    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
