UNPKG

@pulumi/gcp

Version:

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

173 lines 7.87 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.RuntimeProjectAttachment = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Runtime project attachment represents an attachment from the runtime project to the host project. API Hub looks for deployments in the attached runtime projects and creates corresponding resources in API Hub for the discovered deployments. * * ## Example Usage * * ### Apihub Runtime Project Attachment Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as time from "@pulumiverse/time"; * * const hostProject = new gcp.organizations.Project("host_project", { * name: "h-ah-proj", * projectId: "h-ah-proj", * orgId: "123456789", * billingAccount: "000000-0000000-0000000-000000", * deletionPolicy: "DELETE", * }); * const wait60Seconds = new time.Sleep("wait_60_seconds", {createDuration: "60s"}, { * dependsOn: [hostProject], * }); * // Enable API hub API on host project * const apihubService = new gcp.projects.Service("apihub_service", { * project: hostProject.projectId, * service: "apihub.googleapis.com", * }, { * dependsOn: [wait60Seconds], * }); * const hostProjectReg = new gcp.apihub.HostProjectRegistration("host_project_reg", { * project: hostProject.projectId, * location: "asia-south1", * hostProjectRegistrationId: hostProject.projectId, * gcpProject: pulumi.interpolate`projects/${hostProject.projectId}`, * }, { * dependsOn: [apihubService], * }); * const runtimeProject = new gcp.organizations.Project("runtime_project", { * name: "r-ah-proj", * projectId: "r-ah-proj", * orgId: "123456789", * billingAccount: "000000-0000000-0000000-000000", * deletionPolicy: "DELETE", * }); * // Enable API hub API on runtime project * const apihubServiceRuntime = new gcp.projects.Service("apihub_service_runtime", { * project: runtimeProject.projectId, * service: "apihub.googleapis.com", * }, { * dependsOn: [wait60Seconds], * }); * const apihubRuntimeProjectAttachment = new gcp.apihub.RuntimeProjectAttachment("apihub_runtime_project_attachment", { * project: hostProject.projectId, * location: "asia-south1", * runtimeProjectAttachmentId: runtimeProject.projectId, * runtimeProject: pulumi.interpolate`projects/${runtimeProject.projectId}`, * }, { * dependsOn: [ * hostProjectReg, * apihubServiceRuntime, * ], * }); * ``` * * ## Import * * RuntimeProjectAttachment can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/runtimeProjectAttachments/{{runtime_project_attachment_id}}` * * `{{project}}/{{location}}/{{runtime_project_attachment_id}}` * * `{{location}}/{{runtime_project_attachment_id}}` * * When using the `pulumi import` command, RuntimeProjectAttachment can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:apihub/runtimeProjectAttachment:RuntimeProjectAttachment default projects/{{project}}/locations/{{location}}/runtimeProjectAttachments/{{runtime_project_attachment_id}} * $ pulumi import gcp:apihub/runtimeProjectAttachment:RuntimeProjectAttachment default {{project}}/{{location}}/{{runtime_project_attachment_id}} * $ pulumi import gcp:apihub/runtimeProjectAttachment:RuntimeProjectAttachment default {{location}}/{{runtime_project_attachment_id}} * ``` */ class RuntimeProjectAttachment extends pulumi.CustomResource { /** * Get an existing RuntimeProjectAttachment 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 RuntimeProjectAttachment(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:apihub/runtimeProjectAttachment:RuntimeProjectAttachment'; /** * Returns true if the given object is an instance of RuntimeProjectAttachment. 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'] === RuntimeProjectAttachment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createTime"] = state?.createTime; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["runtimeProject"] = state?.runtimeProject; resourceInputs["runtimeProjectAttachmentId"] = state?.runtimeProjectAttachmentId; } else { const args = argsOrState; if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } if (args?.runtimeProject === undefined && !opts.urn) { throw new Error("Missing required property 'runtimeProject'"); } if (args?.runtimeProjectAttachmentId === undefined && !opts.urn) { throw new Error("Missing required property 'runtimeProjectAttachmentId'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["location"] = args?.location; resourceInputs["project"] = args?.project; resourceInputs["runtimeProject"] = args?.runtimeProject; resourceInputs["runtimeProjectAttachmentId"] = args?.runtimeProjectAttachmentId; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RuntimeProjectAttachment.__pulumiType, name, resourceInputs, opts); } } exports.RuntimeProjectAttachment = RuntimeProjectAttachment; //# sourceMappingURL=runtimeProjectAttachment.js.map