# 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 builtins
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

__all__ = [
    'GetScheduleSqlTaskResult',
    'AwaitableGetScheduleSqlTaskResult',
    'get_schedule_sql_task',
    'get_schedule_sql_task_output',
]

@pulumi.output_type
class GetScheduleSqlTaskResult:
    """
    A collection of values returned by getScheduleSqlTask.
    """
    def __init__(__self__, created_time=None, description=None, dest_project_id=None, dest_region=None, dest_topic_id=None, dest_topic_name=None, id=None, process_end_time=None, process_sql_delay=None, process_start_time=None, process_time_window=None, query=None, request_cycle=None, source_project_id=None, source_project_name=None, source_topic_id=None, source_topic_name=None, status=None, task_id=None, task_name=None, task_type=None, updated_time=None):
        if created_time and not isinstance(created_time, int):
            raise TypeError("Expected argument 'created_time' to be a int")
        pulumi.set(__self__, "created_time", created_time)
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if dest_project_id and not isinstance(dest_project_id, str):
            raise TypeError("Expected argument 'dest_project_id' to be a str")
        pulumi.set(__self__, "dest_project_id", dest_project_id)
        if dest_region and not isinstance(dest_region, str):
            raise TypeError("Expected argument 'dest_region' to be a str")
        pulumi.set(__self__, "dest_region", dest_region)
        if dest_topic_id and not isinstance(dest_topic_id, str):
            raise TypeError("Expected argument 'dest_topic_id' to be a str")
        pulumi.set(__self__, "dest_topic_id", dest_topic_id)
        if dest_topic_name and not isinstance(dest_topic_name, str):
            raise TypeError("Expected argument 'dest_topic_name' to be a str")
        pulumi.set(__self__, "dest_topic_name", dest_topic_name)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if process_end_time and not isinstance(process_end_time, int):
            raise TypeError("Expected argument 'process_end_time' to be a int")
        pulumi.set(__self__, "process_end_time", process_end_time)
        if process_sql_delay and not isinstance(process_sql_delay, int):
            raise TypeError("Expected argument 'process_sql_delay' to be a int")
        pulumi.set(__self__, "process_sql_delay", process_sql_delay)
        if process_start_time and not isinstance(process_start_time, int):
            raise TypeError("Expected argument 'process_start_time' to be a int")
        pulumi.set(__self__, "process_start_time", process_start_time)
        if process_time_window and not isinstance(process_time_window, str):
            raise TypeError("Expected argument 'process_time_window' to be a str")
        pulumi.set(__self__, "process_time_window", process_time_window)
        if query and not isinstance(query, str):
            raise TypeError("Expected argument 'query' to be a str")
        pulumi.set(__self__, "query", query)
        if request_cycle and not isinstance(request_cycle, dict):
            raise TypeError("Expected argument 'request_cycle' to be a dict")
        pulumi.set(__self__, "request_cycle", request_cycle)
        if source_project_id and not isinstance(source_project_id, str):
            raise TypeError("Expected argument 'source_project_id' to be a str")
        pulumi.set(__self__, "source_project_id", source_project_id)
        if source_project_name and not isinstance(source_project_name, str):
            raise TypeError("Expected argument 'source_project_name' to be a str")
        pulumi.set(__self__, "source_project_name", source_project_name)
        if source_topic_id and not isinstance(source_topic_id, str):
            raise TypeError("Expected argument 'source_topic_id' to be a str")
        pulumi.set(__self__, "source_topic_id", source_topic_id)
        if source_topic_name and not isinstance(source_topic_name, str):
            raise TypeError("Expected argument 'source_topic_name' to be a str")
        pulumi.set(__self__, "source_topic_name", source_topic_name)
        if status and not isinstance(status, int):
            raise TypeError("Expected argument 'status' to be a int")
        pulumi.set(__self__, "status", status)
        if task_id and not isinstance(task_id, str):
            raise TypeError("Expected argument 'task_id' to be a str")
        pulumi.set(__self__, "task_id", task_id)
        if task_name and not isinstance(task_name, str):
            raise TypeError("Expected argument 'task_name' to be a str")
        pulumi.set(__self__, "task_name", task_name)
        if task_type and not isinstance(task_type, int):
            raise TypeError("Expected argument 'task_type' to be a int")
        pulumi.set(__self__, "task_type", task_type)
        if updated_time and not isinstance(updated_time, int):
            raise TypeError("Expected argument 'updated_time' to be a int")
        pulumi.set(__self__, "updated_time", updated_time)

    @property
    @pulumi.getter(name="createdTime")
    def created_time(self) -> builtins.int:
        """
        创建时间（秒级 Unix 时间戳）。
        """
        return pulumi.get(self, "created_time")

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        定时 SQL 分析任务的简单描述。不支持<>、'、\\、\\。长度范围为 0～64 个字符。
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="destProjectId")
    def dest_project_id(self) -> builtins.str:
        """
        目标日志项目 ID。
        """
        return pulumi.get(self, "dest_project_id")

    @property
    @pulumi.getter(name="destRegion")
    def dest_region(self) -> builtins.str:
        """
        目标日志主题所属地域。默认为当前地域。
        """
        return pulumi.get(self, "dest_region")

    @property
    @pulumi.getter(name="destTopicId")
    def dest_topic_id(self) -> builtins.str:
        """
        用于存储定时 SQL 分析结果数据的目标日志主题 ID。
        """
        return pulumi.get(self, "dest_topic_id")

    @property
    @pulumi.getter(name="destTopicName")
    def dest_topic_name(self) -> builtins.str:
        """
        目标日志主题名称。
        """
        return pulumi.get(self, "dest_topic_name")

    @property
    @pulumi.getter
    def id(self) -> builtins.str:
        """
        Uniquely identifies the resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="processEndTime")
    def process_end_time(self) -> builtins.int:
        """
        调度定时 SQL 分析任务的结束时间，格式为秒级时间戳。如果不配置，表示持续运行定时 SQL 分析任务。到达结束时间后，日志服务不会再创建实例及执行定时 SQL 分析，但任务状态仍为运行中，直至手动暂停任务。
        """
        return pulumi.get(self, "process_end_time")

    @property
    @pulumi.getter(name="processSqlDelay")
    def process_sql_delay(self) -> builtins.int:
        """
        每次调度的延迟时间。取值范围为 0～120，单位为秒。如果不配置，则表示 0，即无延时。
        """
        return pulumi.get(self, "process_sql_delay")

    @property
    @pulumi.getter(name="processStartTime")
    def process_start_time(self) -> builtins.int:
        """
        调度定时 SQL 分析任务的开始时间，即创建第一个实例的时间。格式为秒级时间戳。
        """
        return pulumi.get(self, "process_start_time")

    @property
    @pulumi.getter(name="processTimeWindow")
    def process_time_window(self) -> builtins.str:
        """
        SQL 时间窗口，即定时 SQL 分析任务运行时，日志检索与分析的时间范围，左闭右开格式。最大为 24 小时，最小为 1 分钟。
        """
        return pulumi.get(self, "process_time_window")

    @property
    @pulumi.getter
    def query(self) -> builtins.str:
        """
        定时 SQL 分析任务定期执行的检索与分析语句，应符合日志服务的检索与分析语法。
        """
        return pulumi.get(self, "query")

    @property
    @pulumi.getter(name="requestCycle")
    def request_cycle(self) -> 'outputs.GetScheduleSqlTaskRequestCycleResult':
        """
        定时 SQL 分析任务的调度周期。调度周期决定每个实例的调度时间。建议调度周期不小于 SQL 时间窗口。
        """
        return pulumi.get(self, "request_cycle")

    @property
    @pulumi.getter(name="sourceProjectId")
    def source_project_id(self) -> builtins.str:
        """
        源日志项目 ID。
        """
        return pulumi.get(self, "source_project_id")

    @property
    @pulumi.getter(name="sourceProjectName")
    def source_project_name(self) -> builtins.str:
        """
        源日志项目名称。
        """
        return pulumi.get(self, "source_project_name")

    @property
    @pulumi.getter(name="sourceTopicId")
    def source_topic_id(self) -> builtins.str:
        """
        待进行定时 SQL 分析的原始日志所在的日志主题 ID。仅支持当前地域的日志主题。
        """
        return pulumi.get(self, "source_topic_id")

    @property
    @pulumi.getter(name="sourceTopicName")
    def source_topic_name(self) -> builtins.str:
        """
        源日志主题名称。
        """
        return pulumi.get(self, "source_topic_name")

    @property
    @pulumi.getter
    def status(self) -> builtins.int:
        """
        完成任务配置后是否立即启动定时 SQL 分析任务。可选值：0 关闭；1 立即启动。
        """
        return pulumi.get(self, "status")

    @property
    @pulumi.getter(name="taskId")
    def task_id(self) -> builtins.str:
        """
        任务 ID。
        """
        return pulumi.get(self, "task_id")

    @property
    @pulumi.getter(name="taskName")
    def task_name(self) -> builtins.str:
        """
        定时 SQL 分析任务名称。命名规则请参考资源命名规则。
        """
        return pulumi.get(self, "task_name")

    @property
    @pulumi.getter(name="taskType")
    def task_type(self) -> builtins.int:
        """
        任务类型：0 表示日志到日志；1 表示日志到指标。
        """
        return pulumi.get(self, "task_type")

    @property
    @pulumi.getter(name="updatedTime")
    def updated_time(self) -> builtins.int:
        """
        修改时间（秒级 Unix 时间戳）。
        """
        return pulumi.get(self, "updated_time")


class AwaitableGetScheduleSqlTaskResult(GetScheduleSqlTaskResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetScheduleSqlTaskResult(
            created_time=self.created_time,
            description=self.description,
            dest_project_id=self.dest_project_id,
            dest_region=self.dest_region,
            dest_topic_id=self.dest_topic_id,
            dest_topic_name=self.dest_topic_name,
            id=self.id,
            process_end_time=self.process_end_time,
            process_sql_delay=self.process_sql_delay,
            process_start_time=self.process_start_time,
            process_time_window=self.process_time_window,
            query=self.query,
            request_cycle=self.request_cycle,
            source_project_id=self.source_project_id,
            source_project_name=self.source_project_name,
            source_topic_id=self.source_topic_id,
            source_topic_name=self.source_topic_name,
            status=self.status,
            task_id=self.task_id,
            task_name=self.task_name,
            task_type=self.task_type,
            updated_time=self.updated_time)


def get_schedule_sql_task(id: Optional[builtins.str] = None,
                          opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetScheduleSqlTaskResult:
    """
    Data Source schema for Byteplus::TLS::ScheduleSqlTask


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('bytepluscc:tls/getScheduleSqlTask:getScheduleSqlTask', __args__, opts=opts, typ=GetScheduleSqlTaskResult).value

    return AwaitableGetScheduleSqlTaskResult(
        created_time=pulumi.get(__ret__, 'created_time'),
        description=pulumi.get(__ret__, 'description'),
        dest_project_id=pulumi.get(__ret__, 'dest_project_id'),
        dest_region=pulumi.get(__ret__, 'dest_region'),
        dest_topic_id=pulumi.get(__ret__, 'dest_topic_id'),
        dest_topic_name=pulumi.get(__ret__, 'dest_topic_name'),
        id=pulumi.get(__ret__, 'id'),
        process_end_time=pulumi.get(__ret__, 'process_end_time'),
        process_sql_delay=pulumi.get(__ret__, 'process_sql_delay'),
        process_start_time=pulumi.get(__ret__, 'process_start_time'),
        process_time_window=pulumi.get(__ret__, 'process_time_window'),
        query=pulumi.get(__ret__, 'query'),
        request_cycle=pulumi.get(__ret__, 'request_cycle'),
        source_project_id=pulumi.get(__ret__, 'source_project_id'),
        source_project_name=pulumi.get(__ret__, 'source_project_name'),
        source_topic_id=pulumi.get(__ret__, 'source_topic_id'),
        source_topic_name=pulumi.get(__ret__, 'source_topic_name'),
        status=pulumi.get(__ret__, 'status'),
        task_id=pulumi.get(__ret__, 'task_id'),
        task_name=pulumi.get(__ret__, 'task_name'),
        task_type=pulumi.get(__ret__, 'task_type'),
        updated_time=pulumi.get(__ret__, 'updated_time'))
