UNPKG

@pulumi/gcp

Version:

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

116 lines 4.66 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.Service = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * An individual service. A service contains a name and optional metadata. * * To get more information about Service, see: * * * [API documentation](https://cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces.services) * * How-to Guides * * [Configuring a service](https://cloud.google.com/service-directory/docs/configuring-service-directory#configuring_a_service) * * ## Example Usage * * ### Service Directory Service 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, * metadata: { * stage: "prod", * region: "us-central1", * }, * }); * ``` * * ## Import * * Service can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}` * * * `{{project}}/{{location}}/{{namespace_id}}/{{service_id}}` * * * `{{location}}/{{namespace_id}}/{{service_id}}` * * When using the `pulumi import` command, Service can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:servicedirectory/service:Service default projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}} * ``` * * ```sh * $ pulumi import gcp:servicedirectory/service:Service default {{project}}/{{location}}/{{namespace_id}}/{{service_id}} * ``` * * ```sh * $ pulumi import gcp:servicedirectory/service:Service default {{location}}/{{namespace_id}}/{{service_id}} * ``` */ 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, Object.assign(Object.assign({}, 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["metadata"] = state ? state.metadata : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["namespace"] = state ? state.namespace : undefined; resourceInputs["serviceId"] = state ? state.serviceId : undefined; } else { const args = argsOrState; if ((!args || args.namespace === undefined) && !opts.urn) { throw new Error("Missing required property 'namespace'"); } if ((!args || args.serviceId === undefined) && !opts.urn) { throw new Error("Missing required property 'serviceId'"); } resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["namespace"] = args ? args.namespace : undefined; resourceInputs["serviceId"] = args ? args.serviceId : undefined; resourceInputs["name"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Service.__pulumiType, name, resourceInputs, opts); } } exports.Service = Service; /** @internal */ Service.__pulumiType = 'gcp:servicedirectory/service:Service'; //# sourceMappingURL=service.js.map