@ctfer-io/pulumi-ctfd
Version:
The CTFd provider for Pulumi, to manage its resources as code.
123 lines • 5.54 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.ChallengeStandard = 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.
*
* It is the first historic implementation of its kind, with basic functionalities.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as ctfd from "@ctfer-io/pulumi-ctfd";
* import * as fs from "fs";
*
* const http = new ctfd.ChallengeStandard("http", {
* category: "misc",
* description: "...",
* value: 500,
* topics: ["Misc"],
* tags: [
* "misc",
* "basic",
* ],
* });
* const httpFlag = new ctfd.Flag("httpFlag", {
* challengeId: http.id,
* content: "CTF{some_flag}",
* });
* const httpHint1 = new ctfd.Hint("httpHint1", {
* challengeId: http.id,
* content: "Some super-helpful hint",
* cost: 50,
* });
* const httpHint2 = new ctfd.Hint("httpHint2", {
* challengeId: http.id,
* content: "Even more helpful hint !",
* cost: 50,
* requirements: [httpHint1.id],
* });
* const httpFile = new ctfd.File("httpFile", {
* challengeId: http.id,
* contentb64: fs.readFileSync(".../image.png", { encoding: "base64" }),
* });
* ```
*/
class ChallengeStandard extends pulumi.CustomResource {
/**
* Get an existing ChallengeStandard 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 ChallengeStandard(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ChallengeStandard. 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'] === ChallengeStandard.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["attribution"] = state ? state.attribution : undefined;
resourceInputs["category"] = state ? state.category : undefined;
resourceInputs["connectionInfo"] = state ? state.connectionInfo : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["maxAttempts"] = state ? state.maxAttempts : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["next"] = state ? state.next : undefined;
resourceInputs["requirements"] = state ? state.requirements : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["topics"] = state ? state.topics : 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.description === undefined) && !opts.urn) {
throw new Error("Missing required property 'description'");
}
if ((!args || args.value === undefined) && !opts.urn) {
throw new Error("Missing required property 'value'");
}
resourceInputs["attribution"] = args ? args.attribution : undefined;
resourceInputs["category"] = args ? args.category : undefined;
resourceInputs["connectionInfo"] = args ? args.connectionInfo : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["maxAttempts"] = args ? args.maxAttempts : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["next"] = args ? args.next : undefined;
resourceInputs["requirements"] = args ? args.requirements : undefined;
resourceInputs["state"] = args ? args.state : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["topics"] = args ? args.topics : undefined;
resourceInputs["value"] = args ? args.value : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ChallengeStandard.__pulumiType, name, resourceInputs, opts);
}
}
exports.ChallengeStandard = ChallengeStandard;
/** @internal */
ChallengeStandard.__pulumiType = 'ctfd:index/challengeStandard:ChallengeStandard';
//# sourceMappingURL=challengeStandard.js.map