@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
332 lines • 15.1 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.AclRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a CFW ACL rule resource within HuaweiCloud.
*
* ## Example Usage
* ### Create a basic rule
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const name = config.requireObject("name");
* const description = config.requireObject("description");
* const objectId = config.requireObject("objectId");
* const test = new huaweicloud.cfw.AclRule("test", {
* objectId: objectId,
* description: description,
* type: 0,
* addressType: 0,
* actionType: 0,
* longConnectEnable: 0,
* status: 1,
* sourceAddresses: ["1.1.1.1"],
* destinationAddresses: ["1.1.1.2"],
* customServices: [{
* protocol: 6,
* sourcePort: "81",
* destPort: "82",
* }],
* sequence: {
* top: 1,
* },
* tags: {
* key: "value",
* },
* });
* ```
* ### Create a rule with the source address using the region list
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const name = config.requireObject("name");
* const description = config.requireObject("description");
* const objectId = config.requireObject("objectId");
* const test = new huaweicloud.cfw.AclRule("test", {
* objectId: objectId,
* description: description,
* type: 0,
* addressType: 0,
* actionType: 0,
* longConnectEnable: 0,
* status: 1,
* sourceRegionLists: [{
* descriptionCn: "中国",
* descriptionEn: "Chinese Mainland",
* regionId: "CN",
* regionType: 0,
* }],
* destinationAddresses: ["1.1.1.2"],
* customServices: [{
* protocol: 6,
* sourcePort: "81",
* destPort: "82",
* }],
* sequence: {
* top: 1,
* },
* tags: {
* key: "value",
* },
* });
* ```
* ### Create a rule with the custom service groups
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const name = config.requireObject("name");
* const description = config.requireObject("description");
* const objectId = config.requireObject("objectId");
* const serviceGroupId = config.requireObject("serviceGroupId");
* const protocol = config.requireObject("protocol");
* const test = new huaweicloud.cfw.AclRule("test", {
* objectId: objectId,
* description: description,
* type: 0,
* addressType: 0,
* actionType: 0,
* longConnectEnable: 0,
* status: 1,
* sourceAddresses: ["1.1.1.1"],
* destinationAddresses: ["1.1.1.2"],
* customServiceGroups: {
* protocols: [protocol],
* groupIds: [serviceGroupId],
* },
* sequence: {
* top: 1,
* },
* tags: {
* key: "value",
* },
* });
* ```
* ### Create a rule with any service
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const name = config.requireObject("name");
* const description = config.requireObject("description");
* const objectId = config.requireObject("objectId");
* const serviceGroupId = config.requireObject("serviceGroupId");
* const protocol = config.requireObject("protocol");
* const test = new huaweicloud.cfw.AclRule("test", {
* objectId: objectId,
* description: description,
* type: 0,
* addressType: 0,
* actionType: 0,
* longConnectEnable: 0,
* status: 1,
* sourceAddresses: ["1.1.1.1"],
* destinationAddresses: ["1.1.1.2"],
* sequence: {
* top: 1,
* },
* tags: {
* key: "value",
* },
* });
* ```
* ### Create a rule with any source address
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const name = config.requireObject("name");
* const description = config.requireObject("description");
* const objectId = config.requireObject("objectId");
* const serviceGroupId = config.requireObject("serviceGroupId");
* const protocol = config.requireObject("protocol");
* const test = new huaweicloud.cfw.AclRule("test", {
* objectId: objectId,
* description: description,
* type: 0,
* addressType: 0,
* actionType: 0,
* longConnectEnable: 0,
* status: 1,
* destinationAddresses: ["1.1.1.2"],
* customServices: [{
* protocol: 6,
* sourcePort: "81",
* destPort: "82",
* }],
* sequence: {
* top: 1,
* },
* tags: {
* key: "value",
* },
* });
* ```
*
* ## Import
*
* The ACL rule can be imported using `object_id`, `id`, separated by a slash, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Cfw/aclRule:AclRule test <object_id>/<id>
* ```
*
* Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`sequence`, `type`, `predefined_service_groups` and `source_predefined_groups`. It is generally recommended running `terraform plan` after importing the resource. You can then decide if changes should be applied to the instance, or the resource definition should be updated to align with the instance. Also you can ignore changes as below. hcl resource "huaweicloud_cfw_acl_rule" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* sequence, type, predefined_service_groups, source_predefined_groups,
*
* ]
*
* } }
*/
class AclRule extends pulumi.CustomResource {
/**
* Get an existing AclRule 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 AclRule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of AclRule. 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'] === AclRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["actionType"] = state ? state.actionType : undefined;
resourceInputs["addressType"] = state ? state.addressType : undefined;
resourceInputs["applications"] = state ? state.applications : undefined;
resourceInputs["customServiceGroups"] = state ? state.customServiceGroups : undefined;
resourceInputs["customServices"] = state ? state.customServices : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["destinationAddressGroups"] = state ? state.destinationAddressGroups : undefined;
resourceInputs["destinationAddressType"] = state ? state.destinationAddressType : undefined;
resourceInputs["destinationAddresses"] = state ? state.destinationAddresses : undefined;
resourceInputs["destinationDomainAddressName"] = state ? state.destinationDomainAddressName : undefined;
resourceInputs["destinationDomainGroupId"] = state ? state.destinationDomainGroupId : undefined;
resourceInputs["destinationDomainGroupName"] = state ? state.destinationDomainGroupName : undefined;
resourceInputs["destinationDomainGroupType"] = state ? state.destinationDomainGroupType : undefined;
resourceInputs["destinationRegionLists"] = state ? state.destinationRegionLists : undefined;
resourceInputs["direction"] = state ? state.direction : undefined;
resourceInputs["enableForceNew"] = state ? state.enableForceNew : undefined;
resourceInputs["longConnectEnable"] = state ? state.longConnectEnable : undefined;
resourceInputs["longConnectTimeHour"] = state ? state.longConnectTimeHour : undefined;
resourceInputs["longConnectTimeMinute"] = state ? state.longConnectTimeMinute : undefined;
resourceInputs["longConnectTimeSecond"] = state ? state.longConnectTimeSecond : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["objectId"] = state ? state.objectId : undefined;
resourceInputs["predefinedServiceGroups"] = state ? state.predefinedServiceGroups : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["ruleHitCount"] = state ? state.ruleHitCount : undefined;
resourceInputs["sequence"] = state ? state.sequence : undefined;
resourceInputs["sourceAddressGroups"] = state ? state.sourceAddressGroups : undefined;
resourceInputs["sourceAddressType"] = state ? state.sourceAddressType : undefined;
resourceInputs["sourceAddresses"] = state ? state.sourceAddresses : undefined;
resourceInputs["sourcePredefinedGroups"] = state ? state.sourcePredefinedGroups : undefined;
resourceInputs["sourceRegionLists"] = state ? state.sourceRegionLists : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.actionType === undefined) && !opts.urn) {
throw new Error("Missing required property 'actionType'");
}
if ((!args || args.addressType === undefined) && !opts.urn) {
throw new Error("Missing required property 'addressType'");
}
if ((!args || args.longConnectEnable === undefined) && !opts.urn) {
throw new Error("Missing required property 'longConnectEnable'");
}
if ((!args || args.objectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'objectId'");
}
if ((!args || args.sequence === undefined) && !opts.urn) {
throw new Error("Missing required property 'sequence'");
}
if ((!args || args.status === undefined) && !opts.urn) {
throw new Error("Missing required property 'status'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["actionType"] = args ? args.actionType : undefined;
resourceInputs["addressType"] = args ? args.addressType : undefined;
resourceInputs["applications"] = args ? args.applications : undefined;
resourceInputs["customServiceGroups"] = args ? args.customServiceGroups : undefined;
resourceInputs["customServices"] = args ? args.customServices : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["destinationAddressGroups"] = args ? args.destinationAddressGroups : undefined;
resourceInputs["destinationAddressType"] = args ? args.destinationAddressType : undefined;
resourceInputs["destinationAddresses"] = args ? args.destinationAddresses : undefined;
resourceInputs["destinationDomainAddressName"] = args ? args.destinationDomainAddressName : undefined;
resourceInputs["destinationDomainGroupId"] = args ? args.destinationDomainGroupId : undefined;
resourceInputs["destinationDomainGroupName"] = args ? args.destinationDomainGroupName : undefined;
resourceInputs["destinationDomainGroupType"] = args ? args.destinationDomainGroupType : undefined;
resourceInputs["destinationRegionLists"] = args ? args.destinationRegionLists : undefined;
resourceInputs["direction"] = args ? args.direction : undefined;
resourceInputs["enableForceNew"] = args ? args.enableForceNew : undefined;
resourceInputs["longConnectEnable"] = args ? args.longConnectEnable : undefined;
resourceInputs["longConnectTimeHour"] = args ? args.longConnectTimeHour : undefined;
resourceInputs["longConnectTimeMinute"] = args ? args.longConnectTimeMinute : undefined;
resourceInputs["longConnectTimeSecond"] = args ? args.longConnectTimeSecond : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["objectId"] = args ? args.objectId : undefined;
resourceInputs["predefinedServiceGroups"] = args ? args.predefinedServiceGroups : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["ruleHitCount"] = args ? args.ruleHitCount : undefined;
resourceInputs["sequence"] = args ? args.sequence : undefined;
resourceInputs["sourceAddressGroups"] = args ? args.sourceAddressGroups : undefined;
resourceInputs["sourceAddressType"] = args ? args.sourceAddressType : undefined;
resourceInputs["sourceAddresses"] = args ? args.sourceAddresses : undefined;
resourceInputs["sourcePredefinedGroups"] = args ? args.sourcePredefinedGroups : undefined;
resourceInputs["sourceRegionLists"] = args ? args.sourceRegionLists : undefined;
resourceInputs["status"] = args ? args.status : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["type"] = args ? args.type : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AclRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.AclRule = AclRule;
/** @internal */
AclRule.__pulumiType = 'huaweicloud:Cfw/aclRule:AclRule';
//# sourceMappingURL=aclRule.js.map