UNPKG

@pulumi/gcp

Version:

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

156 lines 6.46 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Endpoint = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = 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/v1beta1/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}} * ``` * * ```sh * $ pulumi import gcp:servicedirectory/endpoint:Endpoint default {{project}}/{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}} * ``` * * ```sh * $ 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.address : undefined; resourceInputs["endpointId"] = state ? state.endpointId : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["network"] = state ? state.network : undefined; resourceInputs["port"] = state ? state.port : undefined; resourceInputs["service"] = state ? state.service : undefined; } else { const args = argsOrState; if ((!args || args.endpointId === undefined) && !opts.urn) { throw new Error("Missing required property 'endpointId'"); } if ((!args || args.service === undefined) && !opts.urn) { throw new Error("Missing required property 'service'"); } resourceInputs["address"] = args ? args.address : undefined; resourceInputs["endpointId"] = args ? args.endpointId : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["network"] = args ? args.network : undefined; resourceInputs["port"] = args ? args.port : undefined; resourceInputs["service"] = args ? args.service : undefined; resourceInputs["name"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Endpoint.__pulumiType, name, resourceInputs, opts); } } exports.Endpoint = Endpoint; /** @internal */ Endpoint.__pulumiType = 'gcp:servicedirectory/endpoint:Endpoint'; //# sourceMappingURL=endpoint.js.map