@pulumi/github
Version:
A Pulumi package for creating and managing github cloud resources.
105 lines • 4.55 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.RepositoryWebhook = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource allows you to create and manage webhooks for repositories within your
* GitHub organization or personal account.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as github from "@pulumi/github";
*
* const repo = new github.Repository("repo", {
* name: "foo",
* description: "Terraform acceptance tests",
* homepageUrl: "http://example.com/",
* visibility: "public",
* });
* const foo = new github.RepositoryWebhook("foo", {
* repository: repo.name,
* configuration: {
* url: "https://google.de/",
* contentType: "form",
* insecureSsl: false,
* },
* active: false,
* events: ["issues"],
* });
* ```
*
* ## Import
*
* Repository webhooks can be imported using the `name` of the repository, combined with the `id` of the webhook, separated by a `/` character.
* The `id` of the webhook can be found in the URL of the webhook. For example: `"https://github.com/foo-org/foo-repo/settings/hooks/14711452"`.
*
* Importing uses the name of the repository, as well as the ID of the webhook, e.g.
*
* ```sh
* $ pulumi import github:index/repositoryWebhook:RepositoryWebhook terraform terraform/11235813
* ```
* If secret is populated in the webhook's configuration, the value will be imported as "********".
*/
class RepositoryWebhook extends pulumi.CustomResource {
/**
* Get an existing RepositoryWebhook 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 RepositoryWebhook(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RepositoryWebhook. 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'] === RepositoryWebhook.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["active"] = state ? state.active : undefined;
resourceInputs["configuration"] = state ? state.configuration : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["events"] = state ? state.events : undefined;
resourceInputs["repository"] = state ? state.repository : undefined;
resourceInputs["url"] = state ? state.url : undefined;
}
else {
const args = argsOrState;
if ((!args || args.events === undefined) && !opts.urn) {
throw new Error("Missing required property 'events'");
}
if ((!args || args.repository === undefined) && !opts.urn) {
throw new Error("Missing required property 'repository'");
}
resourceInputs["active"] = args ? args.active : undefined;
resourceInputs["configuration"] = args ? args.configuration : undefined;
resourceInputs["events"] = args ? args.events : undefined;
resourceInputs["repository"] = args ? args.repository : undefined;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["url"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RepositoryWebhook.__pulumiType, name, resourceInputs, opts);
}
}
exports.RepositoryWebhook = RepositoryWebhook;
/** @internal */
RepositoryWebhook.__pulumiType = 'github:index/repositoryWebhook:RepositoryWebhook';
//# sourceMappingURL=repositoryWebhook.js.map
;