generated from pulumi/pulumi-tf-provider-boilerplate
/
bucketLockConfiguration.go
337 lines (287 loc) · 13 KB
/
bucketLockConfiguration.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
// 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 objectstorage
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/raeumlich/pulumi-scaleway/sdk/go/scaleway/internal"
)
// Provides an Object bucket lock configuration resource.
// For more information, see [Setting up object lock](https://www.scaleway.com/en/docs/storage/object/api-cli/object-lock/).
//
// ## Example Usage
//
// ### Configure an Object Lock for a new bucket
//
// Please note that `objectLockEnabled` must be set to `true` before configuring the lock.
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/raeumlich/pulumi-scaleway/sdk/go/scaleway/objectstorage"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// mainBucket, err := objectstorage.NewBucket(ctx, "mainBucket", &objectstorage.BucketArgs{
// Acl: pulumi.String("public-read"),
// ObjectLockEnabled: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// _, err = objectstorage.NewBucketLockConfiguration(ctx, "mainBucketLockConfiguration", &objectstorage.BucketLockConfigurationArgs{
// Bucket: mainBucket.Name,
// Rule: &objectstorage.BucketLockConfigurationRuleArgs{
// DefaultRetention: &objectstorage.BucketLockConfigurationRuleDefaultRetentionArgs{
// Mode: pulumi.String("GOVERNANCE"),
// Days: pulumi.Int(1),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ### Configure an Object Lock for an existing bucket
//
// You should [contact Scaleway support](https://console.scaleway.com/support/tickets/create) to enable object lock on an existing bucket.
//
// ## Import
//
// Bucket lock configurations can be imported using the `{region}/{bucketName}` identifier, e.g.
//
// bash
//
// ```sh
// $ pulumi import scaleway:objectstorage/bucketLockConfiguration:BucketLockConfiguration some_bucket fr-par/some-bucket
// ```
//
// ~> **Important:** The `project_id` attribute has a particular behavior with s3 products because the s3 API is scoped by project.
//
// If you are using a project different from the default one, you have to specify the project ID at the end of the import command.
//
// bash
//
// ```sh
// $ pulumi import scaleway:objectstorage/bucketLockConfiguration:BucketLockConfiguration some_bucket fr-par/some-bucket@xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
// ```
type BucketLockConfiguration struct {
pulumi.CustomResourceState
// The bucket's name or regional ID.
Bucket pulumi.StringOutput `pulumi:"bucket"`
// The project_id you want to attach the resource to
ProjectId pulumi.StringOutput `pulumi:"projectId"`
// The region you want to attach the resource to
Region pulumi.StringOutput `pulumi:"region"`
// Specifies the Object Lock rule for the specified object.
Rule BucketLockConfigurationRuleOutput `pulumi:"rule"`
}
// NewBucketLockConfiguration registers a new resource with the given unique name, arguments, and options.
func NewBucketLockConfiguration(ctx *pulumi.Context,
name string, args *BucketLockConfigurationArgs, opts ...pulumi.ResourceOption) (*BucketLockConfiguration, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Bucket == nil {
return nil, errors.New("invalid value for required argument 'Bucket'")
}
if args.Rule == nil {
return nil, errors.New("invalid value for required argument 'Rule'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource BucketLockConfiguration
err := ctx.RegisterResource("scaleway:objectstorage/bucketLockConfiguration:BucketLockConfiguration", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBucketLockConfiguration gets an existing BucketLockConfiguration 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 GetBucketLockConfiguration(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BucketLockConfigurationState, opts ...pulumi.ResourceOption) (*BucketLockConfiguration, error) {
var resource BucketLockConfiguration
err := ctx.ReadResource("scaleway:objectstorage/bucketLockConfiguration:BucketLockConfiguration", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BucketLockConfiguration resources.
type bucketLockConfigurationState struct {
// The bucket's name or regional ID.
Bucket *string `pulumi:"bucket"`
// The project_id you want to attach the resource to
ProjectId *string `pulumi:"projectId"`
// The region you want to attach the resource to
Region *string `pulumi:"region"`
// Specifies the Object Lock rule for the specified object.
Rule *BucketLockConfigurationRule `pulumi:"rule"`
}
type BucketLockConfigurationState struct {
// The bucket's name or regional ID.
Bucket pulumi.StringPtrInput
// The project_id you want to attach the resource to
ProjectId pulumi.StringPtrInput
// The region you want to attach the resource to
Region pulumi.StringPtrInput
// Specifies the Object Lock rule for the specified object.
Rule BucketLockConfigurationRulePtrInput
}
func (BucketLockConfigurationState) ElementType() reflect.Type {
return reflect.TypeOf((*bucketLockConfigurationState)(nil)).Elem()
}
type bucketLockConfigurationArgs struct {
// The bucket's name or regional ID.
Bucket string `pulumi:"bucket"`
// The project_id you want to attach the resource to
ProjectId *string `pulumi:"projectId"`
// The region you want to attach the resource to
Region *string `pulumi:"region"`
// Specifies the Object Lock rule for the specified object.
Rule BucketLockConfigurationRule `pulumi:"rule"`
}
// The set of arguments for constructing a BucketLockConfiguration resource.
type BucketLockConfigurationArgs struct {
// The bucket's name or regional ID.
Bucket pulumi.StringInput
// The project_id you want to attach the resource to
ProjectId pulumi.StringPtrInput
// The region you want to attach the resource to
Region pulumi.StringPtrInput
// Specifies the Object Lock rule for the specified object.
Rule BucketLockConfigurationRuleInput
}
func (BucketLockConfigurationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*bucketLockConfigurationArgs)(nil)).Elem()
}
type BucketLockConfigurationInput interface {
pulumi.Input
ToBucketLockConfigurationOutput() BucketLockConfigurationOutput
ToBucketLockConfigurationOutputWithContext(ctx context.Context) BucketLockConfigurationOutput
}
func (*BucketLockConfiguration) ElementType() reflect.Type {
return reflect.TypeOf((**BucketLockConfiguration)(nil)).Elem()
}
func (i *BucketLockConfiguration) ToBucketLockConfigurationOutput() BucketLockConfigurationOutput {
return i.ToBucketLockConfigurationOutputWithContext(context.Background())
}
func (i *BucketLockConfiguration) ToBucketLockConfigurationOutputWithContext(ctx context.Context) BucketLockConfigurationOutput {
return pulumi.ToOutputWithContext(ctx, i).(BucketLockConfigurationOutput)
}
// BucketLockConfigurationArrayInput is an input type that accepts BucketLockConfigurationArray and BucketLockConfigurationArrayOutput values.
// You can construct a concrete instance of `BucketLockConfigurationArrayInput` via:
//
// BucketLockConfigurationArray{ BucketLockConfigurationArgs{...} }
type BucketLockConfigurationArrayInput interface {
pulumi.Input
ToBucketLockConfigurationArrayOutput() BucketLockConfigurationArrayOutput
ToBucketLockConfigurationArrayOutputWithContext(context.Context) BucketLockConfigurationArrayOutput
}
type BucketLockConfigurationArray []BucketLockConfigurationInput
func (BucketLockConfigurationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BucketLockConfiguration)(nil)).Elem()
}
func (i BucketLockConfigurationArray) ToBucketLockConfigurationArrayOutput() BucketLockConfigurationArrayOutput {
return i.ToBucketLockConfigurationArrayOutputWithContext(context.Background())
}
func (i BucketLockConfigurationArray) ToBucketLockConfigurationArrayOutputWithContext(ctx context.Context) BucketLockConfigurationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BucketLockConfigurationArrayOutput)
}
// BucketLockConfigurationMapInput is an input type that accepts BucketLockConfigurationMap and BucketLockConfigurationMapOutput values.
// You can construct a concrete instance of `BucketLockConfigurationMapInput` via:
//
// BucketLockConfigurationMap{ "key": BucketLockConfigurationArgs{...} }
type BucketLockConfigurationMapInput interface {
pulumi.Input
ToBucketLockConfigurationMapOutput() BucketLockConfigurationMapOutput
ToBucketLockConfigurationMapOutputWithContext(context.Context) BucketLockConfigurationMapOutput
}
type BucketLockConfigurationMap map[string]BucketLockConfigurationInput
func (BucketLockConfigurationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BucketLockConfiguration)(nil)).Elem()
}
func (i BucketLockConfigurationMap) ToBucketLockConfigurationMapOutput() BucketLockConfigurationMapOutput {
return i.ToBucketLockConfigurationMapOutputWithContext(context.Background())
}
func (i BucketLockConfigurationMap) ToBucketLockConfigurationMapOutputWithContext(ctx context.Context) BucketLockConfigurationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BucketLockConfigurationMapOutput)
}
type BucketLockConfigurationOutput struct{ *pulumi.OutputState }
func (BucketLockConfigurationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**BucketLockConfiguration)(nil)).Elem()
}
func (o BucketLockConfigurationOutput) ToBucketLockConfigurationOutput() BucketLockConfigurationOutput {
return o
}
func (o BucketLockConfigurationOutput) ToBucketLockConfigurationOutputWithContext(ctx context.Context) BucketLockConfigurationOutput {
return o
}
// The bucket's name or regional ID.
func (o BucketLockConfigurationOutput) Bucket() pulumi.StringOutput {
return o.ApplyT(func(v *BucketLockConfiguration) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput)
}
// The project_id you want to attach the resource to
func (o BucketLockConfigurationOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v *BucketLockConfiguration) pulumi.StringOutput { return v.ProjectId }).(pulumi.StringOutput)
}
// The region you want to attach the resource to
func (o BucketLockConfigurationOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v *BucketLockConfiguration) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)
}
// Specifies the Object Lock rule for the specified object.
func (o BucketLockConfigurationOutput) Rule() BucketLockConfigurationRuleOutput {
return o.ApplyT(func(v *BucketLockConfiguration) BucketLockConfigurationRuleOutput { return v.Rule }).(BucketLockConfigurationRuleOutput)
}
type BucketLockConfigurationArrayOutput struct{ *pulumi.OutputState }
func (BucketLockConfigurationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BucketLockConfiguration)(nil)).Elem()
}
func (o BucketLockConfigurationArrayOutput) ToBucketLockConfigurationArrayOutput() BucketLockConfigurationArrayOutput {
return o
}
func (o BucketLockConfigurationArrayOutput) ToBucketLockConfigurationArrayOutputWithContext(ctx context.Context) BucketLockConfigurationArrayOutput {
return o
}
func (o BucketLockConfigurationArrayOutput) Index(i pulumi.IntInput) BucketLockConfigurationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BucketLockConfiguration {
return vs[0].([]*BucketLockConfiguration)[vs[1].(int)]
}).(BucketLockConfigurationOutput)
}
type BucketLockConfigurationMapOutput struct{ *pulumi.OutputState }
func (BucketLockConfigurationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BucketLockConfiguration)(nil)).Elem()
}
func (o BucketLockConfigurationMapOutput) ToBucketLockConfigurationMapOutput() BucketLockConfigurationMapOutput {
return o
}
func (o BucketLockConfigurationMapOutput) ToBucketLockConfigurationMapOutputWithContext(ctx context.Context) BucketLockConfigurationMapOutput {
return o
}
func (o BucketLockConfigurationMapOutput) MapIndex(k pulumi.StringInput) BucketLockConfigurationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BucketLockConfiguration {
return vs[0].(map[string]*BucketLockConfiguration)[vs[1].(string)]
}).(BucketLockConfigurationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BucketLockConfigurationInput)(nil)).Elem(), &BucketLockConfiguration{})
pulumi.RegisterInputType(reflect.TypeOf((*BucketLockConfigurationArrayInput)(nil)).Elem(), BucketLockConfigurationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BucketLockConfigurationMapInput)(nil)).Elem(), BucketLockConfigurationMap{})
pulumi.RegisterOutputType(BucketLockConfigurationOutput{})
pulumi.RegisterOutputType(BucketLockConfigurationArrayOutput{})
pulumi.RegisterOutputType(BucketLockConfigurationMapOutput{})
}