/
branchPolicyMinReviewers.go
345 lines (295 loc) · 14.2 KB
/
branchPolicyMinReviewers.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
// 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 azuredevops
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Branch policy for reviewers on pull requests. Includes the minimum number of reviewers and other conditions.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", nil)
// if err != nil {
// return err
// }
// exampleGit, err := azuredevops.NewGit(ctx, "exampleGit", &azuredevops.GitArgs{
// ProjectId: exampleProject.ID(),
// Initialization: &azuredevops.GitInitializationArgs{
// InitType: pulumi.String("Clean"),
// },
// })
// if err != nil {
// return err
// }
// _, err = azuredevops.NewBranchPolicyMinReviewers(ctx, "exampleBranchPolicyMinReviewers", &azuredevops.BranchPolicyMinReviewersArgs{
// ProjectId: exampleProject.ID(),
// Enabled: pulumi.Bool(true),
// Blocking: pulumi.Bool(true),
// Settings: &azuredevops.BranchPolicyMinReviewersSettingsArgs{
// ReviewerCount: pulumi.Int(7),
// SubmitterCanVote: pulumi.Bool(false),
// LastPusherCannotApprove: pulumi.Bool(true),
// AllowCompletionWithRejectsOrWaits: pulumi.Bool(false),
// OnPushResetApprovedVotes: pulumi.Bool(true),
// OnLastIterationRequireVote: pulumi.Bool(false),
// Scopes: azuredevops.BranchPolicyMinReviewersSettingsScopeArray{
// &azuredevops.BranchPolicyMinReviewersSettingsScopeArgs{
// RepositoryId: exampleGit.ID(),
// RepositoryRef: exampleGit.DefaultBranch,
// MatchType: pulumi.String("Exact"),
// },
// &azuredevops.BranchPolicyMinReviewersSettingsScopeArgs{
// RepositoryId: nil,
// RepositoryRef: pulumi.String("refs/heads/releases"),
// MatchType: pulumi.String("Prefix"),
// },
// &azuredevops.BranchPolicyMinReviewersSettingsScopeArgs{
// MatchType: pulumi.String("DefaultBranch"),
// },
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Relevant Links
//
// - [Azure DevOps Service REST API 7.0 - Policy Configurations](https://docs.microsoft.com/en-us/rest/api/azure/devops/policy/configurations/create?view=azure-devops-rest-7.0)
//
// ## Import
//
// Azure DevOps Branch Policies can be imported using the project ID and policy configuration ID:
//
// ```sh
// $ pulumi import azuredevops:index/branchPolicyMinReviewers:BranchPolicyMinReviewers example 00000000-0000-0000-0000-000000000000/0
// ```
type BranchPolicyMinReviewers struct {
pulumi.CustomResourceState
// A flag indicating if the policy should be blocking. Defaults to `true`.
Blocking pulumi.BoolPtrOutput `pulumi:"blocking"`
// A flag indicating if the policy should be enabled. Defaults to `true`.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// The ID of the project in which the policy will be created.
ProjectId pulumi.StringOutput `pulumi:"projectId"`
// A `settings` block as defined below.. This block must be defined exactly once.
Settings BranchPolicyMinReviewersSettingsOutput `pulumi:"settings"`
}
// NewBranchPolicyMinReviewers registers a new resource with the given unique name, arguments, and options.
func NewBranchPolicyMinReviewers(ctx *pulumi.Context,
name string, args *BranchPolicyMinReviewersArgs, opts ...pulumi.ResourceOption) (*BranchPolicyMinReviewers, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ProjectId == nil {
return nil, errors.New("invalid value for required argument 'ProjectId'")
}
if args.Settings == nil {
return nil, errors.New("invalid value for required argument 'Settings'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource BranchPolicyMinReviewers
err := ctx.RegisterResource("azuredevops:index/branchPolicyMinReviewers:BranchPolicyMinReviewers", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBranchPolicyMinReviewers gets an existing BranchPolicyMinReviewers 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 GetBranchPolicyMinReviewers(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BranchPolicyMinReviewersState, opts ...pulumi.ResourceOption) (*BranchPolicyMinReviewers, error) {
var resource BranchPolicyMinReviewers
err := ctx.ReadResource("azuredevops:index/branchPolicyMinReviewers:BranchPolicyMinReviewers", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BranchPolicyMinReviewers resources.
type branchPolicyMinReviewersState struct {
// A flag indicating if the policy should be blocking. Defaults to `true`.
Blocking *bool `pulumi:"blocking"`
// A flag indicating if the policy should be enabled. Defaults to `true`.
Enabled *bool `pulumi:"enabled"`
// The ID of the project in which the policy will be created.
ProjectId *string `pulumi:"projectId"`
// A `settings` block as defined below.. This block must be defined exactly once.
Settings *BranchPolicyMinReviewersSettings `pulumi:"settings"`
}
type BranchPolicyMinReviewersState struct {
// A flag indicating if the policy should be blocking. Defaults to `true`.
Blocking pulumi.BoolPtrInput
// A flag indicating if the policy should be enabled. Defaults to `true`.
Enabled pulumi.BoolPtrInput
// The ID of the project in which the policy will be created.
ProjectId pulumi.StringPtrInput
// A `settings` block as defined below.. This block must be defined exactly once.
Settings BranchPolicyMinReviewersSettingsPtrInput
}
func (BranchPolicyMinReviewersState) ElementType() reflect.Type {
return reflect.TypeOf((*branchPolicyMinReviewersState)(nil)).Elem()
}
type branchPolicyMinReviewersArgs struct {
// A flag indicating if the policy should be blocking. Defaults to `true`.
Blocking *bool `pulumi:"blocking"`
// A flag indicating if the policy should be enabled. Defaults to `true`.
Enabled *bool `pulumi:"enabled"`
// The ID of the project in which the policy will be created.
ProjectId string `pulumi:"projectId"`
// A `settings` block as defined below.. This block must be defined exactly once.
Settings BranchPolicyMinReviewersSettings `pulumi:"settings"`
}
// The set of arguments for constructing a BranchPolicyMinReviewers resource.
type BranchPolicyMinReviewersArgs struct {
// A flag indicating if the policy should be blocking. Defaults to `true`.
Blocking pulumi.BoolPtrInput
// A flag indicating if the policy should be enabled. Defaults to `true`.
Enabled pulumi.BoolPtrInput
// The ID of the project in which the policy will be created.
ProjectId pulumi.StringInput
// A `settings` block as defined below.. This block must be defined exactly once.
Settings BranchPolicyMinReviewersSettingsInput
}
func (BranchPolicyMinReviewersArgs) ElementType() reflect.Type {
return reflect.TypeOf((*branchPolicyMinReviewersArgs)(nil)).Elem()
}
type BranchPolicyMinReviewersInput interface {
pulumi.Input
ToBranchPolicyMinReviewersOutput() BranchPolicyMinReviewersOutput
ToBranchPolicyMinReviewersOutputWithContext(ctx context.Context) BranchPolicyMinReviewersOutput
}
func (*BranchPolicyMinReviewers) ElementType() reflect.Type {
return reflect.TypeOf((**BranchPolicyMinReviewers)(nil)).Elem()
}
func (i *BranchPolicyMinReviewers) ToBranchPolicyMinReviewersOutput() BranchPolicyMinReviewersOutput {
return i.ToBranchPolicyMinReviewersOutputWithContext(context.Background())
}
func (i *BranchPolicyMinReviewers) ToBranchPolicyMinReviewersOutputWithContext(ctx context.Context) BranchPolicyMinReviewersOutput {
return pulumi.ToOutputWithContext(ctx, i).(BranchPolicyMinReviewersOutput)
}
// BranchPolicyMinReviewersArrayInput is an input type that accepts BranchPolicyMinReviewersArray and BranchPolicyMinReviewersArrayOutput values.
// You can construct a concrete instance of `BranchPolicyMinReviewersArrayInput` via:
//
// BranchPolicyMinReviewersArray{ BranchPolicyMinReviewersArgs{...} }
type BranchPolicyMinReviewersArrayInput interface {
pulumi.Input
ToBranchPolicyMinReviewersArrayOutput() BranchPolicyMinReviewersArrayOutput
ToBranchPolicyMinReviewersArrayOutputWithContext(context.Context) BranchPolicyMinReviewersArrayOutput
}
type BranchPolicyMinReviewersArray []BranchPolicyMinReviewersInput
func (BranchPolicyMinReviewersArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BranchPolicyMinReviewers)(nil)).Elem()
}
func (i BranchPolicyMinReviewersArray) ToBranchPolicyMinReviewersArrayOutput() BranchPolicyMinReviewersArrayOutput {
return i.ToBranchPolicyMinReviewersArrayOutputWithContext(context.Background())
}
func (i BranchPolicyMinReviewersArray) ToBranchPolicyMinReviewersArrayOutputWithContext(ctx context.Context) BranchPolicyMinReviewersArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BranchPolicyMinReviewersArrayOutput)
}
// BranchPolicyMinReviewersMapInput is an input type that accepts BranchPolicyMinReviewersMap and BranchPolicyMinReviewersMapOutput values.
// You can construct a concrete instance of `BranchPolicyMinReviewersMapInput` via:
//
// BranchPolicyMinReviewersMap{ "key": BranchPolicyMinReviewersArgs{...} }
type BranchPolicyMinReviewersMapInput interface {
pulumi.Input
ToBranchPolicyMinReviewersMapOutput() BranchPolicyMinReviewersMapOutput
ToBranchPolicyMinReviewersMapOutputWithContext(context.Context) BranchPolicyMinReviewersMapOutput
}
type BranchPolicyMinReviewersMap map[string]BranchPolicyMinReviewersInput
func (BranchPolicyMinReviewersMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BranchPolicyMinReviewers)(nil)).Elem()
}
func (i BranchPolicyMinReviewersMap) ToBranchPolicyMinReviewersMapOutput() BranchPolicyMinReviewersMapOutput {
return i.ToBranchPolicyMinReviewersMapOutputWithContext(context.Background())
}
func (i BranchPolicyMinReviewersMap) ToBranchPolicyMinReviewersMapOutputWithContext(ctx context.Context) BranchPolicyMinReviewersMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BranchPolicyMinReviewersMapOutput)
}
type BranchPolicyMinReviewersOutput struct{ *pulumi.OutputState }
func (BranchPolicyMinReviewersOutput) ElementType() reflect.Type {
return reflect.TypeOf((**BranchPolicyMinReviewers)(nil)).Elem()
}
func (o BranchPolicyMinReviewersOutput) ToBranchPolicyMinReviewersOutput() BranchPolicyMinReviewersOutput {
return o
}
func (o BranchPolicyMinReviewersOutput) ToBranchPolicyMinReviewersOutputWithContext(ctx context.Context) BranchPolicyMinReviewersOutput {
return o
}
// A flag indicating if the policy should be blocking. Defaults to `true`.
func (o BranchPolicyMinReviewersOutput) Blocking() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *BranchPolicyMinReviewers) pulumi.BoolPtrOutput { return v.Blocking }).(pulumi.BoolPtrOutput)
}
// A flag indicating if the policy should be enabled. Defaults to `true`.
func (o BranchPolicyMinReviewersOutput) Enabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *BranchPolicyMinReviewers) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
}
// The ID of the project in which the policy will be created.
func (o BranchPolicyMinReviewersOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v *BranchPolicyMinReviewers) pulumi.StringOutput { return v.ProjectId }).(pulumi.StringOutput)
}
// A `settings` block as defined below.. This block must be defined exactly once.
func (o BranchPolicyMinReviewersOutput) Settings() BranchPolicyMinReviewersSettingsOutput {
return o.ApplyT(func(v *BranchPolicyMinReviewers) BranchPolicyMinReviewersSettingsOutput { return v.Settings }).(BranchPolicyMinReviewersSettingsOutput)
}
type BranchPolicyMinReviewersArrayOutput struct{ *pulumi.OutputState }
func (BranchPolicyMinReviewersArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BranchPolicyMinReviewers)(nil)).Elem()
}
func (o BranchPolicyMinReviewersArrayOutput) ToBranchPolicyMinReviewersArrayOutput() BranchPolicyMinReviewersArrayOutput {
return o
}
func (o BranchPolicyMinReviewersArrayOutput) ToBranchPolicyMinReviewersArrayOutputWithContext(ctx context.Context) BranchPolicyMinReviewersArrayOutput {
return o
}
func (o BranchPolicyMinReviewersArrayOutput) Index(i pulumi.IntInput) BranchPolicyMinReviewersOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BranchPolicyMinReviewers {
return vs[0].([]*BranchPolicyMinReviewers)[vs[1].(int)]
}).(BranchPolicyMinReviewersOutput)
}
type BranchPolicyMinReviewersMapOutput struct{ *pulumi.OutputState }
func (BranchPolicyMinReviewersMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BranchPolicyMinReviewers)(nil)).Elem()
}
func (o BranchPolicyMinReviewersMapOutput) ToBranchPolicyMinReviewersMapOutput() BranchPolicyMinReviewersMapOutput {
return o
}
func (o BranchPolicyMinReviewersMapOutput) ToBranchPolicyMinReviewersMapOutputWithContext(ctx context.Context) BranchPolicyMinReviewersMapOutput {
return o
}
func (o BranchPolicyMinReviewersMapOutput) MapIndex(k pulumi.StringInput) BranchPolicyMinReviewersOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BranchPolicyMinReviewers {
return vs[0].(map[string]*BranchPolicyMinReviewers)[vs[1].(string)]
}).(BranchPolicyMinReviewersOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BranchPolicyMinReviewersInput)(nil)).Elem(), &BranchPolicyMinReviewers{})
pulumi.RegisterInputType(reflect.TypeOf((*BranchPolicyMinReviewersArrayInput)(nil)).Elem(), BranchPolicyMinReviewersArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BranchPolicyMinReviewersMapInput)(nil)).Elem(), BranchPolicyMinReviewersMap{})
pulumi.RegisterOutputType(BranchPolicyMinReviewersOutput{})
pulumi.RegisterOutputType(BranchPolicyMinReviewersArrayOutput{})
pulumi.RegisterOutputType(BranchPolicyMinReviewersMapOutput{})
}