Skip to content
v2.277.0

CfnWebhookProps Struct ​

Properties for defining a CfnWebhook.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_codepipeline as codepipeline } from 'aws-cdk-lib';
const cfnWebhookProps: codepipeline.CfnWebhookProps = {
  authentication: 'authentication',
  authenticationConfiguration: {
    allowedIpRange: 'allowedIpRange',
    secretToken: 'secretToken',
  },
  filters: [{
    jsonPath: 'jsonPath',

    // the properties below are optional
    matchEquals: 'matchEquals',
  }],
  targetAction: 'targetAction',
  targetPipeline: 'targetPipeline',

  // the properties below are optional
  name: 'name',
  registerWithThirdParty: false,
  tags: [{
    key: 'key',
    value: 'value',
  }],
  targetPipelineVersion: 123,
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_codepipeline as codepipeline

cfn_webhook_props = codepipeline.CfnWebhookProps(
    authentication="authentication",
    authentication_configuration=codepipeline.CfnWebhook.WebhookAuthConfigurationProperty(
        allowed_ip_range="allowedIpRange",
        secret_token="secretToken"
    ),
    filters=[codepipeline.CfnWebhook.WebhookFilterRuleProperty(
        json_path="jsonPath",

        # the properties below are optional
        match_equals="matchEquals"
    )],
    target_action="targetAction",
    target_pipeline="targetPipeline",

    # the properties below are optional
    name="name",
    register_with_third_party=False,
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    target_pipeline_version=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.codepipeline.*;

CfnWebhookProps cfnWebhookProps = CfnWebhookProps.builder()
        .authentication("authentication")
        .authenticationConfiguration(WebhookAuthConfigurationProperty.builder()
                .allowedIpRange("allowedIpRange")
                .secretToken("secretToken")
                .build())
        .filters(List.of(WebhookFilterRuleProperty.builder()
                .jsonPath("jsonPath")

                // the properties below are optional
                .matchEquals("matchEquals")
                .build()))
        .targetAction("targetAction")
        .targetPipeline("targetPipeline")

        // the properties below are optional
        .name("name")
        .registerWithThirdParty(false)
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .targetPipelineVersion(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CodePipeline;

var cfnWebhookProps = new CfnWebhookProps {
    Authentication = "authentication",
    AuthenticationConfiguration = new WebhookAuthConfigurationProperty {
        AllowedIpRange = "allowedIpRange",
        SecretToken = "secretToken"
    },
    Filters = new [] { new WebhookFilterRuleProperty {
        JsonPath = "jsonPath",

        // the properties below are optional
        MatchEquals = "matchEquals"
    } },
    TargetAction = "targetAction",
    TargetPipeline = "targetPipeline",

    // the properties below are optional
    Name = "name",
    RegisterWithThirdParty = false,
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    TargetPipelineVersion = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnWebhookProps := &CfnWebhookProps{
	Authentication: jsii.String("authentication"),
	AuthenticationConfiguration: &WebhookAuthConfigurationProperty{
		AllowedIpRange: jsii.String("allowedIpRange"),
		SecretToken: jsii.String("secretToken"),
	},
	Filters: []interface{}{
		&WebhookFilterRuleProperty{
			JsonPath: jsii.String("jsonPath"),

			// the properties below are optional
			MatchEquals: jsii.String("matchEquals"),
		},
	},
	TargetAction: jsii.String("targetAction"),
	TargetPipeline: jsii.String("targetPipeline"),

	// the properties below are optional
	Name: jsii.String("name"),
	RegisterWithThirdParty: jsii.Boolean(false),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	TargetPipelineVersion: jsii.Number(123),
}

Properties ​

authenticationstringauthenticationstrauthenticationStringAuthenticationstringAuthentication*stringrequired#
Supported options are GITHUB_HMAC, IP, and UNAUTHENTICATED.
notes

When creating CodePipeline webhooks, do not use your own credentials or reuse the same secret token across multiple webhooks. For optimal security, generate a unique secret token for each webhook you create. The secret token is an arbitrary string that you provide, which GitHub uses to compute and sign the webhook payloads sent to CodePipeline, for protecting the integrity and authenticity of the webhook payloads. Using your own credentials or reusing the same token across multiple webhooks can lead to security vulnerabilities. > If a secret token was provided, it will be redacted in the response.

  • For information about the authentication scheme implemented by GITHUB_HMAC, see Securing your webhooks on the GitHub Developer website.
  • IP rejects webhooks trigger requests unless they originate from an IP address in the IP range whitelisted in the authentication configuration.
  • UNAUTHENTICATED accepts all webhook trigger requests regardless of origin.
authenticationConfigurationIResolvable | CfnWebhook.WebhookAuthConfigurationPropertyauthentication_configurationtyping.Union[IResolvable, WebhookAuthConfigurationProperty]authenticationConfigurationIResolvableAuthenticationConfigurationIResolvableAuthenticationConfigurationinterface{}required#
Properties that configure the authentication applied to incoming webhook trigger requests.
notes

The required properties depend on the authentication type. For GITHUB_HMAC, only the SecretToken property must be set. For IP, only the AllowedIPRange property must be set to a valid CIDR range. For UNAUTHENTICATED, no properties can be set.

filtersIResolvable | IResolvable | CfnWebhook.WebhookFilterRuleProperty[]filterstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, WebhookFilterRuleProperty]]]filtersIResolvableFiltersIResolvableFiltersinterface{}required#
A list of rules applied to the body/payload sent in the POST request to a webhook URL.

All defined rules must pass for the request to be accepted and the pipeline started.

nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string#
The name of the webhook.
registerWithThirdPartyoptionalboolean | IResolvableregister_with_third_partyoptionaltyping.Union[bool, IResolvable]registerWithThirdPartyoptionalBooleanRegisterWithThirdPartyoptionalboolRegisterWithThirdPartyoptionalinterface{}#
Configures a connection between the webhook that was created and the external tool with events to be detected.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag#
An array of key-value pairs to apply to this resource.
targetActionstringtarget_actionstrtargetActionStringTargetActionstringTargetAction*stringrequired#
The name of the action in a pipeline you want to connect to the webhook.

The action must be from the source (first) stage of the pipeline.

targetPipelinestringtarget_pipelinestrtargetPipelineStringTargetPipelinestringTargetPipeline*stringrequired#
The name of the pipeline you want to connect to the webhook.
targetPipelineVersionoptionalnumbertarget_pipeline_versionoptionalint | floattargetPipelineVersionoptionalNumberTargetPipelineVersionoptionaldoubleTargetPipelineVersionoptional*float64#
The version number of the pipeline to be connected to the trigger request.

Required: Yes

Type: Integer

Update requires: No interruption