@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
177 lines • 6.52 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.Webhook = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a CodePipeline Webhook.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* import * as github from "@pulumi/github";
*
* const bar = new aws.codepipeline.Pipeline("bar", {
* name: "tf-test-pipeline",
* roleArn: barAwsIamRole.arn,
* artifactStores: [{
* location: barAwsS3Bucket.bucket,
* type: "S3",
* encryptionKey: {
* id: s3kmskey.arn,
* type: "KMS",
* },
* }],
* stages: [
* {
* name: "Source",
* actions: [{
* name: "Source",
* category: "Source",
* owner: "ThirdParty",
* provider: "GitHub",
* version: "1",
* outputArtifacts: ["test"],
* configuration: {
* Owner: "my-organization",
* Repo: "test",
* Branch: "master",
* },
* }],
* },
* {
* name: "Build",
* actions: [{
* name: "Build",
* category: "Build",
* owner: "AWS",
* provider: "CodeBuild",
* inputArtifacts: ["test"],
* version: "1",
* configuration: {
* ProjectName: "test",
* },
* }],
* },
* ],
* });
* const webhookSecret = "super-secret";
* const barWebhook = new aws.codepipeline.Webhook("bar", {
* name: "test-webhook-github-bar",
* authentication: "GITHUB_HMAC",
* targetAction: "Source",
* targetPipeline: bar.name,
* authenticationConfiguration: {
* secretToken: webhookSecret,
* },
* filters: [{
* jsonPath: "$.ref",
* matchEquals: "refs/heads/{Branch}",
* }],
* });
* // Wire the CodePipeline webhook into a GitHub repository.
* const barRepositoryWebhook = new github.RepositoryWebhook("bar", {
* repository: repo.name,
* name: "web",
* configuration: [{
* url: barWebhook.url,
* contentType: "json",
* insecureSsl: true,
* secret: webhookSecret,
* }],
* events: ["push"],
* });
* ```
*
* ## Import
*
* ### Identity Schema
*
* #### Required
*
* - `arn` (String) Amazon Resource Name (ARN) of the CodePipeline webhook.
*
* Using `pulumi import`, import CodePipeline Webhooks using their ARN. For example:
*
* console
*
* % pulumi import aws_codepipeline_webhook.example arn:aws:codepipeline:us-west-2:123456789012:webhook:example
*/
class Webhook extends pulumi.CustomResource {
/**
* Get an existing Webhook 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 Webhook(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Webhook. 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'] === Webhook.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["authentication"] = state?.authentication;
resourceInputs["authenticationConfiguration"] = state?.authenticationConfiguration;
resourceInputs["filters"] = state?.filters;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["targetAction"] = state?.targetAction;
resourceInputs["targetPipeline"] = state?.targetPipeline;
resourceInputs["url"] = state?.url;
}
else {
const args = argsOrState;
if (args?.authentication === undefined && !opts.urn) {
throw new Error("Missing required property 'authentication'");
}
if (args?.filters === undefined && !opts.urn) {
throw new Error("Missing required property 'filters'");
}
if (args?.targetAction === undefined && !opts.urn) {
throw new Error("Missing required property 'targetAction'");
}
if (args?.targetPipeline === undefined && !opts.urn) {
throw new Error("Missing required property 'targetPipeline'");
}
resourceInputs["authentication"] = args?.authentication;
resourceInputs["authenticationConfiguration"] = args?.authenticationConfiguration;
resourceInputs["filters"] = args?.filters;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["targetAction"] = args?.targetAction;
resourceInputs["targetPipeline"] = args?.targetPipeline;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["url"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Webhook.__pulumiType, name, resourceInputs, opts);
}
}
exports.Webhook = Webhook;
/** @internal */
Webhook.__pulumiType = 'aws:codepipeline/webhook:Webhook';
//# sourceMappingURL=webhook.js.map