UNPKG

@pulumi/openstack

Version:

A Pulumi package for creating and managing OpenStack cloud resources.

117 lines 5.56 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.SecGroupRule = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a V2 neutron security group rule resource within OpenStack. * Unlike Nova security groups, neutron separates the group from the rules * and also allows an admin to target a specific tenant_id. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as openstack from "@pulumi/openstack"; * * const secgroup1 = new openstack.networking.SecGroup("secgroup_1", { * name: "secgroup_1", * description: "My neutron security group", * }); * const secgroupRule1 = new openstack.networking.SecGroupRule("secgroup_rule_1", { * direction: "ingress", * ethertype: "IPv4", * protocol: "tcp", * portRangeMin: 22, * portRangeMax: 22, * remoteIpPrefix: "0.0.0.0/0", * securityGroupId: secgroup1.id, * }); * ``` * * > **Note:** To expose the full port-range 1:65535, use `0` for `portRangeMin` * and `portRangeMax`. * * ## Import * * Security Group Rules can be imported using the `id`, e.g. * * ```sh * $ pulumi import openstack:networking/secGroupRule:SecGroupRule secgroup_rule_1 aeb68ee3-6e9d-4256-955c-9584a6212745 * ``` */ class SecGroupRule extends pulumi.CustomResource { /** * Get an existing SecGroupRule 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 SecGroupRule(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of SecGroupRule. 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'] === SecGroupRule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["direction"] = state ? state.direction : undefined; resourceInputs["ethertype"] = state ? state.ethertype : undefined; resourceInputs["portRangeMax"] = state ? state.portRangeMax : undefined; resourceInputs["portRangeMin"] = state ? state.portRangeMin : undefined; resourceInputs["protocol"] = state ? state.protocol : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["remoteAddressGroupId"] = state ? state.remoteAddressGroupId : undefined; resourceInputs["remoteGroupId"] = state ? state.remoteGroupId : undefined; resourceInputs["remoteIpPrefix"] = state ? state.remoteIpPrefix : undefined; resourceInputs["securityGroupId"] = state ? state.securityGroupId : undefined; resourceInputs["tenantId"] = state ? state.tenantId : undefined; } else { const args = argsOrState; if ((!args || args.direction === undefined) && !opts.urn) { throw new Error("Missing required property 'direction'"); } if ((!args || args.ethertype === undefined) && !opts.urn) { throw new Error("Missing required property 'ethertype'"); } if ((!args || args.securityGroupId === undefined) && !opts.urn) { throw new Error("Missing required property 'securityGroupId'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["direction"] = args ? args.direction : undefined; resourceInputs["ethertype"] = args ? args.ethertype : undefined; resourceInputs["portRangeMax"] = args ? args.portRangeMax : undefined; resourceInputs["portRangeMin"] = args ? args.portRangeMin : undefined; resourceInputs["protocol"] = args ? args.protocol : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["remoteAddressGroupId"] = args ? args.remoteAddressGroupId : undefined; resourceInputs["remoteGroupId"] = args ? args.remoteGroupId : undefined; resourceInputs["remoteIpPrefix"] = args ? args.remoteIpPrefix : undefined; resourceInputs["securityGroupId"] = args ? args.securityGroupId : undefined; resourceInputs["tenantId"] = args ? args.tenantId : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SecGroupRule.__pulumiType, name, resourceInputs, opts); } } exports.SecGroupRule = SecGroupRule; /** @internal */ SecGroupRule.__pulumiType = 'openstack:networking/secGroupRule:SecGroupRule'; //# sourceMappingURL=secGroupRule.js.map