<gh_stars>0// *** 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! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
using Pulumi;

namespace TencentCloudIAC.PulumiPackage.Tencentcloud.Scf
{
    public static class GetLogs
    {
        /// <summary>
        /// Use this data source to query SCF function logs.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using Pulumi;
        /// using Tencentcloud = Pulumi.Tencentcloud;
        /// using Tencentcloud = TencentCloudIAC.PulumiPackage.Tencentcloud;
        /// 
        /// class MyStack : Stack
        /// {
        ///     public MyStack()
        ///     {
        ///         var fooFunction = new Tencentcloud.Scf.Function("fooFunction", new Tencentcloud.Scf.FunctionArgs
        ///         {
        ///             Handler = "main.do_it",
        ///             Runtime = "Python3.6",
        ///             CosBucketName = "scf-code-1234567890",
        ///             CosObjectName = "code.zip",
        ///             CosBucketRegion = "ap-guangzhou",
        ///         });
        ///         var fooLogs = Tencentcloud.Scf.GetLogs.Invoke(new Tencentcloud.Scf.GetLogsInvokeArgs
        ///         {
        ///             FunctionName = fooFunction.Name,
        ///         });
        ///     }
        /// 
        /// }
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetLogsResult> InvokeAsync(GetLogsArgs args, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.InvokeAsync<GetLogsResult>("tencentcloud:Scf/getLogs:getLogs", args ?? new GetLogsArgs(), options.WithDefaults());

        /// <summary>
        /// Use this data source to query SCF function logs.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using Pulumi;
        /// using Tencentcloud = Pulumi.Tencentcloud;
        /// using Tencentcloud = TencentCloudIAC.PulumiPackage.Tencentcloud;
        /// 
        /// class MyStack : Stack
        /// {
        ///     public MyStack()
        ///     {
        ///         var fooFunction = new Tencentcloud.Scf.Function("fooFunction", new Tencentcloud.Scf.FunctionArgs
        ///         {
        ///             Handler = "main.do_it",
        ///             Runtime = "Python3.6",
        ///             CosBucketName = "scf-code-1234567890",
        ///             CosObjectName = "code.zip",
        ///             CosBucketRegion = "ap-guangzhou",
        ///         });
        ///         var fooLogs = Tencentcloud.Scf.GetLogs.Invoke(new Tencentcloud.Scf.GetLogsInvokeArgs
        ///         {
        ///             FunctionName = fooFunction.Name,
        ///         });
        ///     }
        /// 
        /// }
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetLogsResult> Invoke(GetLogsInvokeArgs args, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.Invoke<GetLogsResult>("tencentcloud:Scf/getLogs:getLogs", args ?? new GetLogsInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetLogsArgs : Pulumi.InvokeArgs
    {
        /// <summary>
        /// The end time of the query, the format is `2017-05-16 20:00:00`, which can only be within one day from `start_time`.
        /// </summary>
        [Input("endTime")]
        public string? EndTime { get; set; }

        /// <summary>
        /// Name of the SCF function to be queried.
        /// </summary>
        [Input("functionName", required: true)]
        public string FunctionName { get; set; } = null!;

        /// <summary>
        /// Corresponding requestId when executing function.
        /// </summary>
        [Input("invokeRequestId")]
        public string? InvokeRequestId { get; set; }

        /// <summary>
        /// Number of logs, the default is `10000`, offset+limit cannot be greater than 10000.
        /// </summary>
        [Input("limit")]
        public int? Limit { get; set; }

        /// <summary>
        /// Namespace of the SCF function to be queried.
        /// </summary>
        [Input("namespace")]
        public string? Namespace { get; set; }

        /// <summary>
        /// Log offset, default is `0`, offset+limit cannot be greater than 10000.
        /// </summary>
        [Input("offset")]
        public int? Offset { get; set; }

        /// <summary>
        /// Order to sort the log, optional values `desc` and `asc`, default `desc`.
        /// </summary>
        [Input("order")]
        public string? Order { get; set; }

        /// <summary>
        /// Sort the logs according to the following fields: `function_name`, `duration`, `mem_usage`, `start_time`, default `start_time`.
        /// </summary>
        [Input("orderBy")]
        public string? OrderBy { get; set; }

        /// <summary>
        /// Used to save results.
        /// </summary>
        [Input("resultOutputFile")]
        public string? ResultOutputFile { get; set; }

        /// <summary>
        /// Use to filter log, optional value: `not0` only returns the error log. `is0` only returns the correct log. `TimeLimitExceeded` returns the log of the function call timeout. `ResourceLimitExceeded` returns the function call generation resource overrun log. `UserCodeException` returns logs of the user code error that occurred in the function call. Not passing the parameter means returning all logs.
        /// </summary>
        [Input("retCode")]
        public string? RetCode { get; set; }

        /// <summary>
        /// The start time of the query, the format is `2017-05-16 20:00:00`, which can only be within one day from `end_time`.
        /// </summary>
        [Input("startTime")]
        public string? StartTime { get; set; }

        public GetLogsArgs()
        {
        }
    }

    public sealed class GetLogsInvokeArgs : Pulumi.InvokeArgs
    {
        /// <summary>
        /// The end time of the query, the format is `2017-05-16 20:00:00`, which can only be within one day from `start_time`.
        /// </summary>
        [Input("endTime")]
        public Input<string>? EndTime { get; set; }

        /// <summary>
        /// Name of the SCF function to be queried.
        /// </summary>
        [Input("functionName", required: true)]
        public Input<string> FunctionName { get; set; } = null!;

        /// <summary>
        /// Corresponding requestId when executing function.
        /// </summary>
        [Input("invokeRequestId")]
        public Input<string>? InvokeRequestId { get; set; }

        /// <summary>
        /// Number of logs, the default is `10000`, offset+limit cannot be greater than 10000.
        /// </summary>
        [Input("limit")]
        public Input<int>? Limit { get; set; }

        /// <summary>
        /// Namespace of the SCF function to be queried.
        /// </summary>
        [Input("namespace")]
        public Input<string>? Namespace { get; set; }

        /// <summary>
        /// Log offset, default is `0`, offset+limit cannot be greater than 10000.
        /// </summary>
        [Input("offset")]
        public Input<int>? Offset { get; set; }

        /// <summary>
        /// Order to sort the log, optional values `desc` and `asc`, default `desc`.
        /// </summary>
        [Input("order")]
        public Input<string>? Order { get; set; }

        /// <summary>
        /// Sort the logs according to the following fields: `function_name`, `duration`, `mem_usage`, `start_time`, default `start_time`.
        /// </summary>
        [Input("orderBy")]
        public Input<string>? OrderBy { get; set; }

        /// <summary>
        /// Used to save results.
        /// </summary>
        [Input("resultOutputFile")]
        public Input<string>? ResultOutputFile { get; set; }

        /// <summary>
        /// Use to filter log, optional value: `not0` only returns the error log. `is0` only returns the correct log. `TimeLimitExceeded` returns the log of the function call timeout. `ResourceLimitExceeded` returns the function call generation resource overrun log. `UserCodeException` returns logs of the user code error that occurred in the function call. Not passing the parameter means returning all logs.
        /// </summary>
        [Input("retCode")]
        public Input<string>? RetCode { get; set; }

        /// <summary>
        /// The start time of the query, the format is `2017-05-16 20:00:00`, which can only be within one day from `end_time`.
        /// </summary>
        [Input("startTime")]
        public Input<string>? StartTime { get; set; }

        public GetLogsInvokeArgs()
        {
        }
    }


    [OutputType]
    public sealed class GetLogsResult
    {
        public readonly string? EndTime;
        /// <summary>
        /// Name of the SCF function.
        /// </summary>
        public readonly string FunctionName;
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        public readonly string? InvokeRequestId;
        public readonly int? Limit;
        /// <summary>
        /// An information list of logs. Each element contains the following attributes:
        /// </summary>
        public readonly ImmutableArray<Outputs.GetLogsLogResult> ScfLogs;
        public readonly string? Namespace;
        public readonly int? Offset;
        public readonly string? Order;
        public readonly string? OrderBy;
        public readonly string? ResultOutputFile;
        /// <summary>
        /// Execution result of function, `0` means the execution is successful, other values indicate failure.
        /// </summary>
        public readonly string? RetCode;
        /// <summary>
        /// Point in time at which the function begins execution.
        /// </summary>
        public readonly string? StartTime;

        [OutputConstructor]
        private GetLogsResult(
            string? endTime,

            string functionName,

            string id,

            string? invokeRequestId,

            int? limit,

            ImmutableArray<Outputs.GetLogsLogResult> logs,

            string? @namespace,

            int? offset,

            string? order,

            string? orderBy,

            string? resultOutputFile,

            string? retCode,

            string? startTime)
        {
            EndTime = endTime;
            FunctionName = functionName;
            Id = id;
            InvokeRequestId = invokeRequestId;
            Limit = limit;
            ScfLogs = logs;
            Namespace = @namespace;
            Offset = offset;
            Order = order;
            OrderBy = orderBy;
            ResultOutputFile = resultOutputFile;
            RetCode = retCode;
            StartTime = startTime;
        }
    }
}
