"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.AppHostingTraffic = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Controls traffic configuration for a backend.
 *
 * ## Example Usage
 *
 * ### Firebase App Hosting Traffic Target
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * //## Include these blocks only once per project if you are starting from scratch ###
 * const serviceAccount = new gcp.serviceaccount.Account("service_account", {
 *     project: "my-project-name",
 *     accountId: "firebase-app-hosting-compute",
 *     displayName: "Firebase App Hosting compute service account",
 *     createIgnoreAlreadyExists: true,
 * });
 * const fah = new gcp.projects.Service("fah", {
 *     project: "my-project-name",
 *     service: "firebaseapphosting.googleapis.com",
 * });
 * const exampleAppHostingBackend = new gcp.firebase.AppHostingBackend("example", {
 *     project: "my-project-name",
 *     location: "asia-east1",
 *     backendId: "traffic-tg",
 *     appId: "1:0000000000:web:674cde32020e16fbce9dbd",
 *     servingLocality: "GLOBAL_ACCESS",
 *     serviceAccount: serviceAccount.email,
 * }, {
 *     dependsOn: [fah],
 * });
 * const exampleAppHostingBuild = new gcp.firebase.AppHostingBuild("example", {
 *     project: exampleAppHostingBackend.project,
 *     location: exampleAppHostingBackend.location,
 *     backend: exampleAppHostingBackend.backendId,
 *     buildId: "target-build",
 *     source: {
 *         container: {
 *             image: "us-docker.pkg.dev/cloudrun/container/hello",
 *         },
 *     },
 * });
 * const example = new gcp.firebase.AppHostingTraffic("example", {
 *     project: exampleAppHostingBackend.project,
 *     location: exampleAppHostingBackend.location,
 *     backend: exampleAppHostingBackend.backendId,
 *     target: {
 *         splits: [{
 *             build: exampleAppHostingBuild.name,
 *             percent: 100,
 *         }],
 *     },
 * });
 * const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", {
 *     project: "my-project-name",
 *     role: "roles/firebaseapphosting.computeRunner",
 *     member: serviceAccount.member,
 * });
 * ```
 * ### Firebase App Hosting Traffic Rollout Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * //## Include these blocks only once per project if you are starting from scratch ###
 * const serviceAccount = new gcp.serviceaccount.Account("service_account", {
 *     project: "my-project-name",
 *     accountId: "firebase-app-hosting-compute",
 *     displayName: "Firebase App Hosting compute service account",
 *     createIgnoreAlreadyExists: true,
 * });
 * const fah = new gcp.projects.Service("fah", {
 *     project: "my-project-name",
 *     service: "firebaseapphosting.googleapis.com",
 * });
 * const exampleAppHostingBackend = new gcp.firebase.AppHostingBackend("example", {
 *     project: "my-project-name",
 *     location: "asia-east1",
 *     backendId: "traffic-rp",
 *     appId: "1:0000000000:web:674cde32020e16fbce9dbd",
 *     servingLocality: "GLOBAL_ACCESS",
 *     serviceAccount: serviceAccount.email,
 * }, {
 *     dependsOn: [fah],
 * });
 * const example = new gcp.firebase.AppHostingTraffic("example", {
 *     project: exampleAppHostingBackend.project,
 *     location: exampleAppHostingBackend.location,
 *     backend: exampleAppHostingBackend.backendId,
 *     rolloutPolicy: {
 *         codebaseBranch: "main",
 *     },
 * });
 * const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", {
 *     project: "my-project-name",
 *     role: "roles/firebaseapphosting.computeRunner",
 *     member: serviceAccount.member,
 * });
 * ```
 * ### Firebase App Hosting Traffic Rollout Policy Disabled
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * //## Include these blocks only once per project if you are starting from scratch ###
 * const serviceAccount = new gcp.serviceaccount.Account("service_account", {
 *     project: "my-project-name",
 *     accountId: "firebase-app-hosting-compute",
 *     displayName: "Firebase App Hosting compute service account",
 *     createIgnoreAlreadyExists: true,
 * });
 * const fah = new gcp.projects.Service("fah", {
 *     project: "my-project-name",
 *     service: "firebaseapphosting.googleapis.com",
 * });
 * const exampleAppHostingBackend = new gcp.firebase.AppHostingBackend("example", {
 *     project: "my-project-name",
 *     location: "asia-east1",
 *     backendId: "traffic-rpd",
 *     appId: "1:0000000000:web:674cde32020e16fbce9dbd",
 *     servingLocality: "GLOBAL_ACCESS",
 *     serviceAccount: serviceAccount.email,
 * }, {
 *     dependsOn: [fah],
 * });
 * const example = new gcp.firebase.AppHostingTraffic("example", {
 *     project: exampleAppHostingBackend.project,
 *     location: exampleAppHostingBackend.location,
 *     backend: exampleAppHostingBackend.backendId,
 *     rolloutPolicy: {
 *         disabled: true,
 *         codebaseBranch: "main",
 *     },
 * });
 * const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", {
 *     project: "my-project-name",
 *     role: "roles/firebaseapphosting.computeRunner",
 *     member: serviceAccount.member,
 * });
 * ```
 *
 * ## Import
 *
 * Traffic can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/backends/{{backend}}/traffic`
 *
 * * `{{project}}/{{location}}/{{backend}}`
 *
 * * `{{location}}/{{backend}}`
 *
 * When using the `pulumi import` command, Traffic can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:firebase/appHostingTraffic:AppHostingTraffic default projects/{{project}}/locations/{{location}}/backends/{{backend}}/traffic
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firebase/appHostingTraffic:AppHostingTraffic default {{project}}/{{location}}/{{backend}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firebase/appHostingTraffic:AppHostingTraffic default {{location}}/{{backend}}
 * ```
 */
class AppHostingTraffic extends pulumi.CustomResource {
    /**
     * Get an existing AppHostingTraffic 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 AppHostingTraffic(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of AppHostingTraffic.  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'] === AppHostingTraffic.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["backend"] = state?.backend;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["currents"] = state?.currents;
            resourceInputs["deleteTime"] = state?.deleteTime;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["rolloutPolicy"] = state?.rolloutPolicy;
            resourceInputs["target"] = state?.target;
            resourceInputs["uid"] = state?.uid;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.backend === undefined && !opts.urn) {
                throw new Error("Missing required property 'backend'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            resourceInputs["backend"] = args?.backend;
            resourceInputs["location"] = args?.location;
            resourceInputs["project"] = args?.project;
            resourceInputs["rolloutPolicy"] = args?.rolloutPolicy;
            resourceInputs["target"] = args?.target;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["currents"] = undefined /*out*/;
            resourceInputs["deleteTime"] = undefined /*out*/;
            resourceInputs["etag"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(AppHostingTraffic.__pulumiType, name, resourceInputs, opts);
    }
}
exports.AppHostingTraffic = AppHostingTraffic;
/** @internal */
AppHostingTraffic.__pulumiType = 'gcp:firebase/appHostingTraffic:AppHostingTraffic';
//# sourceMappingURL=appHostingTraffic.js.map