UNPKG

@pulumi/openstack

Version:

A Pulumi package for creating and managing OpenStack cloud resources.

101 lines 4.17 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.SubnetRoute = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Creates a routing entry on a OpenStack V2 subnet. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as openstack from "@pulumi/openstack"; * * const router1 = new openstack.networking.Router("router_1", { * name: "router_1", * adminStateUp: true, * }); * const network1 = new openstack.networking.Network("network_1", { * name: "network_1", * adminStateUp: true, * }); * const subnet1 = new openstack.networking.Subnet("subnet_1", { * networkId: network1.id, * cidr: "192.168.199.0/24", * ipVersion: 4, * }); * const subnetRoute1 = new openstack.networking.SubnetRoute("subnet_route_1", { * subnetId: subnet1.id, * destinationCidr: "10.0.1.0/24", * nextHop: "192.168.199.254", * }); * ``` * * ## Import * * Routing entries can be imported using a combined ID using the following format: `<subnet_id>-route-<destination_cidr>-<next_hop>` * * ```sh * $ pulumi import openstack:networking/subnetRoute:SubnetRoute subnet_route_1 686fe248-386c-4f70-9f6c-281607dad079-route-10.0.1.0/24-192.168.199.25 * ``` */ class SubnetRoute extends pulumi.CustomResource { /** * Get an existing SubnetRoute 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 SubnetRoute(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SubnetRoute. 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'] === SubnetRoute.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["destinationCidr"] = state ? state.destinationCidr : undefined; resourceInputs["nextHop"] = state ? state.nextHop : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["subnetId"] = state ? state.subnetId : undefined; } else { const args = argsOrState; if ((!args || args.destinationCidr === undefined) && !opts.urn) { throw new Error("Missing required property 'destinationCidr'"); } if ((!args || args.nextHop === undefined) && !opts.urn) { throw new Error("Missing required property 'nextHop'"); } if ((!args || args.subnetId === undefined) && !opts.urn) { throw new Error("Missing required property 'subnetId'"); } resourceInputs["destinationCidr"] = args ? args.destinationCidr : undefined; resourceInputs["nextHop"] = args ? args.nextHop : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["subnetId"] = args ? args.subnetId : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SubnetRoute.__pulumiType, name, resourceInputs, opts); } } exports.SubnetRoute = SubnetRoute; /** @internal */ SubnetRoute.__pulumiType = 'openstack:networking/subnetRoute:SubnetRoute'; //# sourceMappingURL=subnetRoute.js.map