"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pipeline = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * The Eventarc Pipeline resource
 *
 * To get more information about Pipeline, see:
 *
 * * [API documentation](https://cloud.google.com/eventarc/docs/reference/rest/v1/projects.locations.pipelines)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/eventarc/advanced/docs/receive-events/create-enrollment)
 *
 * ## Example Usage
 *
 * ### Eventarc Pipeline With Topic Destination
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const topic = new gcp.pubsub.Topic("topic", {name: "some-topic"});
 * const primary = new gcp.eventarc.Pipeline("primary", {
 *     location: "us-central1",
 *     pipelineId: "some-pipeline",
 *     destinations: [{
 *         topic: topic.id,
 *     }],
 *     labels: {
 *         test_label: "test-eventarc-label",
 *     },
 *     annotations: {
 *         test_annotation: "test-eventarc-annotation",
 *     },
 *     displayName: "Testing Pipeline",
 * });
 * ```
 * ### Eventarc Pipeline With Http Destination
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.eventarc.Pipeline("primary", {
 *     location: "us-central1",
 *     pipelineId: "some-pipeline",
 *     destinations: [{
 *         httpEndpoint: {
 *             uri: "https://10.77.0.0:80/route",
 *         },
 *         networkConfig: {
 *             networkAttachment: "projects/my-project-name/regions/us-central1/networkAttachments/some-network-attachment",
 *         },
 *     }],
 * });
 * ```
 * ### Eventarc Pipeline With Workflow Destination
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const workflow = new gcp.workflows.Workflow("workflow", {
 *     name: "some-workflow",
 *     deletionProtection: false,
 *     region: "us-central1",
 *     sourceContents: `# This is a sample workflow, feel free to replace it with your source code
 * #
 * # This workflow does the following:
 * # - reads current time and date information from an external API and stores
 * #   the response in CurrentDateTime variable
 * # - retrieves a list of Wikipedia articles related to the day of the week
 * #   from CurrentDateTime
 * # - returns the list of articles as an output of the workflow
 * # FYI, In terraform you need to escape the  or it will cause errors.
 *
 * - getCurrentTime:
 *     call: http.get
 *     args:
 *         url: \${sys.get_env(\\"url\\")}
 *     result: CurrentDateTime
 * - readWikipedia:
 *     call: http.get
 *     args:
 *         url: https://en.wikipedia.org/w/api.php
 *         query:
 *             action: opensearch
 *             search: \${CurrentDateTime.body.dayOfTheWeek}
 *     result: WikiResult
 * - returnOutput:
 *     return: \${WikiResult.body[1]}
 * `,
 * });
 * const primary = new gcp.eventarc.Pipeline("primary", {
 *     location: "us-central1",
 *     pipelineId: "some-pipeline",
 *     destinations: [{
 *         workflow: workflow.id,
 *     }],
 * });
 * ```
 * ### Eventarc Pipeline With Oidc And Json Format
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.eventarc.Pipeline("primary", {
 *     location: "us-central1",
 *     pipelineId: "some-pipeline",
 *     destinations: [{
 *         httpEndpoint: {
 *             uri: "https://10.77.0.0:80/route",
 *             messageBindingTemplate: "{\"headers\":{\"new-header-key\": \"new-header-value\"}}",
 *         },
 *         networkConfig: {
 *             networkAttachment: "projects/my-project-name/regions/us-central1/networkAttachments/some-network-attachment",
 *         },
 *         authenticationConfig: {
 *             googleOidc: {
 *                 serviceAccount: "my@service-account.com",
 *                 audience: "http://www.example.com",
 *             },
 *         },
 *         outputPayloadFormat: {
 *             json: {},
 *         },
 *     }],
 *     inputPayloadFormat: {
 *         json: {},
 *     },
 *     retryPolicy: {
 *         maxRetryDelay: "50s",
 *         maxAttempts: 2,
 *         minRetryDelay: "40s",
 *     },
 *     mediations: [{
 *         transformation: {
 *             transformationTemplate: `{
 * \\"id\\": message.id,
 * \\"datacontenttype\\": \\"application/json\\",
 * \\"data\\": \\"{ \\\\\\"scrubbed\\\\\\": \\\\\\"true\\\\\\" }\\"
 * }
 * `,
 *         },
 *     }],
 *     loggingConfig: {
 *         logSeverity: "DEBUG",
 *     },
 * });
 * ```
 * ### Eventarc Pipeline With Oauth And Protobuf Format
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.eventarc.Pipeline("primary", {
 *     location: "us-central1",
 *     pipelineId: "some-pipeline",
 *     destinations: [{
 *         httpEndpoint: {
 *             uri: "https://10.77.0.0:80/route",
 *             messageBindingTemplate: "{\"headers\":{\"new-header-key\": \"new-header-value\"}}",
 *         },
 *         networkConfig: {
 *             networkAttachment: "projects/my-project-name/regions/us-central1/networkAttachments/some-network-attachment",
 *         },
 *         authenticationConfig: {
 *             oauthToken: {
 *                 serviceAccount: "my@service-account.com",
 *                 scope: "https://www.googleapis.com/auth/cloud-platform",
 *             },
 *         },
 *         outputPayloadFormat: {
 *             protobuf: {
 *                 schemaDefinition: `syntax = \\"proto3\\";
 * message schema {
 * string name = 1;
 * string severity = 2;
 * }
 * `,
 *             },
 *         },
 *     }],
 *     inputPayloadFormat: {
 *         protobuf: {
 *             schemaDefinition: `syntax = \\"proto3\\";
 * message schema {
 * string name = 1;
 * string severity = 2;
 * }
 * `,
 *         },
 *     },
 *     retryPolicy: {
 *         maxRetryDelay: "50s",
 *         maxAttempts: 2,
 *         minRetryDelay: "40s",
 *     },
 *     mediations: [{
 *         transformation: {
 *             transformationTemplate: `{
 * \\"id\\": message.id,
 * \\"datacontenttype\\": \\"application/json\\",
 * \\"data\\": \\"{ \\\\\\"scrubbed\\\\\\": \\\\\\"true\\\\\\" }\\"
 * }
 * `,
 *         },
 *     }],
 *     loggingConfig: {
 *         logSeverity: "DEBUG",
 *     },
 * });
 * ```
 * ### Eventarc Pipeline With Cmek And Avro Format
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.eventarc.Pipeline("primary", {
 *     location: "us-central1",
 *     pipelineId: "some-pipeline",
 *     cryptoKeyName: "some-key",
 *     destinations: [{
 *         httpEndpoint: {
 *             uri: "https://10.77.0.0:80/route",
 *             messageBindingTemplate: "{\"headers\":{\"new-header-key\": \"new-header-value\"}}",
 *         },
 *         networkConfig: {
 *             networkAttachment: "projects/my-project-name/regions/us-central1/networkAttachments/some-network-attachment",
 *         },
 *         outputPayloadFormat: {
 *             avro: {
 *                 schemaDefinition: "{\"type\": \"record\", \"name\": \"my_record\", \"fields\": [{\"name\": \"my_field\", \"type\": \"string\"}]}",
 *             },
 *         },
 *     }],
 *     inputPayloadFormat: {
 *         avro: {
 *             schemaDefinition: "{\"type\": \"record\", \"name\": \"my_record\", \"fields\": [{\"name\": \"my_field\", \"type\": \"string\"}]}",
 *         },
 *     },
 *     retryPolicy: {
 *         maxRetryDelay: "50s",
 *         maxAttempts: 2,
 *         minRetryDelay: "40s",
 *     },
 *     mediations: [{
 *         transformation: {
 *             transformationTemplate: `{
 * \\"id\\": message.id,
 * \\"datacontenttype\\": \\"application/json\\",
 * \\"data\\": \\"{ \\\\\\"scrubbed\\\\\\": \\\\\\"true\\\\\\" }\\"
 * }
 * `,
 *         },
 *     }],
 *     loggingConfig: {
 *         logSeverity: "DEBUG",
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * Pipeline can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/pipelines/{{pipeline_id}}`
 *
 * * `{{project}}/{{location}}/{{pipeline_id}}`
 *
 * * `{{location}}/{{pipeline_id}}`
 *
 * When using the `pulumi import` command, Pipeline can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:eventarc/pipeline:Pipeline default projects/{{project}}/locations/{{location}}/pipelines/{{pipeline_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:eventarc/pipeline:Pipeline default {{project}}/{{location}}/{{pipeline_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:eventarc/pipeline:Pipeline default {{location}}/{{pipeline_id}}
 * ```
 */
class Pipeline extends pulumi.CustomResource {
    /**
     * Get an existing Pipeline 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 Pipeline(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Pipeline.  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'] === Pipeline.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["annotations"] = state?.annotations;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["cryptoKeyName"] = state?.cryptoKeyName;
            resourceInputs["destinations"] = state?.destinations;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["inputPayloadFormat"] = state?.inputPayloadFormat;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["location"] = state?.location;
            resourceInputs["loggingConfig"] = state?.loggingConfig;
            resourceInputs["mediations"] = state?.mediations;
            resourceInputs["name"] = state?.name;
            resourceInputs["pipelineId"] = state?.pipelineId;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["retryPolicy"] = state?.retryPolicy;
            resourceInputs["uid"] = state?.uid;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.destinations === undefined && !opts.urn) {
                throw new Error("Missing required property 'destinations'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.pipelineId === undefined && !opts.urn) {
                throw new Error("Missing required property 'pipelineId'");
            }
            resourceInputs["annotations"] = args?.annotations;
            resourceInputs["cryptoKeyName"] = args?.cryptoKeyName;
            resourceInputs["destinations"] = args?.destinations;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["inputPayloadFormat"] = args?.inputPayloadFormat;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["location"] = args?.location;
            resourceInputs["loggingConfig"] = args?.loggingConfig;
            resourceInputs["mediations"] = args?.mediations;
            resourceInputs["pipelineId"] = args?.pipelineId;
            resourceInputs["project"] = args?.project;
            resourceInputs["retryPolicy"] = args?.retryPolicy;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["effectiveAnnotations"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["etag"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(Pipeline.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Pipeline = Pipeline;
/** @internal */
Pipeline.__pulumiType = 'gcp:eventarc/pipeline:Pipeline';
//# sourceMappingURL=pipeline.js.map