@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
127 lines • 5.08 kB
JavaScript
;
// *** 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.PortSecGroupAssociate = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
*
* ### Append a security group to an existing port
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const systemPort = openstack.networking.getPort({
* fixedIp: "10.0.0.10",
* });
* const secgroup = openstack.networking.getSecGroup({
* name: "secgroup",
* });
* const port1 = new openstack.networking.PortSecGroupAssociate("port_1", {
* portId: systemPort.then(systemPort => systemPort.id),
* securityGroupIds: [secgroup.then(secgroup => secgroup.id)],
* });
* ```
*
* ### Enforce a security group to an existing port
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const systemPort = openstack.networking.getPort({
* fixedIp: "10.0.0.10",
* });
* const secgroup = openstack.networking.getSecGroup({
* name: "secgroup",
* });
* const port1 = new openstack.networking.PortSecGroupAssociate("port_1", {
* portId: systemPort.then(systemPort => systemPort.id),
* enforce: true,
* securityGroupIds: [secgroup.then(secgroup => secgroup.id)],
* });
* ```
*
* ### Remove all security groups from an existing port
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const systemPort = openstack.networking.getPort({
* fixedIp: "10.0.0.10",
* });
* const port1 = new openstack.networking.PortSecGroupAssociate("port_1", {
* portId: systemPort.then(systemPort => systemPort.id),
* enforce: true,
* securityGroupIds: [],
* });
* ```
*
* ## Import
*
* Port security group association can be imported using the `id` of the port, e.g.
*
* ```sh
* $ pulumi import openstack:networking/portSecGroupAssociate:PortSecGroupAssociate port_1 eae26a3e-1c33-4cc1-9c31-0cd729c438a1
* ```
*/
class PortSecGroupAssociate extends pulumi.CustomResource {
/**
* Get an existing PortSecGroupAssociate 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 PortSecGroupAssociate(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of PortSecGroupAssociate. 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'] === PortSecGroupAssociate.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allSecurityGroupIds"] = state ? state.allSecurityGroupIds : undefined;
resourceInputs["enforce"] = state ? state.enforce : undefined;
resourceInputs["portId"] = state ? state.portId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined;
}
else {
const args = argsOrState;
if ((!args || args.portId === undefined) && !opts.urn) {
throw new Error("Missing required property 'portId'");
}
if ((!args || args.securityGroupIds === undefined) && !opts.urn) {
throw new Error("Missing required property 'securityGroupIds'");
}
resourceInputs["enforce"] = args ? args.enforce : undefined;
resourceInputs["portId"] = args ? args.portId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined;
resourceInputs["allSecurityGroupIds"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PortSecGroupAssociate.__pulumiType, name, resourceInputs, opts);
}
}
exports.PortSecGroupAssociate = PortSecGroupAssociate;
/** @internal */
PortSecGroupAssociate.__pulumiType = 'openstack:networking/portSecGroupAssociate:PortSecGroupAssociate';
//# sourceMappingURL=portSecGroupAssociate.js.map