UNPKG

@pulumi/gcp

Version:

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

95 lines 3.75 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.Service = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = new gcp.projects.Service("project", { * project: "your-project-id", * service: "iam.googleapis.com", * }); * ``` * * ## Import * * Project services can be imported using the `project_id` and `service`, e.g. * * * `{{project_id}}/{{service}}` * * When using the `pulumi import` command, project services can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:projects/service:Service default {{project_id}}/{{service}} * ``` * * Note that unlike other resources that fail if they already exist, * * `pulumi up` can be successfully used to verify already enabled services. * * This means that when importing existing resources into Terraform, you can either * * import the `google_project_service` resources or treat them as new * * infrastructure and run `pulumi up` to add them to state. */ class Service extends pulumi.CustomResource { /** * Get an existing Service 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 Service(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Service. 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'] === Service.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["checkIfServiceHasUsageOnDestroy"] = state?.checkIfServiceHasUsageOnDestroy; resourceInputs["disableDependentServices"] = state?.disableDependentServices; resourceInputs["disableOnDestroy"] = state?.disableOnDestroy; 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["checkIfServiceHasUsageOnDestroy"] = args?.checkIfServiceHasUsageOnDestroy; resourceInputs["disableDependentServices"] = args?.disableDependentServices; resourceInputs["disableOnDestroy"] = args?.disableOnDestroy; resourceInputs["project"] = args?.project; resourceInputs["service"] = args?.service; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Service.__pulumiType, name, resourceInputs, opts); } } exports.Service = Service; /** @internal */ Service.__pulumiType = 'gcp:projects/service:Service'; //# sourceMappingURL=service.js.map