UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

95 lines 3.81 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ProjectMetadataItem = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a single key/value pair on metadata common to all instances for * a project in GCE. Using `gcp.compute.ProjectMetadataItem` lets you * manage a single key/value setting in the provider rather than the entire * project metadata map. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.ProjectMetadataItem("default", { * key: "my_metadata", * value: "my_value", * }); * ``` * * ## Import * * Project metadata items can be imported using the `key`, e.g. * * * `{{key}}` * * * `projects/{{project}}/meta-data/{{key}}` * * When using the `pulumi import` command, project metadata items can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/projectMetadataItem:ProjectMetadataItem default {{key}} * ``` * * ```sh * $ pulumi import gcp:compute/projectMetadataItem:ProjectMetadataItem default projects/{{project}}/meta-data/{{key}} * ``` */ class ProjectMetadataItem extends pulumi.CustomResource { /** * Get an existing ProjectMetadataItem 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 ProjectMetadataItem(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ProjectMetadataItem. 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'] === ProjectMetadataItem.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["key"] = state ? state.key : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["value"] = state ? state.value : undefined; } else { const args = argsOrState; if ((!args || args.key === undefined) && !opts.urn) { throw new Error("Missing required property 'key'"); } if ((!args || args.value === undefined) && !opts.urn) { throw new Error("Missing required property 'value'"); } resourceInputs["key"] = args ? args.key : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["value"] = args ? args.value : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ProjectMetadataItem.__pulumiType, name, resourceInputs, opts); } } exports.ProjectMetadataItem = ProjectMetadataItem; /** @internal */ ProjectMetadataItem.__pulumiType = 'gcp:compute/projectMetadataItem:ProjectMetadataItem'; //# sourceMappingURL=projectMetadataItem.js.map