UNPKG

@pulumi/gcp

Version:

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

174 lines 7.3 kB
"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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Owner = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * An owner is an additional user that may manage a verified web site in the * [Google Search Console](https://www.google.com/webmasters/tools/). There * are two types of web resource owners: * * * Verified owners, which are added to a web resource automatically when it * is created (i.e., when the resource is verified). A verified owner is * determined by the identity of the user requesting verification. * * Additional owners, which can be added to the resource by verified owners. * * `gcp.siteverification.Owner` creates additional owners. If your web site * was verified using the * `gcp.siteverification.WebResource` * resource then you (or the identity was used to create the resource, such as a * service account) are already an owner. * * > **Note:** The email address of the owner must belong to a Google account, * such as a Gmail account, a Google Workspace account, or a GCP service account. * * Working with site verification requires the `https://www.googleapis.com/auth/siteverification` * authentication scope. See the * Google Provider authentication documentation * to learn how to configure additional scopes. * * To get more information about site owners, see: * * * [API documentation](https://developers.google.com/site-verification/v1) * * How-to Guides * * [Getting Started](https://developers.google.com/site-verification/v1/getting_started) * * ## Example Usage * * ### Site Verification Storage Bucket * * This example uses the `FILE` verification method to verify ownership of web site hosted * in a Google Cloud Storage bucket. Ownership is proved by creating a file with a Google-provided * value in a known location. The user applying this configuration will automatically be * added as a verified owner, and the `gcp.siteverification.Owner` resource will add * `user@example.com` as an additional owner. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const bucket = new gcp.storage.Bucket("bucket", { * name: "example-storage-bucket", * location: "US", * }); * const token = gcp.siteverification.getTokenOutput({ * type: "SITE", * identifier: pulumi.interpolate`https://${bucket.name}.storage.googleapis.com/`, * verificationMethod: "FILE", * }); * const object = new gcp.storage.BucketObject("object", { * name: token.apply(token => token.token), * content: token.apply(token => `google-site-verification: ${token.token}`), * bucket: bucket.name, * }); * const publicRule = new gcp.storage.ObjectAccessControl("public_rule", { * bucket: bucket.name, * object: object.name, * role: "READER", * entity: "allUsers", * }); * const example = new gcp.siteverification.WebResource("example", { * site: { * type: token.apply(token => token.type), * identifier: token.apply(token => token.identifier), * }, * verificationMethod: token.apply(token => token.verificationMethod), * }); * const exampleOwner = new gcp.siteverification.Owner("example", { * webResourceId: example.id, * email: "user@example.com", * }); * ``` * * ## Import * * Owner can be imported using this format: * * * `webResource/{{web_resource_id}}/{{email}}` * * When using the `pulumi import` command, Site owners can be imported using the format above. For example: * * ```sh * $ pulumi import gcp:siteverification/owner:Owner default webResource/{{web_resource_id}}/{{email}} * ``` * * > **Note:** While verified owners can be successfully imported, attempting to later delete the imported resource will fail. The only way to remove * verified owners is to delete the web resource itself. */ class Owner extends pulumi.CustomResource { /** * Get an existing Owner 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 Owner(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:siteverification/owner:Owner'; /** * Returns true if the given object is an instance of Owner. 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'] === Owner.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["email"] = state?.email; resourceInputs["webResourceId"] = state?.webResourceId; } else { const args = argsOrState; if (args?.email === undefined && !opts.urn) { throw new Error("Missing required property 'email'"); } if (args?.webResourceId === undefined && !opts.urn) { throw new Error("Missing required property 'webResourceId'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["email"] = args?.email; resourceInputs["webResourceId"] = args?.webResourceId; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Owner.__pulumiType, name, resourceInputs, opts); } } exports.Owner = Owner; //# sourceMappingURL=owner.js.map