"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.EdgeCacheOrigin = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * EdgeCacheOrigin represents a HTTP-reachable backend for an EdgeCacheService.
 *
 * To get more information about EdgeCacheOrigin, see:
 *
 * * [API documentation](https://cloud.google.com/media-cdn/docs/reference/rest/v1/projects.locations.edgeCacheOrigins)
 *
 * ## Example Usage
 *
 * ### Network Services Edge Cache Origin Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.networkservices.EdgeCacheOrigin("default", {
 *     name: "my-origin",
 *     originAddress: "gs://media-edge-default",
 *     description: "The default bucket for media edge test",
 * });
 * ```
 * ### Network Services Edge Cache Origin Advanced
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const fallback = new gcp.networkservices.EdgeCacheOrigin("fallback", {
 *     name: "my-fallback",
 *     originAddress: "fallback.example.com",
 *     description: "The default bucket for media edge test",
 *     maxAttempts: 3,
 *     protocol: "HTTP",
 *     port: 80,
 *     retryConditions: [
 *         "CONNECT_FAILURE",
 *         "NOT_FOUND",
 *         "HTTP_5XX",
 *         "FORBIDDEN",
 *     ],
 *     timeout: {
 *         connectTimeout: "10s",
 *         maxAttemptsTimeout: "20s",
 *         responseTimeout: "60s",
 *         readTimeout: "5s",
 *     },
 *     originOverrideAction: {
 *         urlRewrite: {
 *             hostRewrite: "example.com",
 *         },
 *         headerAction: {
 *             requestHeadersToAdds: [{
 *                 headerName: "x-header",
 *                 headerValue: "value",
 *                 replace: true,
 *             }],
 *         },
 *     },
 *     originRedirect: {
 *         redirectConditions: [
 *             "MOVED_PERMANENTLY",
 *             "FOUND",
 *             "SEE_OTHER",
 *             "TEMPORARY_REDIRECT",
 *             "PERMANENT_REDIRECT",
 *         ],
 *     },
 * });
 * const _default = new gcp.networkservices.EdgeCacheOrigin("default", {
 *     name: "my-origin",
 *     originAddress: "gs://media-edge-default",
 *     failoverOrigin: fallback.id,
 *     description: "The default bucket for media edge test",
 *     maxAttempts: 2,
 *     labels: {
 *         a: "b",
 *     },
 *     timeout: {
 *         connectTimeout: "10s",
 *     },
 * });
 * ```
 * ### Network Services Edge Cache Origin V4auth
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
 *     secretId: "secret-name",
 *     replication: {
 *         auto: {},
 *     },
 * });
 * const secret_version_basic = new gcp.secretmanager.SecretVersion("secret-version-basic", {
 *     secret: secret_basic.id,
 *     secretData: "secret-data",
 * });
 * const _default = new gcp.networkservices.EdgeCacheOrigin("default", {
 *     name: "my-origin",
 *     originAddress: "gs://media-edge-default",
 *     description: "The default bucket for V4 authentication",
 *     awsV4Authentication: {
 *         accessKeyId: "ACCESSKEYID",
 *         secretAccessKeyVersion: secret_version_basic.id,
 *         originRegion: "auto",
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * EdgeCacheOrigin can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/global/edgeCacheOrigins/{{name}}`
 *
 * * `{{project}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, EdgeCacheOrigin can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:networkservices/edgeCacheOrigin:EdgeCacheOrigin default projects/{{project}}/locations/global/edgeCacheOrigins/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:networkservices/edgeCacheOrigin:EdgeCacheOrigin default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:networkservices/edgeCacheOrigin:EdgeCacheOrigin default {{name}}
 * ```
 */
class EdgeCacheOrigin extends pulumi.CustomResource {
    /**
     * Get an existing EdgeCacheOrigin 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 EdgeCacheOrigin(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of EdgeCacheOrigin.  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'] === EdgeCacheOrigin.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["awsV4Authentication"] = state?.awsV4Authentication;
            resourceInputs["description"] = state?.description;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["failoverOrigin"] = state?.failoverOrigin;
            resourceInputs["flexShielding"] = state?.flexShielding;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["maxAttempts"] = state?.maxAttempts;
            resourceInputs["name"] = state?.name;
            resourceInputs["originAddress"] = state?.originAddress;
            resourceInputs["originOverrideAction"] = state?.originOverrideAction;
            resourceInputs["originRedirect"] = state?.originRedirect;
            resourceInputs["port"] = state?.port;
            resourceInputs["project"] = state?.project;
            resourceInputs["protocol"] = state?.protocol;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["retryConditions"] = state?.retryConditions;
            resourceInputs["timeout"] = state?.timeout;
        }
        else {
            const args = argsOrState;
            if (args?.originAddress === undefined && !opts.urn) {
                throw new Error("Missing required property 'originAddress'");
            }
            resourceInputs["awsV4Authentication"] = args?.awsV4Authentication;
            resourceInputs["description"] = args?.description;
            resourceInputs["failoverOrigin"] = args?.failoverOrigin;
            resourceInputs["flexShielding"] = args?.flexShielding;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["maxAttempts"] = args?.maxAttempts;
            resourceInputs["name"] = args?.name;
            resourceInputs["originAddress"] = args?.originAddress;
            resourceInputs["originOverrideAction"] = args?.originOverrideAction;
            resourceInputs["originRedirect"] = args?.originRedirect;
            resourceInputs["port"] = args?.port;
            resourceInputs["project"] = args?.project;
            resourceInputs["protocol"] = args?.protocol;
            resourceInputs["retryConditions"] = args?.retryConditions;
            resourceInputs["timeout"] = args?.timeout;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(EdgeCacheOrigin.__pulumiType, name, resourceInputs, opts);
    }
}
exports.EdgeCacheOrigin = EdgeCacheOrigin;
/** @internal */
EdgeCacheOrigin.__pulumiType = 'gcp:networkservices/edgeCacheOrigin:EdgeCacheOrigin';
//# sourceMappingURL=edgeCacheOrigin.js.map