@pulumi/nomad
Version:
A Pulumi package for creating and managing nomad cloud resources.
97 lines • 3.85 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.SentinelPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages a Sentinel policy registered in Nomad.
*
* > **Enterprise Only!** This API endpoint and functionality only exists in
* Nomad Enterprise. This is not present in the open source version of Nomad.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as nomad from "@pulumi/nomad";
*
* const exec_only = new nomad.SentinelPolicy("exec-only", {
* name: "exec-only",
* description: "Only allow jobs that are based on an exec driver.",
* policy: `main = rule { all_drivers_exec }
*
* # all_drivers_exec checks that all the drivers in use are exec
* all_drivers_exec = rule {
* all job.task_groups as tg {
* all tg.tasks as task {
* task.driver is "exec"
* }
* }
* }
* `,
* scope: "submit-job",
* enforcementLevel: "soft-mandatory",
* });
* ```
*/
class SentinelPolicy extends pulumi.CustomResource {
/**
* Get an existing SentinelPolicy 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 SentinelPolicy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of SentinelPolicy. 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'] === SentinelPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state?.description;
resourceInputs["enforcementLevel"] = state?.enforcementLevel;
resourceInputs["name"] = state?.name;
resourceInputs["policy"] = state?.policy;
resourceInputs["scope"] = state?.scope;
}
else {
const args = argsOrState;
if (args?.enforcementLevel === undefined && !opts.urn) {
throw new Error("Missing required property 'enforcementLevel'");
}
if (args?.policy === undefined && !opts.urn) {
throw new Error("Missing required property 'policy'");
}
if (args?.scope === undefined && !opts.urn) {
throw new Error("Missing required property 'scope'");
}
resourceInputs["description"] = args?.description;
resourceInputs["enforcementLevel"] = args?.enforcementLevel;
resourceInputs["name"] = args?.name;
resourceInputs["policy"] = args?.policy;
resourceInputs["scope"] = args?.scope;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SentinelPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.SentinelPolicy = SentinelPolicy;
/** @internal */
SentinelPolicy.__pulumiType = 'nomad:index/sentinelPolicy:SentinelPolicy';
//# sourceMappingURL=sentinelPolicy.js.map