@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
151 lines • 6.99 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.CaptureTask = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a CFW capture task resource within HuaweiCloud.
*
* > **NOTE:** For the Cloud Firewall service, you can only initiate up to 20 packet capture tasks per day.
* Beyond this limit, no additional packet capture tasks can be initiated. Furthermore, only one packet capture task can be
* in progress at any given time.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const fwInstanceId = config.requireObject("fwInstanceId");
* const name = config.requireObject("name");
* const duration = config.requireObject("duration");
* const maxPackets = config.requireObject("maxPackets");
* const test = new huaweicloud.cfw.CaptureTask("test", {
* fwInstanceId: fwInstanceId,
* duration: duration,
* maxPackets: maxPackets,
* destination: {
* address: "1.1.1.1",
* addressType: 0,
* },
* source: {
* address: "2.2.2.2",
* addressType: 0,
* },
* service: {
* protocol: -1,
* },
* });
* ```
*
* ## Import
*
* The capture task can be imported using `fw_instance_id`, `name`, separated by a slash, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Cfw/captureTask:CaptureTask test <fw_instance_id>/<name>
* ```
*
* 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 is `stop_capture`. It is generally recommended running `terraform plan` after importing the resource. You can then decide if changes should be applied to the capture task, or the resource definition should be updated to align with the capture task. Also you can ignore changes as below. hcl resource "huaweicloud_cfw_capture_task" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* stop_capture,
*
* ]
*
* } }
*/
class CaptureTask extends pulumi.CustomResource {
/**
* Get an existing CaptureTask 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 CaptureTask(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of CaptureTask. 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'] === CaptureTask.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["destination"] = state ? state.destination : undefined;
resourceInputs["duration"] = state ? state.duration : undefined;
resourceInputs["enableForceNew"] = state ? state.enableForceNew : undefined;
resourceInputs["fwInstanceId"] = state ? state.fwInstanceId : undefined;
resourceInputs["maxPackets"] = state ? state.maxPackets : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["service"] = state ? state.service : undefined;
resourceInputs["source"] = state ? state.source : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["stopCapture"] = state ? state.stopCapture : undefined;
resourceInputs["taskId"] = state ? state.taskId : 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.duration === undefined) && !opts.urn) {
throw new Error("Missing required property 'duration'");
}
if ((!args || args.fwInstanceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'fwInstanceId'");
}
if ((!args || args.maxPackets === undefined) && !opts.urn) {
throw new Error("Missing required property 'maxPackets'");
}
if ((!args || args.service === undefined) && !opts.urn) {
throw new Error("Missing required property 'service'");
}
if ((!args || args.source === undefined) && !opts.urn) {
throw new Error("Missing required property 'source'");
}
resourceInputs["destination"] = args ? args.destination : undefined;
resourceInputs["duration"] = args ? args.duration : undefined;
resourceInputs["enableForceNew"] = args ? args.enableForceNew : undefined;
resourceInputs["fwInstanceId"] = args ? args.fwInstanceId : undefined;
resourceInputs["maxPackets"] = args ? args.maxPackets : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["service"] = args ? args.service : undefined;
resourceInputs["source"] = args ? args.source : undefined;
resourceInputs["stopCapture"] = args ? args.stopCapture : undefined;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["taskId"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CaptureTask.__pulumiType, name, resourceInputs, opts);
}
}
exports.CaptureTask = CaptureTask;
/** @internal */
CaptureTask.__pulumiType = 'huaweicloud:Cfw/captureTask:CaptureTask';
//# sourceMappingURL=captureTask.js.map