UNPKG

@pulumi/gcp

Version:

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

132 lines 4.81 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.DomainMapping = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource to hold the state and status of a user's domain mapping. * * To get more information about DomainMapping, see: * * * [API documentation](https://cloud.google.com/run/docs/reference/rest/v1/projects.locations.domainmappings) * * How-to Guides * * [Official Documentation](https://cloud.google.com/run/docs/mapping-custom-domains) * * ## Example Usage * * ### Cloud Run Domain Mapping Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.cloudrun.Service("default", { * name: "cloudrun-srv", * location: "us-central1", * metadata: { * namespace: "my-project-name", * }, * template: { * spec: { * containers: [{ * image: "us-docker.pkg.dev/cloudrun/container/hello", * }], * }, * }, * }); * const defaultDomainMapping = new gcp.cloudrun.DomainMapping("default", { * location: "us-central1", * name: "verified-domain.com", * metadata: { * namespace: "my-project-name", * }, * spec: { * routeName: _default.name, * }, * }); * ``` * * ## Import * * DomainMapping can be imported using any of these accepted formats: * * * `locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}` * * * `{{location}}/{{project}}/{{name}}` * * * `{{location}}/{{name}}` * * When using the `pulumi import` command, DomainMapping can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:cloudrun/domainMapping:DomainMapping default locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}} * ``` * * ```sh * $ pulumi import gcp:cloudrun/domainMapping:DomainMapping default {{location}}/{{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:cloudrun/domainMapping:DomainMapping default {{location}}/{{name}} * ``` */ class DomainMapping extends pulumi.CustomResource { /** * Get an existing DomainMapping 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 DomainMapping(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of DomainMapping. 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'] === DomainMapping.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["location"] = state?.location; resourceInputs["metadata"] = state?.metadata; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["spec"] = state?.spec; resourceInputs["statuses"] = state?.statuses; } else { const args = argsOrState; if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } if (args?.spec === undefined && !opts.urn) { throw new Error("Missing required property 'spec'"); } resourceInputs["location"] = args?.location; resourceInputs["metadata"] = args?.metadata; resourceInputs["name"] = args?.name; resourceInputs["project"] = args?.project; resourceInputs["spec"] = args?.spec; resourceInputs["statuses"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DomainMapping.__pulumiType, name, resourceInputs, opts); } } exports.DomainMapping = DomainMapping; /** @internal */ DomainMapping.__pulumiType = 'gcp:cloudrun/domainMapping:DomainMapping'; //# sourceMappingURL=domainMapping.js.map