UNPKG

@pulumi/gcp

Version:

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

96 lines 3.9 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! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ServiceIdentity = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Generate service identity for a service. * * > **Note:** Once created, this resource cannot be updated or destroyed. These * actions are a no-op. * * > **Note:** This resource can be used to retrieve the emails of the [Google-managed service accounts](https://cloud.google.com/iam/docs/service-agents) * of the APIs that Google has configured with a Service Identity. You can run `gcloud beta services identity create --service SERVICE_NAME.googleapis.com` to * verify if an API supports this. * * To get more information about Service Identity, see: * * * [API documentation](https://cloud.google.com/service-usage/docs/reference/rest/v1beta1/services/generateServiceIdentity) * * ## Example Usage * * ### Service Identity Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const hcSa = new gcp.projects.ServiceIdentity("hc_sa", { * project: project.then(project => project.projectId), * service: "healthcare.googleapis.com", * }); * const hcSaBqJobuser = new gcp.projects.IAMMember("hc_sa_bq_jobuser", { * project: project.then(project => project.projectId), * role: "roles/bigquery.jobUser", * member: hcSa.member, * }); * ``` * * ## Import * * This resource does not support import. */ class ServiceIdentity extends pulumi.CustomResource { /** * Get an existing ServiceIdentity 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 ServiceIdentity(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ServiceIdentity. 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'] === ServiceIdentity.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["email"] = state?.email; resourceInputs["member"] = state?.member; resourceInputs["project"] = state?.project; resourceInputs["service"] = state?.service; } else { const args = argsOrState; if (args?.service === undefined && !opts.urn) { throw new Error("Missing required property 'service'"); } resourceInputs["project"] = args?.project; resourceInputs["service"] = args?.service; resourceInputs["email"] = undefined /*out*/; resourceInputs["member"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ServiceIdentity.__pulumiType, name, resourceInputs, opts); } } exports.ServiceIdentity = ServiceIdentity; /** @internal */ ServiceIdentity.__pulumiType = 'gcp:projects/serviceIdentity:ServiceIdentity'; //# sourceMappingURL=serviceIdentity.js.map