"use strict";
// *** 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Provides a resource to manage tls rule
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as volcengine from "@volcengine/pulumi";
 *
 * const fooProject = new volcengine.tls.Project("fooProject", {
 *     projectName: "tf-test-project-x",
 *     description: "tf-test-project-desc",
 *     region: "cn-guilin-boe",
 * });
 * const fooTopic = new volcengine.tls.Topic("fooTopic", {
 *     projectId: fooProject.id,
 *     topicName: "tf-test-topic-rule-x",
 *     ttl: 60,
 *     shardCount: 2,
 *     autoSplit: true,
 *     maxSplitShard: 10,
 *     enableTracking: true,
 *     timeKey: "request_time",
 *     timeFormat: "%Y-%m-%dT%H:%M:%S,%f",
 *     tags: [{
 *         key: "km",
 *         value: "vm",
 *     }],
 *     logPublicIp: true,
 *     enableHotTtl: true,
 *     hotTtl: 30,
 *     coldTtl: 30,
 *     archiveTtl: 0,
 * });
 * const fooRule = new volcengine.tls.Rule("fooRule", {
 *     topicId: fooTopic.id,
 *     ruleName: "tf-test-rule-modify",
 *     logType: "delimiter_log",
 *     logSample: "2018-05-22 15:35:53.850,INFO,XXXX",
 *     inputType: 1,
 *     extractRule: {
 *         delimiter: ",",
 *         keys: [
 *             "time",
 *             "level",
 *             "msg",
 *         ],
 *         timeKey: "time",
 *         timeFormat: "%Y-%m-%d %H:%M:%S.%f",
 *         quote: "\"",
 *         timeZone: "GMT+08:00",
 *         beginRegex: "",
 *         logRegex: "",
 *         filterKeyRegexes: [{
 *             key: "__content__",
 *             regex: ".*ERROR.*",
 *         }],
 *         unMatchUpLoadSwitch: true,
 *         unMatchLogKey: "LogParseFailed",
 *         logTemplate: {
 *             type: "",
 *             format: "",
 *         },
 *     },
 *     userDefineRule: {
 *         enableRawLog: true,
 *         tailFiles: true,
 *         fields: {
 *             cluster_id: "dabaad5f-7a10-4771-b3ea-d821f73e****",
 *         },
 *         parsePathRule: {
 *             pathSample: "/data/nginx/log/dabaad5f-7a10/tls/app.log",
 *             regex: "\\/data\\/nginx\\/log\\/(\\w+)-(\\w+)\\/tls\\/app\\.log",
 *             keys: [
 *                 "instance-id",
 *                 "pod-name",
 *             ],
 *         },
 *         shardHashKey: {
 *             hashKey: "3C",
 *         },
 *         plugin: {
 *             processors: [JSON.stringify({
 *                 json: {
 *                     field: "__content__",
 *                     trim_keys: {
 *                         mode: "all",
 *                         chars: "#",
 *                     },
 *                     trim_values: {
 *                         mode: "all",
 *                         chars: "#t",
 *                     },
 *                     allow_overwrite_keys: true,
 *                     allow_empty_values: true,
 *                 },
 *             })],
 *         },
 *         advanced: {
 *             closeInactive: 10,
 *             closeRemoved: false,
 *             closeRenamed: false,
 *             closeEof: false,
 *             closeTimeout: 1,
 *         },
 *     },
 *     containerRule: {
 *         stream: "all",
 *         containerNameRegex: ".*test.*",
 *         includeContainerLabelRegex: {
 *             Key1: "Value1221",
 *             Key2: "Value223q",
 *         },
 *         excludeContainerLabelRegex: {
 *             Key1: "Value312q",
 *             Key2: "Valu5e22q",
 *         },
 *         includeContainerEnvRegex: {
 *             Key1: "Val2ue1q",
 *             Key2: "Val2ue2q",
 *         },
 *         excludeContainerEnvRegex: {
 *             Key1: "Value1q",
 *             Key2: "Value2q",
 *         },
 *         envTag: {
 *             Key1: "Value1q",
 *             Key2: "Value2q",
 *         },
 *         kubernetesRule: {
 *             namespaceNameRegex: ".*test.*",
 *             workloadType: "Deployment",
 *             workloadNameRegex: ".*test.*",
 *             includePodLabelRegex: {
 *                 Key1: "Value1",
 *                 Key2: "Value2",
 *             },
 *             excludePodLabelRegex: {
 *                 Key1: "Value1",
 *                 Key2: "Value2",
 *             },
 *             podNameRegex: ".*test.*",
 *             labelTag: {
 *                 Key1: "Value1q",
 *                 Key2: "Value2q",
 *             },
 *             annotationTag: {
 *                 Key1: "Value1q",
 *                 Key2: "Value2q",
 *             },
 *         },
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * tls rule can be imported using the id, e.g.
 *
 * ```sh
 * $ pulumi import volcengine:tls/rule:Rule default fa************
 * ```
 */
class Rule extends pulumi.CustomResource {
    /**
     * Get an existing Rule resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new Rule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of Rule.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === Rule.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["containerRule"] = state ? state.containerRule : undefined;
            resourceInputs["excludePaths"] = state ? state.excludePaths : undefined;
            resourceInputs["extractRule"] = state ? state.extractRule : undefined;
            resourceInputs["inputType"] = state ? state.inputType : undefined;
            resourceInputs["logSample"] = state ? state.logSample : undefined;
            resourceInputs["logType"] = state ? state.logType : undefined;
            resourceInputs["paths"] = state ? state.paths : undefined;
            resourceInputs["ruleId"] = state ? state.ruleId : undefined;
            resourceInputs["ruleName"] = state ? state.ruleName : undefined;
            resourceInputs["topicId"] = state ? state.topicId : undefined;
            resourceInputs["userDefineRule"] = state ? state.userDefineRule : undefined;
        }
        else {
            const args = argsOrState;
            if ((!args || args.ruleName === undefined) && !opts.urn) {
                throw new Error("Missing required property 'ruleName'");
            }
            if ((!args || args.topicId === undefined) && !opts.urn) {
                throw new Error("Missing required property 'topicId'");
            }
            resourceInputs["containerRule"] = args ? args.containerRule : undefined;
            resourceInputs["excludePaths"] = args ? args.excludePaths : undefined;
            resourceInputs["extractRule"] = args ? args.extractRule : undefined;
            resourceInputs["inputType"] = args ? args.inputType : undefined;
            resourceInputs["logSample"] = args ? args.logSample : undefined;
            resourceInputs["logType"] = args ? args.logType : undefined;
            resourceInputs["paths"] = args ? args.paths : undefined;
            resourceInputs["ruleName"] = args ? args.ruleName : undefined;
            resourceInputs["topicId"] = args ? args.topicId : undefined;
            resourceInputs["userDefineRule"] = args ? args.userDefineRule : undefined;
            resourceInputs["ruleId"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Rule.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Rule = Rule;
/** @internal */
Rule.__pulumiType = 'volcengine:tls/rule:Rule';
//# sourceMappingURL=rule.js.map