@ctfer-io/pulumi-ctfd
Version:
The CTFd provider for Pulumi, to manage its resources as code.
103 lines • 3.9 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.Hint = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* A hint for a challenge to help players solve it.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as ctfd from "@ctfer-io/pulumi-ctfd";
*
* const http = new ctfd.ChallengeDynamic("http", {
* category: "misc",
* description: "...",
* value: 500,
* decay: 100,
* minimum: 50,
* state: "visible",
* "function": "logarithmic",
* topics: ["Misc"],
* tags: [
* "misc",
* "basic",
* ],
* });
* const httpFlag = new ctfd.Flag("httpFlag", {
* challengeId: http.id,
* content: "CTF{some_flag}",
* });
* const httpHint = new ctfd.Hint("httpHint", {
* 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: [ctfd_hint.http_hint_1.id],
* });
* ```
*/
class Hint extends pulumi.CustomResource {
/**
* Get an existing Hint 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 Hint(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Hint. 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'] === Hint.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["challengeId"] = state ? state.challengeId : undefined;
resourceInputs["content"] = state ? state.content : undefined;
resourceInputs["cost"] = state ? state.cost : undefined;
resourceInputs["requirements"] = state ? state.requirements : undefined;
resourceInputs["title"] = state ? state.title : undefined;
}
else {
const args = argsOrState;
if ((!args || args.challengeId === undefined) && !opts.urn) {
throw new Error("Missing required property 'challengeId'");
}
if ((!args || args.content === undefined) && !opts.urn) {
throw new Error("Missing required property 'content'");
}
resourceInputs["challengeId"] = args ? args.challengeId : undefined;
resourceInputs["content"] = args ? args.content : undefined;
resourceInputs["cost"] = args ? args.cost : undefined;
resourceInputs["requirements"] = args ? args.requirements : undefined;
resourceInputs["title"] = args ? args.title : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Hint.__pulumiType, name, resourceInputs, opts);
}
}
exports.Hint = Hint;
/** @internal */
Hint.__pulumiType = 'ctfd:index/hint:Hint';
//# sourceMappingURL=hint.js.map