def get_schedule_sql_task_output(id: Optional[pulumi.Input[builtins.str]] = None,
                                 opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetScheduleSqlTaskResult]:
    """
    Data Source schema for Byteplus::TLS::ScheduleSqlTask


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('bytepluscc:tls/getScheduleSqlTask:getScheduleSqlTask', __args__, opts=opts, typ=GetScheduleSqlTaskResult)
    return __ret__.apply(lambda __response__: GetScheduleSqlTaskResult(
        created_time=pulumi.get(__response__, 'created_time'),
        description=pulumi.get(__response__, 'description'),
        dest_project_id=pulumi.get(__response__, 'dest_project_id'),
        dest_region=pulumi.get(__response__, 'dest_region'),
        dest_topic_id=pulumi.get(__response__, 'dest_topic_id'),
        dest_topic_name=pulumi.get(__response__, 'dest_topic_name'),
        id=pulumi.get(__response__, 'id'),
        process_end_time=pulumi.get(__response__, 'process_end_time'),
        process_sql_delay=pulumi.get(__response__, 'process_sql_delay'),
        process_start_time=pulumi.get(__response__, 'process_start_time'),
        process_time_window=pulumi.get(__response__, 'process_time_window'),
        query=pulumi.get(__response__, 'query'),
        request_cycle=pulumi.get(__response__, 'request_cycle'),
        source_project_id=pulumi.get(__response__, 'source_project_id'),
        source_project_name=pulumi.get(__response__, 'source_project_name'),
        source_topic_id=pulumi.get(__response__, 'source_topic_id'),
        source_topic_name=pulumi.get(__response__, 'source_topic_name'),
        status=pulumi.get(__response__, 'status'),
        task_id=pulumi.get(__response__, 'task_id'),
        task_name=pulumi.get(__response__, 'task_name'),
        task_type=pulumi.get(__response__, 'task_type'),
        updated_time=pulumi.get(__response__, 'updated_time')))
