@pulumi/github
Version:
A Pulumi package for creating and managing github cloud resources.
124 lines • 5.15 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.OrganizationRuleset = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Creates a GitHub organization ruleset.
*
* This resource allows you to create and manage rulesets on the organization level. When applied, a new ruleset will be created. When destroyed, that ruleset will be removed.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as github from "@pulumi/github";
*
* const example = new github.OrganizationRuleset("example", {
* name: "example",
* target: "branch",
* enforcement: "active",
* conditions: {
* refName: {
* includes: ["~ALL"],
* excludes: [],
* },
* },
* bypassActors: [{
* actorId: 13473,
* actorType: "Integration",
* bypassMode: "always",
* }],
* rules: {
* creation: true,
* update: true,
* deletion: true,
* requiredLinearHistory: true,
* requiredSignatures: true,
* branchNamePattern: {
* name: "example",
* negate: false,
* operator: "starts_with",
* pattern: "ex",
* },
* },
* });
* ```
*
* ## Import
*
* GitHub Organization Rulesets can be imported using the GitHub ruleset ID e.g.
*
* ```sh
* $ pulumi import github:index/organizationRuleset:OrganizationRuleset example 12345`
* ```
*/
class OrganizationRuleset extends pulumi.CustomResource {
/**
* Get an existing OrganizationRuleset 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 OrganizationRuleset(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of OrganizationRuleset. 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'] === OrganizationRuleset.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["bypassActors"] = state ? state.bypassActors : undefined;
resourceInputs["conditions"] = state ? state.conditions : undefined;
resourceInputs["enforcement"] = state ? state.enforcement : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["nodeId"] = state ? state.nodeId : undefined;
resourceInputs["rules"] = state ? state.rules : undefined;
resourceInputs["rulesetId"] = state ? state.rulesetId : undefined;
resourceInputs["target"] = state ? state.target : undefined;
}
else {
const args = argsOrState;
if ((!args || args.enforcement === undefined) && !opts.urn) {
throw new Error("Missing required property 'enforcement'");
}
if ((!args || args.rules === undefined) && !opts.urn) {
throw new Error("Missing required property 'rules'");
}
if ((!args || args.target === undefined) && !opts.urn) {
throw new Error("Missing required property 'target'");
}
resourceInputs["bypassActors"] = args ? args.bypassActors : undefined;
resourceInputs["conditions"] = args ? args.conditions : undefined;
resourceInputs["enforcement"] = args ? args.enforcement : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["rules"] = args ? args.rules : undefined;
resourceInputs["target"] = args ? args.target : undefined;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["nodeId"] = undefined /*out*/;
resourceInputs["rulesetId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OrganizationRuleset.__pulumiType, name, resourceInputs, opts);
}
}
exports.OrganizationRuleset = OrganizationRuleset;
/** @internal */
OrganizationRuleset.__pulumiType = 'github:index/organizationRuleset:OrganizationRuleset';
//# sourceMappingURL=organizationRuleset.js.map
;