UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

115 lines 5.07 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.StaticRoute = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a static route under the ER route table within HuaweiCloud. * * ## Example Usage * ### Create a static route and cross the VPC * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const routeTableId = config.requireObject("routeTableId"); * const destinationVpcCidr = config.requireObject("destinationVpcCidr"); * const sourceVpcAttachmentId = config.requireObject("sourceVpcAttachmentId"); * const test = new huaweicloud.er.StaticRoute("test", { * routeTableId: routeTableId, * destination: destinationVpcCidr, * attachmentId: sourceVpcAttachmentId, * }); * ``` * ### Create a black hole route * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const routeTableId = config.requireObject("routeTableId"); * const destinationVpcCidr = config.requireObject("destinationVpcCidr"); * const test = new huaweicloud.er.StaticRoute("test", { * routeTableId: routeTableId, * destination: destinationVpcCidr, * isBlackhole: true, * }); * ``` * * ## Import * * Static routes can be imported using the related `route_table_id` and their `id`, separated by a slash (/), e.g. bash * * ```sh * $ pulumi import huaweicloud:Er/staticRoute:StaticRoute test <route_table_id>/<id> * ``` */ class StaticRoute extends pulumi.CustomResource { /** * Get an existing StaticRoute 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 StaticRoute(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of StaticRoute. 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'] === StaticRoute.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["attachmentId"] = state ? state.attachmentId : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["destination"] = state ? state.destination : undefined; resourceInputs["isBlackhole"] = state ? state.isBlackhole : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["routeTableId"] = state ? state.routeTableId : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; } else { const args = argsOrState; if ((!args || args.destination === undefined) && !opts.urn) { throw new Error("Missing required property 'destination'"); } if ((!args || args.routeTableId === undefined) && !opts.urn) { throw new Error("Missing required property 'routeTableId'"); } resourceInputs["attachmentId"] = args ? args.attachmentId : undefined; resourceInputs["destination"] = args ? args.destination : undefined; resourceInputs["isBlackhole"] = args ? args.isBlackhole : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["routeTableId"] = args ? args.routeTableId : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["type"] = undefined /*out*/; resourceInputs["updatedAt"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(StaticRoute.__pulumiType, name, resourceInputs, opts); } } exports.StaticRoute = StaticRoute; /** @internal */ StaticRoute.__pulumiType = 'huaweicloud:Er/staticRoute:StaticRoute'; //# sourceMappingURL=staticRoute.js.map