generated from pulumi/pulumi-tf-provider-boilerplate
/
dockerWebhook.go
365 lines (313 loc) · 13.7 KB
/
dockerWebhook.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package artifactory
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an Artifactory webhook resource. This can be used to register and manage Artifactory webhook subscription which enables you to be notified or notify other users when such events take place in Artifactory.
//
// ## Example Usage
//
// .
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-artifactory/sdk/v3/go/artifactory"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := artifactory.NewDockerV2Repository(ctx, "my-docker-local", &artifactory.DockerV2RepositoryArgs{
// Key: pulumi.String("my-docker-local"),
// })
// if err != nil {
// return err
// }
// _, err = artifactory.NewDockerWebhook(ctx, "docker-webhook", &artifactory.DockerWebhookArgs{
// Key: pulumi.String("docker-webhook"),
// EventTypes: pulumi.StringArray{
// pulumi.String("pushed"),
// pulumi.String("deleted"),
// pulumi.String("promoted"),
// },
// Criteria: &artifactory.DockerWebhookCriteriaArgs{
// AnyLocal: pulumi.Bool(true),
// AnyRemote: pulumi.Bool(false),
// RepoKeys: pulumi.StringArray{
// my_docker_local.Key,
// },
// IncludePatterns: pulumi.StringArray{
// pulumi.String("foo/**"),
// },
// ExcludePatterns: pulumi.StringArray{
// pulumi.String("bar/**"),
// },
// },
// Handlers: artifactory.DockerWebhookHandlerArray{
// &artifactory.DockerWebhookHandlerArgs{
// Url: pulumi.String("http://tempurl.org/webhook"),
// Secret: pulumi.String("some-secret"),
// Proxy: pulumi.String("proxy-key"),
// CustomHttpHeaders: pulumi.StringMap{
// "header-1": pulumi.String("value-1"),
// "header-2": pulumi.String("value-2"),
// },
// },
// },
// }, pulumi.DependsOn([]pulumi.Resource{
// my_docker_local,
// }))
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type DockerWebhook struct {
pulumi.CustomResourceState
// Specifies where the webhook will be applied on which repositories.
Criteria DockerWebhookCriteriaOutput `pulumi:"criteria"`
// Webhook description. Max length 1000 characters.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Status of webhook. Default to `true`.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// List of Events in Artifactory, Distribution, Release Bundle that function as the event trigger for the Webhook. Allow values: `pushed`, `deleted`, `promoted`.
EventTypes pulumi.StringArrayOutput `pulumi:"eventTypes"`
// At least one is required.
Handlers DockerWebhookHandlerArrayOutput `pulumi:"handlers"`
// The identity key of the webhook. Must be between 2 and 200 characters. Cannot contain spaces.
Key pulumi.StringOutput `pulumi:"key"`
}
// NewDockerWebhook registers a new resource with the given unique name, arguments, and options.
func NewDockerWebhook(ctx *pulumi.Context,
name string, args *DockerWebhookArgs, opts ...pulumi.ResourceOption) (*DockerWebhook, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Criteria == nil {
return nil, errors.New("invalid value for required argument 'Criteria'")
}
if args.EventTypes == nil {
return nil, errors.New("invalid value for required argument 'EventTypes'")
}
if args.Handlers == nil {
return nil, errors.New("invalid value for required argument 'Handlers'")
}
if args.Key == nil {
return nil, errors.New("invalid value for required argument 'Key'")
}
var resource DockerWebhook
err := ctx.RegisterResource("artifactory:index/dockerWebhook:DockerWebhook", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetDockerWebhook gets an existing DockerWebhook 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 GetDockerWebhook(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *DockerWebhookState, opts ...pulumi.ResourceOption) (*DockerWebhook, error) {
var resource DockerWebhook
err := ctx.ReadResource("artifactory:index/dockerWebhook:DockerWebhook", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering DockerWebhook resources.
type dockerWebhookState struct {
// Specifies where the webhook will be applied on which repositories.
Criteria *DockerWebhookCriteria `pulumi:"criteria"`
// Webhook description. Max length 1000 characters.
Description *string `pulumi:"description"`
// Status of webhook. Default to `true`.
Enabled *bool `pulumi:"enabled"`
// List of Events in Artifactory, Distribution, Release Bundle that function as the event trigger for the Webhook. Allow values: `pushed`, `deleted`, `promoted`.
EventTypes []string `pulumi:"eventTypes"`
// At least one is required.
Handlers []DockerWebhookHandler `pulumi:"handlers"`
// The identity key of the webhook. Must be between 2 and 200 characters. Cannot contain spaces.
Key *string `pulumi:"key"`
}
type DockerWebhookState struct {
// Specifies where the webhook will be applied on which repositories.
Criteria DockerWebhookCriteriaPtrInput
// Webhook description. Max length 1000 characters.
Description pulumi.StringPtrInput
// Status of webhook. Default to `true`.
Enabled pulumi.BoolPtrInput
// List of Events in Artifactory, Distribution, Release Bundle that function as the event trigger for the Webhook. Allow values: `pushed`, `deleted`, `promoted`.
EventTypes pulumi.StringArrayInput
// At least one is required.
Handlers DockerWebhookHandlerArrayInput
// The identity key of the webhook. Must be between 2 and 200 characters. Cannot contain spaces.
Key pulumi.StringPtrInput
}
func (DockerWebhookState) ElementType() reflect.Type {
return reflect.TypeOf((*dockerWebhookState)(nil)).Elem()
}
type dockerWebhookArgs struct {
// Specifies where the webhook will be applied on which repositories.
Criteria DockerWebhookCriteria `pulumi:"criteria"`
// Webhook description. Max length 1000 characters.
Description *string `pulumi:"description"`
// Status of webhook. Default to `true`.
Enabled *bool `pulumi:"enabled"`
// List of Events in Artifactory, Distribution, Release Bundle that function as the event trigger for the Webhook. Allow values: `pushed`, `deleted`, `promoted`.
EventTypes []string `pulumi:"eventTypes"`
// At least one is required.
Handlers []DockerWebhookHandler `pulumi:"handlers"`
// The identity key of the webhook. Must be between 2 and 200 characters. Cannot contain spaces.
Key string `pulumi:"key"`
}
// The set of arguments for constructing a DockerWebhook resource.
type DockerWebhookArgs struct {
// Specifies where the webhook will be applied on which repositories.
Criteria DockerWebhookCriteriaInput
// Webhook description. Max length 1000 characters.
Description pulumi.StringPtrInput
// Status of webhook. Default to `true`.
Enabled pulumi.BoolPtrInput
// List of Events in Artifactory, Distribution, Release Bundle that function as the event trigger for the Webhook. Allow values: `pushed`, `deleted`, `promoted`.
EventTypes pulumi.StringArrayInput
// At least one is required.
Handlers DockerWebhookHandlerArrayInput
// The identity key of the webhook. Must be between 2 and 200 characters. Cannot contain spaces.
Key pulumi.StringInput
}
func (DockerWebhookArgs) ElementType() reflect.Type {
return reflect.TypeOf((*dockerWebhookArgs)(nil)).Elem()
}
type DockerWebhookInput interface {
pulumi.Input
ToDockerWebhookOutput() DockerWebhookOutput
ToDockerWebhookOutputWithContext(ctx context.Context) DockerWebhookOutput
}
func (*DockerWebhook) ElementType() reflect.Type {
return reflect.TypeOf((**DockerWebhook)(nil)).Elem()
}
func (i *DockerWebhook) ToDockerWebhookOutput() DockerWebhookOutput {
return i.ToDockerWebhookOutputWithContext(context.Background())
}
func (i *DockerWebhook) ToDockerWebhookOutputWithContext(ctx context.Context) DockerWebhookOutput {
return pulumi.ToOutputWithContext(ctx, i).(DockerWebhookOutput)
}
// DockerWebhookArrayInput is an input type that accepts DockerWebhookArray and DockerWebhookArrayOutput values.
// You can construct a concrete instance of `DockerWebhookArrayInput` via:
//
// DockerWebhookArray{ DockerWebhookArgs{...} }
type DockerWebhookArrayInput interface {
pulumi.Input
ToDockerWebhookArrayOutput() DockerWebhookArrayOutput
ToDockerWebhookArrayOutputWithContext(context.Context) DockerWebhookArrayOutput
}
type DockerWebhookArray []DockerWebhookInput
func (DockerWebhookArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*DockerWebhook)(nil)).Elem()
}
func (i DockerWebhookArray) ToDockerWebhookArrayOutput() DockerWebhookArrayOutput {
return i.ToDockerWebhookArrayOutputWithContext(context.Background())
}
func (i DockerWebhookArray) ToDockerWebhookArrayOutputWithContext(ctx context.Context) DockerWebhookArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(DockerWebhookArrayOutput)
}
// DockerWebhookMapInput is an input type that accepts DockerWebhookMap and DockerWebhookMapOutput values.
// You can construct a concrete instance of `DockerWebhookMapInput` via:
//
// DockerWebhookMap{ "key": DockerWebhookArgs{...} }
type DockerWebhookMapInput interface {
pulumi.Input
ToDockerWebhookMapOutput() DockerWebhookMapOutput
ToDockerWebhookMapOutputWithContext(context.Context) DockerWebhookMapOutput
}
type DockerWebhookMap map[string]DockerWebhookInput
func (DockerWebhookMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*DockerWebhook)(nil)).Elem()
}
func (i DockerWebhookMap) ToDockerWebhookMapOutput() DockerWebhookMapOutput {
return i.ToDockerWebhookMapOutputWithContext(context.Background())
}
func (i DockerWebhookMap) ToDockerWebhookMapOutputWithContext(ctx context.Context) DockerWebhookMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(DockerWebhookMapOutput)
}
type DockerWebhookOutput struct{ *pulumi.OutputState }
func (DockerWebhookOutput) ElementType() reflect.Type {
return reflect.TypeOf((**DockerWebhook)(nil)).Elem()
}
func (o DockerWebhookOutput) ToDockerWebhookOutput() DockerWebhookOutput {
return o
}
func (o DockerWebhookOutput) ToDockerWebhookOutputWithContext(ctx context.Context) DockerWebhookOutput {
return o
}
// Specifies where the webhook will be applied on which repositories.
func (o DockerWebhookOutput) Criteria() DockerWebhookCriteriaOutput {
return o.ApplyT(func(v *DockerWebhook) DockerWebhookCriteriaOutput { return v.Criteria }).(DockerWebhookCriteriaOutput)
}
// Webhook description. Max length 1000 characters.
func (o DockerWebhookOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *DockerWebhook) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// Status of webhook. Default to `true`.
func (o DockerWebhookOutput) Enabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *DockerWebhook) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
}
// List of Events in Artifactory, Distribution, Release Bundle that function as the event trigger for the Webhook. Allow values: `pushed`, `deleted`, `promoted`.
func (o DockerWebhookOutput) EventTypes() pulumi.StringArrayOutput {
return o.ApplyT(func(v *DockerWebhook) pulumi.StringArrayOutput { return v.EventTypes }).(pulumi.StringArrayOutput)
}
// At least one is required.
func (o DockerWebhookOutput) Handlers() DockerWebhookHandlerArrayOutput {
return o.ApplyT(func(v *DockerWebhook) DockerWebhookHandlerArrayOutput { return v.Handlers }).(DockerWebhookHandlerArrayOutput)
}
// The identity key of the webhook. Must be between 2 and 200 characters. Cannot contain spaces.
func (o DockerWebhookOutput) Key() pulumi.StringOutput {
return o.ApplyT(func(v *DockerWebhook) pulumi.StringOutput { return v.Key }).(pulumi.StringOutput)
}
type DockerWebhookArrayOutput struct{ *pulumi.OutputState }
func (DockerWebhookArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*DockerWebhook)(nil)).Elem()
}
func (o DockerWebhookArrayOutput) ToDockerWebhookArrayOutput() DockerWebhookArrayOutput {
return o
}
func (o DockerWebhookArrayOutput) ToDockerWebhookArrayOutputWithContext(ctx context.Context) DockerWebhookArrayOutput {
return o
}
func (o DockerWebhookArrayOutput) Index(i pulumi.IntInput) DockerWebhookOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DockerWebhook {
return vs[0].([]*DockerWebhook)[vs[1].(int)]
}).(DockerWebhookOutput)
}
type DockerWebhookMapOutput struct{ *pulumi.OutputState }
func (DockerWebhookMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*DockerWebhook)(nil)).Elem()
}
func (o DockerWebhookMapOutput) ToDockerWebhookMapOutput() DockerWebhookMapOutput {
return o
}
func (o DockerWebhookMapOutput) ToDockerWebhookMapOutputWithContext(ctx context.Context) DockerWebhookMapOutput {
return o
}
func (o DockerWebhookMapOutput) MapIndex(k pulumi.StringInput) DockerWebhookOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DockerWebhook {
return vs[0].(map[string]*DockerWebhook)[vs[1].(string)]
}).(DockerWebhookOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*DockerWebhookInput)(nil)).Elem(), &DockerWebhook{})
pulumi.RegisterInputType(reflect.TypeOf((*DockerWebhookArrayInput)(nil)).Elem(), DockerWebhookArray{})
pulumi.RegisterInputType(reflect.TypeOf((*DockerWebhookMapInput)(nil)).Elem(), DockerWebhookMap{})
pulumi.RegisterOutputType(DockerWebhookOutput{})
pulumi.RegisterOutputType(DockerWebhookArrayOutput{})
pulumi.RegisterOutputType(DockerWebhookMapOutput{})
}