"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.AppHostingBackend = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A Backend is the primary resource of App Hosting.
 *
 * ## Example Usage
 *
 * ### Firebase App Hosting Backend Minimal
 *
 * ```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 example = new gcp.firebase.AppHostingBackend("example", {
 *     project: "my-project-name",
 *     location: "us-central1",
 *     backendId: "mini",
 *     appId: "1:0000000000:web:674cde32020e16fbce9dbd",
 *     servingLocality: "GLOBAL_ACCESS",
 *     serviceAccount: serviceAccount.email,
 * }, {
 *     dependsOn: [fah],
 * });
 * const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", {
 *     project: "my-project-name",
 *     role: "roles/firebaseapphosting.computeRunner",
 *     member: serviceAccount.member,
 * });
 * ```
 * ### Firebase App Hosting Backend Full
 *
 * ```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 example = new gcp.firebase.AppHostingBackend("example", {
 *     project: "my-project-name",
 *     location: "us-central1",
 *     backendId: "full",
 *     appId: "1:0000000000:web:674cde32020e16fbce9dbd",
 *     displayName: "My Backend",
 *     servingLocality: "GLOBAL_ACCESS",
 *     serviceAccount: serviceAccount.email,
 *     environment: "prod",
 *     annotations: {
 *         key: "value",
 *     },
 *     labels: {
 *         key: "value",
 *     },
 * }, {
 *     dependsOn: [fah],
 * });
 * const appHostingSaDeveloperconnect = new gcp.projects.IAMMember("app_hosting_sa_developerconnect", {
 *     project: "my-project-name",
 *     role: "roles/developerconnect.readTokenAccessor",
 *     member: serviceAccount.member,
 * });
 * const appHostingSaAdminsdk = new gcp.projects.IAMMember("app_hosting_sa_adminsdk", {
 *     project: "my-project-name",
 *     role: "roles/firebase.sdkAdminServiceAgent",
 *     member: serviceAccount.member,
 * });
 * const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", {
 *     project: "my-project-name",
 *     role: "roles/firebaseapphosting.computeRunner",
 *     member: serviceAccount.member,
 * });
 * ```
 * ### Firebase App Hosting Backend Github
 *
 * ```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 devconnect_p4sa = new gcp.projects.ServiceIdentity("devconnect-p4sa", {
 *     project: "my-project-name",
 *     service: "developerconnect.googleapis.com",
 * });
 * const devconnect_secret = new gcp.projects.IAMMember("devconnect-secret", {
 *     project: "my-project-name",
 *     role: "roles/secretmanager.admin",
 *     member: devconnect_p4sa.member,
 * });
 * //##
 * //## Include these blocks only once per Github account ###
 * const my_connection = new gcp.developerconnect.Connection("my-connection", {
 *     project: "my-project-name",
 *     location: "us-central1",
 *     connectionId: "tf-test-connection-new",
 *     githubConfig: {
 *         githubApp: "FIREBASE",
 *     },
 * }, {
 *     dependsOn: [devconnect_secret],
 * });
 * const my_repository = new gcp.developerconnect.GitRepositoryLink("my-repository", {
 *     project: "my-project-name",
 *     location: "us-central1",
 *     gitRepositoryLinkId: "my-repo",
 *     parentConnection: my_connection.connectionId,
 *     cloneUri: "https://github.com/myuser/myrepo.git",
 * });
 * const example = new gcp.firebase.AppHostingBackend("example", {
 *     project: "my-project-name",
 *     location: "us-central1",
 *     backendId: "my-backend-gh",
 *     appId: "1:0000000000:web:674cde32020e16fbce9dbd",
 *     displayName: "My Backend",
 *     servingLocality: "GLOBAL_ACCESS",
 *     serviceAccount: "firebase-app-hosting-compute@my-project-name.iam.gserviceaccount.com",
 *     environment: "prod",
 *     annotations: {
 *         key: "value",
 *     },
 *     labels: {
 *         key: "value",
 *     },
 *     codebase: {
 *         repository: my_repository.name,
 *         rootDirectory: "/",
 *     },
 * });
 * export const nextSteps = my_connection.installationStates;
 * ```
 *
 * ## Import
 *
 * Backend can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/backends/{{backend_id}}`
 *
 * * `{{project}}/{{location}}/{{backend_id}}`
 *
 * * `{{location}}/{{backend_id}}`
 *
 * When using the `pulumi import` command, Backend can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:firebase/appHostingBackend:AppHostingBackend default projects/{{project}}/locations/{{location}}/backends/{{backend_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firebase/appHostingBackend:AppHostingBackend default {{project}}/{{location}}/{{backend_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firebase/appHostingBackend:AppHostingBackend default {{location}}/{{backend_id}}
 * ```
 */
class AppHostingBackend extends pulumi.CustomResource {
    /**
     * Get an existing AppHostingBackend 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 AppHostingBackend(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of AppHostingBackend.  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'] === AppHostingBackend.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["annotations"] = state?.annotations;
            resourceInputs["appId"] = state?.appId;
            resourceInputs["backendId"] = state?.backendId;
            resourceInputs["codebase"] = state?.codebase;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["deleteTime"] = state?.deleteTime;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["environment"] = state?.environment;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["location"] = state?.location;
            resourceInputs["managedResources"] = state?.managedResources;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["serviceAccount"] = state?.serviceAccount;
            resourceInputs["servingLocality"] = state?.servingLocality;
            resourceInputs["uid"] = state?.uid;
            resourceInputs["updateTime"] = state?.updateTime;
            resourceInputs["uri"] = state?.uri;
        }
        else {
            const args = argsOrState;
            if (args?.appId === undefined && !opts.urn) {
                throw new Error("Missing required property 'appId'");
            }
            if (args?.backendId === undefined && !opts.urn) {
                throw new Error("Missing required property 'backendId'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.serviceAccount === undefined && !opts.urn) {
                throw new Error("Missing required property 'serviceAccount'");
            }
            if (args?.servingLocality === undefined && !opts.urn) {
                throw new Error("Missing required property 'servingLocality'");
            }
            resourceInputs["annotations"] = args?.annotations;
            resourceInputs["appId"] = args?.appId;
            resourceInputs["backendId"] = args?.backendId;
            resourceInputs["codebase"] = args?.codebase;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["environment"] = args?.environment;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["location"] = args?.location;
            resourceInputs["project"] = args?.project;
            resourceInputs["serviceAccount"] = args?.serviceAccount;
            resourceInputs["servingLocality"] = args?.servingLocality;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["deleteTime"] = undefined /*out*/;
            resourceInputs["effectiveAnnotations"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["etag"] = undefined /*out*/;
            resourceInputs["managedResources"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
            resourceInputs["uri"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(AppHostingBackend.__pulumiType, name, resourceInputs, opts);
    }
}
exports.AppHostingBackend = AppHostingBackend;
/** @internal */
AppHostingBackend.__pulumiType = 'gcp:firebase/appHostingBackend:AppHostingBackend';
//# sourceMappingURL=appHostingBackend.js.map