@ctfer-io/pulumi-ctfdcm
Version:
The CTFd-CM provider for Pulumi, to manage its resources as code.
155 lines • 7.83 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.ChallengeDynamicIaC = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* CTFd is built around the Challenge resource, which contains all the attributes to define a part of the Capture The Flag event.
*
* This implementation has support of On Demand infrastructures through [Chall-Manager](https://github.com/ctfer-io/chall-manager).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as ctfd from "@pulumi/ctfd";
* import * as ctfdcm from "@ctfer-io/pulumi-ctfdcm";
* import * as fs from "fs";
*
* const scenario = new ctfd.index.Ctfd_file("scenario", {
* name: "scenario.zip",
* contentb64: fs.readFileSync(".../scenario.zip", { encoding: "base64" }),
* });
* const http = new ctfdcm.ChallengeDynamicIaC("http", {
* category: "misc",
* description: "...",
* value: 500,
* decay: 100,
* minimum: 50,
* state: "visible",
* "function": "logarithmic",
* shared: true,
* destroyOnFlag: true,
* manaCost: 1,
* scenarioId: scenario.id,
* timeout: 600,
* topics: ["Misc"],
* tags: [
* "misc",
* "basic",
* ],
* });
* const httpFlag = new ctfd.index.Ctfd_flag("httpFlag", {
* challengeId: http.id,
* content: "CTF{some_flag}",
* });
* ```
*/
class ChallengeDynamicIaC extends pulumi.CustomResource {
/**
* Get an existing ChallengeDynamicIaC 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 ChallengeDynamicIaC(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ChallengeDynamicIaC. 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'] === ChallengeDynamicIaC.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["additional"] = state ? state.additional : undefined;
resourceInputs["attribution"] = state ? state.attribution : undefined;
resourceInputs["category"] = state ? state.category : undefined;
resourceInputs["connectionInfo"] = state ? state.connectionInfo : undefined;
resourceInputs["decay"] = state ? state.decay : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["destroyOnFlag"] = state ? state.destroyOnFlag : undefined;
resourceInputs["function"] = state ? state.function : undefined;
resourceInputs["manaCost"] = state ? state.manaCost : undefined;
resourceInputs["max"] = state ? state.max : undefined;
resourceInputs["maxAttempts"] = state ? state.maxAttempts : undefined;
resourceInputs["min"] = state ? state.min : undefined;
resourceInputs["minimum"] = state ? state.minimum : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["next"] = state ? state.next : undefined;
resourceInputs["requirements"] = state ? state.requirements : undefined;
resourceInputs["scenarioId"] = state ? state.scenarioId : undefined;
resourceInputs["shared"] = state ? state.shared : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["timeout"] = state ? state.timeout : undefined;
resourceInputs["topics"] = state ? state.topics : undefined;
resourceInputs["until"] = state ? state.until : undefined;
resourceInputs["value"] = state ? state.value : undefined;
}
else {
const args = argsOrState;
if ((!args || args.category === undefined) && !opts.urn) {
throw new Error("Missing required property 'category'");
}
if ((!args || args.decay === undefined) && !opts.urn) {
throw new Error("Missing required property 'decay'");
}
if ((!args || args.description === undefined) && !opts.urn) {
throw new Error("Missing required property 'description'");
}
if ((!args || args.minimum === undefined) && !opts.urn) {
throw new Error("Missing required property 'minimum'");
}
if ((!args || args.scenarioId === undefined) && !opts.urn) {
throw new Error("Missing required property 'scenarioId'");
}
if ((!args || args.value === undefined) && !opts.urn) {
throw new Error("Missing required property 'value'");
}
resourceInputs["additional"] = args ? args.additional : undefined;
resourceInputs["attribution"] = args ? args.attribution : undefined;
resourceInputs["category"] = args ? args.category : undefined;
resourceInputs["connectionInfo"] = args ? args.connectionInfo : undefined;
resourceInputs["decay"] = args ? args.decay : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["destroyOnFlag"] = args ? args.destroyOnFlag : undefined;
resourceInputs["function"] = args ? args.function : undefined;
resourceInputs["manaCost"] = args ? args.manaCost : undefined;
resourceInputs["max"] = args ? args.max : undefined;
resourceInputs["maxAttempts"] = args ? args.maxAttempts : undefined;
resourceInputs["min"] = args ? args.min : undefined;
resourceInputs["minimum"] = args ? args.minimum : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["next"] = args ? args.next : undefined;
resourceInputs["requirements"] = args ? args.requirements : undefined;
resourceInputs["scenarioId"] = args ? args.scenarioId : undefined;
resourceInputs["shared"] = args ? args.shared : undefined;
resourceInputs["state"] = args ? args.state : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["timeout"] = args ? args.timeout : undefined;
resourceInputs["topics"] = args ? args.topics : undefined;
resourceInputs["until"] = args ? args.until : undefined;
resourceInputs["value"] = args ? args.value : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ChallengeDynamicIaC.__pulumiType, name, resourceInputs, opts);
}
}
exports.ChallengeDynamicIaC = ChallengeDynamicIaC;
/** @internal */
ChallengeDynamicIaC.__pulumiType = 'ctfdcm:index/challengeDynamicIaC:ChallengeDynamicIaC';
//# sourceMappingURL=challengeDynamicIaC.js.map