"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.ApiKey = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * The Apikeys Key resource
 *
 * ## Example Usage
 *
 * ### Android_key
 * A basic example of a android api keys key
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.projects.ApiKey("primary", {
 *     name: "key",
 *     displayName: "sample-key",
 *     restrictions: {
 *         androidKeyRestrictions: {
 *             allowedApplications: [{
 *                 packageName: "com.example.app123",
 *                 sha1Fingerprint: "1699466a142d4682a5f91b50fdf400f2358e2b0b",
 *             }],
 *         },
 *         apiTargets: [{
 *             service: "translate.googleapis.com",
 *             methods: ["GET*"],
 *         }],
 *     },
 * });
 * ```
 * ### Basic_key
 * A basic example of a api keys key
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.projects.ApiKey("primary", {
 *     name: "key",
 *     displayName: "sample-key",
 *     restrictions: {
 *         apiTargets: [{
 *             service: "translate.googleapis.com",
 *             methods: ["GET*"],
 *         }],
 *         browserKeyRestrictions: {
 *             allowedReferrers: [".*"],
 *         },
 *     },
 * });
 * ```
 * ### Ios_key
 * A basic example of a ios api keys key
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.projects.ApiKey("primary", {
 *     name: "key",
 *     displayName: "sample-key",
 *     restrictions: {
 *         apiTargets: [{
 *             service: "translate.googleapis.com",
 *             methods: ["GET*"],
 *         }],
 *         iosKeyRestrictions: {
 *             allowedBundleIds: ["com.google.app.macos"],
 *         },
 *     },
 * });
 * ```
 * ### Minimal_key
 * A minimal example of a api keys key
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.projects.ApiKey("primary", {
 *     name: "key",
 *     displayName: "sample-key",
 * });
 * ```
 * ### Server_key
 * A basic example of a server api keys key
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primary = new gcp.projects.ApiKey("primary", {
 *     name: "key",
 *     displayName: "sample-key",
 *     restrictions: {
 *         apiTargets: [{
 *             service: "translate.googleapis.com",
 *             methods: ["GET*"],
 *         }],
 *         serverKeyRestrictions: {
 *             allowedIps: ["127.0.0.1"],
 *         },
 *     },
 * });
 * ```
 * ### Service_account_key
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const project = new gcp.organizations.Project("project", {
 *     projectId: "app",
 *     name: "app",
 *     orgId: "123456789",
 *     deletionPolicy: "DELETE",
 * });
 * const keyServiceAccount = new gcp.serviceaccount.Account("key_service_account", {
 *     accountId: "app",
 *     project: project.projectId,
 *     displayName: "Test Service Account",
 * });
 * const primary = new gcp.projects.ApiKey("primary", {
 *     name: "key",
 *     displayName: "sample-key",
 *     project: project.projectId,
 *     serviceAccountEmail: keyServiceAccount.email,
 * });
 * ```
 *
 * ## Import
 *
 * Key can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/global/keys/{{name}}`
 *
 * * `{{project}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, Key can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:projects/apiKey:ApiKey default projects/{{project}}/locations/global/keys/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:projects/apiKey:ApiKey default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:projects/apiKey:ApiKey default {{name}}
 * ```
 */
class ApiKey extends pulumi.CustomResource {
    /**
     * Get an existing ApiKey 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 ApiKey(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of ApiKey.  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'] === ApiKey.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["keyString"] = state?.keyString;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["restrictions"] = state?.restrictions;
            resourceInputs["serviceAccountEmail"] = state?.serviceAccountEmail;
            resourceInputs["uid"] = state?.uid;
        }
        else {
            const args = argsOrState;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["restrictions"] = args?.restrictions;
            resourceInputs["serviceAccountEmail"] = args?.serviceAccountEmail;
            resourceInputs["keyString"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["keyString"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(ApiKey.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ApiKey = ApiKey;
/** @internal */
ApiKey.__pulumiType = 'gcp:projects/apiKey:ApiKey';
//# sourceMappingURL=apiKey.js.map