@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
199 lines • 8.14 kB
JavaScript
;
// *** 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.PublicDelegatedPrefix = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents a PublicDelegatedPrefix for use with bring your own IP addresses (BYOIP).
*
* To get more information about PublicDelegatedPrefix, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/publicDelegatedPrefixes)
* * How-to Guides
* * [Using bring your own IP](https://cloud.google.com/vpc/docs/using-bring-your-own-ip)
*
* ## Example Usage
*
* ### Public Delegated Prefixes Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const advertised = new gcp.compute.PublicAdvertisedPrefix("advertised", {
* name: "my-prefix",
* description: "description",
* dnsVerificationIp: "127.127.0.0",
* ipCidrRange: "127.127.0.0/16",
* });
* const prefixes = new gcp.compute.PublicDelegatedPrefix("prefixes", {
* name: "my-prefix",
* region: "us-central1",
* description: "my description",
* ipCidrRange: "127.127.0.0/24",
* parentPrefix: advertised.id,
* });
* ```
* ### Public Delegated Prefixes Ipv6
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const advertised = new gcp.compute.PublicAdvertisedPrefix("advertised", {
* name: "ipv6-pap",
* description: "description",
* dnsVerificationIp: "2001:db8::",
* ipCidrRange: "2001:db8::/32",
* pdpScope: "REGIONAL",
* });
* const prefix = new gcp.compute.PublicDelegatedPrefix("prefix", {
* name: "ipv6-root-pdp",
* description: "test-delegation-mode-pdp",
* region: "us-west1",
* ipCidrRange: "2001:db8::/40",
* parentPrefix: advertised.id,
* mode: "DELEGATION",
* });
* const subprefix = new gcp.compute.PublicDelegatedPrefix("subprefix", {
* name: "ipv6-sub-pdp",
* description: "test-forwarding-rule-mode-pdp",
* region: "us-west1",
* ipCidrRange: "2001:db8::/48",
* parentPrefix: prefix.id,
* allocatablePrefixLength: 64,
* mode: "EXTERNAL_IPV6_FORWARDING_RULE_CREATION",
* });
* ```
* ### Public Delegated Prefix Ipv6 Subnet Mode
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const advertised = new gcp.compute.PublicAdvertisedPrefix("advertised", {
* name: "ipv6-pap",
* description: "description",
* dnsVerificationIp: "2001:db8::",
* ipCidrRange: "2001:db8::/32",
* pdpScope: "REGIONAL",
* });
* const prefix = new gcp.compute.PublicDelegatedPrefix("prefix", {
* name: "ipv6-root-pdp",
* description: "test-delegation-mode-pdp",
* region: "us-east1",
* ipCidrRange: "2001:db8::/40",
* parentPrefix: advertised.id,
* mode: "DELEGATION",
* });
* const subprefix = new gcp.compute.PublicDelegatedPrefix("subprefix", {
* name: "ipv6-sub-pdp",
* description: "test-subnet-mode-pdp",
* region: "us-east1",
* ipCidrRange: "2001:db8::/48",
* parentPrefix: prefix.id,
* mode: "EXTERNAL_IPV6_SUBNETWORK_CREATION",
* });
* ```
*
* ## Import
*
* PublicDelegatedPrefix can be imported using any of these accepted formats:
*
* * `projects/{{project}}/regions/{{region}}/publicDelegatedPrefixes/{{name}}`
*
* * `{{project}}/{{region}}/{{name}}`
*
* * `{{region}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, PublicDelegatedPrefix can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix default projects/{{project}}/regions/{{region}}/publicDelegatedPrefixes/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix default {{project}}/{{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix default {{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix default {{name}}
* ```
*/
class PublicDelegatedPrefix extends pulumi.CustomResource {
/**
* Get an existing PublicDelegatedPrefix 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 PublicDelegatedPrefix(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of PublicDelegatedPrefix. 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'] === PublicDelegatedPrefix.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allocatablePrefixLength"] = state ? state.allocatablePrefixLength : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["ipCidrRange"] = state ? state.ipCidrRange : undefined;
resourceInputs["isLiveMigration"] = state ? state.isLiveMigration : undefined;
resourceInputs["mode"] = state ? state.mode : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["parentPrefix"] = state ? state.parentPrefix : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
}
else {
const args = argsOrState;
if ((!args || args.ipCidrRange === undefined) && !opts.urn) {
throw new Error("Missing required property 'ipCidrRange'");
}
if ((!args || args.parentPrefix === undefined) && !opts.urn) {
throw new Error("Missing required property 'parentPrefix'");
}
if ((!args || args.region === undefined) && !opts.urn) {
throw new Error("Missing required property 'region'");
}
resourceInputs["allocatablePrefixLength"] = args ? args.allocatablePrefixLength : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["ipCidrRange"] = args ? args.ipCidrRange : undefined;
resourceInputs["isLiveMigration"] = args ? args.isLiveMigration : undefined;
resourceInputs["mode"] = args ? args.mode : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["parentPrefix"] = args ? args.parentPrefix : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["selfLink"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PublicDelegatedPrefix.__pulumiType, name, resourceInputs, opts);
}
}
exports.PublicDelegatedPrefix = PublicDelegatedPrefix;
/** @internal */
PublicDelegatedPrefix.__pulumiType = 'gcp:compute/publicDelegatedPrefix:PublicDelegatedPrefix';
//# sourceMappingURL=publicDelegatedPrefix.js.map