/
webhook.go
153 lines (140 loc) · 6.65 KB
/
webhook.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package codepipeline
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Provides a CodePipeline Webhook.
type Webhook struct {
pulumi.CustomResourceState
// The type of authentication to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
Authentication pulumi.StringOutput `pulumi:"authentication"`
// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
AuthenticationConfiguration WebhookAuthenticationConfigurationPtrOutput `pulumi:"authenticationConfiguration"`
// One or more `filter` blocks. Filter blocks are documented below.
Filters WebhookFilterArrayOutput `pulumi:"filters"`
// The name of the webhook.
Name pulumi.StringOutput `pulumi:"name"`
// A mapping of tags to assign to the resource.
Tags pulumi.MapOutput `pulumi:"tags"`
// 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.
TargetAction pulumi.StringOutput `pulumi:"targetAction"`
// The name of the pipeline.
TargetPipeline pulumi.StringOutput `pulumi:"targetPipeline"`
// The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.
Url pulumi.StringOutput `pulumi:"url"`
}
// NewWebhook registers a new resource with the given unique name, arguments, and options.
func NewWebhook(ctx *pulumi.Context,
name string, args *WebhookArgs, opts ...pulumi.ResourceOption) (*Webhook, error) {
if args == nil || args.Authentication == nil {
return nil, errors.New("missing required argument 'Authentication'")
}
if args == nil || args.Filters == nil {
return nil, errors.New("missing required argument 'Filters'")
}
if args == nil || args.TargetAction == nil {
return nil, errors.New("missing required argument 'TargetAction'")
}
if args == nil || args.TargetPipeline == nil {
return nil, errors.New("missing required argument 'TargetPipeline'")
}
if args == nil {
args = &WebhookArgs{}
}
var resource Webhook
err := ctx.RegisterResource("aws:codepipeline/webhook:Webhook", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetWebhook gets an existing Webhook resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetWebhook(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *WebhookState, opts ...pulumi.ResourceOption) (*Webhook, error) {
var resource Webhook
err := ctx.ReadResource("aws:codepipeline/webhook:Webhook", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Webhook resources.
type webhookState struct {
// The type of authentication to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
Authentication *string `pulumi:"authentication"`
// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
AuthenticationConfiguration *WebhookAuthenticationConfiguration `pulumi:"authenticationConfiguration"`
// One or more `filter` blocks. Filter blocks are documented below.
Filters []WebhookFilter `pulumi:"filters"`
// The name of the webhook.
Name *string `pulumi:"name"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
// 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.
TargetAction *string `pulumi:"targetAction"`
// The name of the pipeline.
TargetPipeline *string `pulumi:"targetPipeline"`
// The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.
Url *string `pulumi:"url"`
}
type WebhookState struct {
// The type of authentication to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
Authentication pulumi.StringPtrInput
// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
AuthenticationConfiguration WebhookAuthenticationConfigurationPtrInput
// One or more `filter` blocks. Filter blocks are documented below.
Filters WebhookFilterArrayInput
// The name of the webhook.
Name pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
// 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.
TargetAction pulumi.StringPtrInput
// The name of the pipeline.
TargetPipeline pulumi.StringPtrInput
// The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.
Url pulumi.StringPtrInput
}
func (WebhookState) ElementType() reflect.Type {
return reflect.TypeOf((*webhookState)(nil)).Elem()
}
type webhookArgs struct {
// The type of authentication to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
Authentication string `pulumi:"authentication"`
// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
AuthenticationConfiguration *WebhookAuthenticationConfiguration `pulumi:"authenticationConfiguration"`
// One or more `filter` blocks. Filter blocks are documented below.
Filters []WebhookFilter `pulumi:"filters"`
// The name of the webhook.
Name *string `pulumi:"name"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
// 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.
TargetAction string `pulumi:"targetAction"`
// The name of the pipeline.
TargetPipeline string `pulumi:"targetPipeline"`
}
// The set of arguments for constructing a Webhook resource.
type WebhookArgs struct {
// The type of authentication to use. One of `IP`, `GITHUB_HMAC`, or `UNAUTHENTICATED`.
Authentication pulumi.StringInput
// An `auth` block. Required for `IP` and `GITHUB_HMAC`. Auth blocks are documented below.
AuthenticationConfiguration WebhookAuthenticationConfigurationPtrInput
// One or more `filter` blocks. Filter blocks are documented below.
Filters WebhookFilterArrayInput
// The name of the webhook.
Name pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
// 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.
TargetAction pulumi.StringInput
// The name of the pipeline.
TargetPipeline pulumi.StringInput
}
func (WebhookArgs) ElementType() reflect.Type {
return reflect.TypeOf((*webhookArgs)(nil)).Elem()
}