/
webhook.go
116 lines (103 loc) · 5.07 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
// *** 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 codebuild
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages a CodeBuild webhook, which is an endpoint accepted by the CodeBuild service to trigger builds from source code repositories. Depending on the source type of the CodeBuild project, the CodeBuild service may also automatically create and delete the actual repository webhook as well.
type Webhook struct {
pulumi.CustomResourceState
// A regular expression used to determine which branches get built. Default is all branches are built. It is recommended to use `filterGroup` over `branchFilter`.
BranchFilter pulumi.StringPtrOutput `pulumi:"branchFilter"`
// Information about the webhook's trigger. Filter group blocks are documented below.
FilterGroups WebhookFilterGroupArrayOutput `pulumi:"filterGroups"`
// The CodeBuild endpoint where webhook events are sent.
PayloadUrl pulumi.StringOutput `pulumi:"payloadUrl"`
// The name of the build project.
ProjectName pulumi.StringOutput `pulumi:"projectName"`
// The secret token of the associated repository. Not returned by the CodeBuild API for all source types.
Secret pulumi.StringOutput `pulumi:"secret"`
// The URL to the webhook.
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.ProjectName == nil {
return nil, errors.New("missing required argument 'ProjectName'")
}
if args == nil {
args = &WebhookArgs{}
}
var resource Webhook
err := ctx.RegisterResource("aws:codebuild/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:codebuild/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 {
// A regular expression used to determine which branches get built. Default is all branches are built. It is recommended to use `filterGroup` over `branchFilter`.
BranchFilter *string `pulumi:"branchFilter"`
// Information about the webhook's trigger. Filter group blocks are documented below.
FilterGroups []WebhookFilterGroup `pulumi:"filterGroups"`
// The CodeBuild endpoint where webhook events are sent.
PayloadUrl *string `pulumi:"payloadUrl"`
// The name of the build project.
ProjectName *string `pulumi:"projectName"`
// The secret token of the associated repository. Not returned by the CodeBuild API for all source types.
Secret *string `pulumi:"secret"`
// The URL to the webhook.
Url *string `pulumi:"url"`
}
type WebhookState struct {
// A regular expression used to determine which branches get built. Default is all branches are built. It is recommended to use `filterGroup` over `branchFilter`.
BranchFilter pulumi.StringPtrInput
// Information about the webhook's trigger. Filter group blocks are documented below.
FilterGroups WebhookFilterGroupArrayInput
// The CodeBuild endpoint where webhook events are sent.
PayloadUrl pulumi.StringPtrInput
// The name of the build project.
ProjectName pulumi.StringPtrInput
// The secret token of the associated repository. Not returned by the CodeBuild API for all source types.
Secret pulumi.StringPtrInput
// The URL to the webhook.
Url pulumi.StringPtrInput
}
func (WebhookState) ElementType() reflect.Type {
return reflect.TypeOf((*webhookState)(nil)).Elem()
}
type webhookArgs struct {
// A regular expression used to determine which branches get built. Default is all branches are built. It is recommended to use `filterGroup` over `branchFilter`.
BranchFilter *string `pulumi:"branchFilter"`
// Information about the webhook's trigger. Filter group blocks are documented below.
FilterGroups []WebhookFilterGroup `pulumi:"filterGroups"`
// The name of the build project.
ProjectName string `pulumi:"projectName"`
}
// The set of arguments for constructing a Webhook resource.
type WebhookArgs struct {
// A regular expression used to determine which branches get built. Default is all branches are built. It is recommended to use `filterGroup` over `branchFilter`.
BranchFilter pulumi.StringPtrInput
// Information about the webhook's trigger. Filter group blocks are documented below.
FilterGroups WebhookFilterGroupArrayInput
// The name of the build project.
ProjectName pulumi.StringInput
}
func (WebhookArgs) ElementType() reflect.Type {
return reflect.TypeOf((*webhookArgs)(nil)).Elem()
}