UNPKG

@pulumi/gcp

Version:

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

173 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.Endpoint = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * An individual endpoint that provides a service. * * To get more information about Endpoint, see: * * * [API documentation](https://cloud.google.com/service-directory/docs/reference/rest/v1/projects.locations.namespaces.services.endpoints) * * How-to Guides * * [Configuring an endpoint](https://cloud.google.com/service-directory/docs/configuring-service-directory#configuring_an_endpoint) * * ## Example Usage * * ### Service Directory Endpoint Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const example = new gcp.servicedirectory.Namespace("example", { * namespaceId: "example-namespace", * location: "us-central1", * }); * const exampleService = new gcp.servicedirectory.Service("example", { * serviceId: "example-service", * namespace: example.id, * }); * const exampleEndpoint = new gcp.servicedirectory.Endpoint("example", { * endpointId: "example-endpoint", * service: exampleService.id, * metadata: { * stage: "prod", * region: "us-central1", * }, * address: "1.2.3.4", * port: 5353, * }); * ``` * ### Service Directory Endpoint With Network * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const example = new gcp.compute.Network("example", {name: "example-network"}); * const exampleNamespace = new gcp.servicedirectory.Namespace("example", { * namespaceId: "example-namespace", * location: "us-central1", * }); * const exampleService = new gcp.servicedirectory.Service("example", { * serviceId: "example-service", * namespace: exampleNamespace.id, * }); * const exampleEndpoint = new gcp.servicedirectory.Endpoint("example", { * endpointId: "example-endpoint", * service: exampleService.id, * metadata: { * stage: "prod", * region: "us-central1", * }, * network: pulumi.all([project, example.name]).apply(([project, name]) => `projects/${project.number}/locations/global/networks/${name}`), * address: "1.2.3.4", * port: 5353, * }); * ``` * * ## Import * * Endpoint can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}/endpoints/{{endpoint_id}}` * * `{{project}}/{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}` * * `{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}` * * When using the `pulumi import` command, Endpoint can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:servicedirectory/endpoint:Endpoint default projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}/endpoints/{{endpoint_id}} * $ pulumi import gcp:servicedirectory/endpoint:Endpoint default {{project}}/{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}} * $ pulumi import gcp:servicedirectory/endpoint:Endpoint default {{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}} * ``` */ class Endpoint extends pulumi.CustomResource { /** * Get an existing Endpoint 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 Endpoint(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:servicedirectory/endpoint:Endpoint'; /** * Returns true if the given object is an instance of Endpoint. 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'] === Endpoint.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["address"] = state?.address; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["endpointId"] = state?.endpointId; resourceInputs["metadata"] = state?.metadata; resourceInputs["name"] = state?.name; resourceInputs["network"] = state?.network; resourceInputs["port"] = state?.port; resourceInputs["service"] = state?.service; } else { const args = argsOrState; if (args?.endpointId === undefined && !opts.urn) { throw new Error("Missing required property 'endpointId'"); } if (args?.service === undefined && !opts.urn) { throw new Error("Missing required property 'service'"); } resourceInputs["address"] = args?.address; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["endpointId"] = args?.endpointId; resourceInputs["metadata"] = args?.metadata; resourceInputs["network"] = args?.network; resourceInputs["port"] = args?.port; resourceInputs["service"] = args?.service; resourceInputs["name"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Endpoint.__pulumiType, name, resourceInputs, opts); } } exports.Endpoint = Endpoint; //# sourceMappingURL=endpoint.js.map