/
kvstore.go
312 lines (263 loc) · 11.2 KB
/
kvstore.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
// 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 fastly
import (
"context"
"reflect"
"github.com/pulumi/pulumi-fastly/sdk/v8/go/fastly/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// Basic usage:
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-fastly/sdk/v8/go/fastly"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// // IMPORTANT: Deleting a KV Store requires first deleting its resource_link.
// // This requires a two-step `pulumi up` as we can't guarantee deletion order.
// // e.g. resource_link deletion within fastly_service_compute might not finish first.
// exampleKvstore, err := fastly.NewKvstore(ctx, "example", &fastly.KvstoreArgs{
// Name: pulumi.String("my_kv_store"),
// })
// if err != nil {
// return err
// }
// example, err := fastly.GetPackageHash(ctx, &fastly.GetPackageHashArgs{
// Filename: pulumi.StringRef("package.tar.gz"),
// }, nil)
// if err != nil {
// return err
// }
// _, err = fastly.NewServiceCompute(ctx, "example", &fastly.ServiceComputeArgs{
// Name: pulumi.String("my_compute_service"),
// Domains: fastly.ServiceComputeDomainArray{
// &fastly.ServiceComputeDomainArgs{
// Name: pulumi.String("demo.example.com"),
// },
// },
// Package: &fastly.ServiceComputePackageArgs{
// Filename: pulumi.String("package.tar.gz"),
// SourceCodeHash: pulumi.String(example.Hash),
// },
// ResourceLinks: fastly.ServiceComputeResourceLinkArray{
// &fastly.ServiceComputeResourceLinkArgs{
// Name: pulumi.String("my_resource_link"),
// ResourceId: exampleKvstore.ID(),
// },
// },
// ForceDestroy: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Fastly KV Stores can be imported using their Store ID, e.g.
//
// ```sh
// $ pulumi import fastly:index/kvstore:Kvstore example xxxxxxxxxxxxxxxxxxxx
// ```
type Kvstore struct {
pulumi.CustomResourceState
// Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
ForceDestroy pulumi.BoolPtrOutput `pulumi:"forceDestroy"`
// The regional location of the KV Store. Valid values are `US`, `EU`, `ASIA`, and `AUS`.
Location pulumi.StringPtrOutput `pulumi:"location"`
// A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resourceLink block from your service before modifying this field.
Name pulumi.StringOutput `pulumi:"name"`
}
// NewKvstore registers a new resource with the given unique name, arguments, and options.
func NewKvstore(ctx *pulumi.Context,
name string, args *KvstoreArgs, opts ...pulumi.ResourceOption) (*Kvstore, error) {
if args == nil {
args = &KvstoreArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Kvstore
err := ctx.RegisterResource("fastly:index/kvstore:Kvstore", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetKvstore gets an existing Kvstore 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 GetKvstore(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *KvstoreState, opts ...pulumi.ResourceOption) (*Kvstore, error) {
var resource Kvstore
err := ctx.ReadResource("fastly:index/kvstore:Kvstore", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Kvstore resources.
type kvstoreState struct {
// Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
ForceDestroy *bool `pulumi:"forceDestroy"`
// The regional location of the KV Store. Valid values are `US`, `EU`, `ASIA`, and `AUS`.
Location *string `pulumi:"location"`
// A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resourceLink block from your service before modifying this field.
Name *string `pulumi:"name"`
}
type KvstoreState struct {
// Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
ForceDestroy pulumi.BoolPtrInput
// The regional location of the KV Store. Valid values are `US`, `EU`, `ASIA`, and `AUS`.
Location pulumi.StringPtrInput
// A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resourceLink block from your service before modifying this field.
Name pulumi.StringPtrInput
}
func (KvstoreState) ElementType() reflect.Type {
return reflect.TypeOf((*kvstoreState)(nil)).Elem()
}
type kvstoreArgs struct {
// Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
ForceDestroy *bool `pulumi:"forceDestroy"`
// The regional location of the KV Store. Valid values are `US`, `EU`, `ASIA`, and `AUS`.
Location *string `pulumi:"location"`
// A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resourceLink block from your service before modifying this field.
Name *string `pulumi:"name"`
}
// The set of arguments for constructing a Kvstore resource.
type KvstoreArgs struct {
// Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
ForceDestroy pulumi.BoolPtrInput
// The regional location of the KV Store. Valid values are `US`, `EU`, `ASIA`, and `AUS`.
Location pulumi.StringPtrInput
// A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resourceLink block from your service before modifying this field.
Name pulumi.StringPtrInput
}
func (KvstoreArgs) ElementType() reflect.Type {
return reflect.TypeOf((*kvstoreArgs)(nil)).Elem()
}
type KvstoreInput interface {
pulumi.Input
ToKvstoreOutput() KvstoreOutput
ToKvstoreOutputWithContext(ctx context.Context) KvstoreOutput
}
func (*Kvstore) ElementType() reflect.Type {
return reflect.TypeOf((**Kvstore)(nil)).Elem()
}
func (i *Kvstore) ToKvstoreOutput() KvstoreOutput {
return i.ToKvstoreOutputWithContext(context.Background())
}
func (i *Kvstore) ToKvstoreOutputWithContext(ctx context.Context) KvstoreOutput {
return pulumi.ToOutputWithContext(ctx, i).(KvstoreOutput)
}
// KvstoreArrayInput is an input type that accepts KvstoreArray and KvstoreArrayOutput values.
// You can construct a concrete instance of `KvstoreArrayInput` via:
//
// KvstoreArray{ KvstoreArgs{...} }
type KvstoreArrayInput interface {
pulumi.Input
ToKvstoreArrayOutput() KvstoreArrayOutput
ToKvstoreArrayOutputWithContext(context.Context) KvstoreArrayOutput
}
type KvstoreArray []KvstoreInput
func (KvstoreArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Kvstore)(nil)).Elem()
}
func (i KvstoreArray) ToKvstoreArrayOutput() KvstoreArrayOutput {
return i.ToKvstoreArrayOutputWithContext(context.Background())
}
func (i KvstoreArray) ToKvstoreArrayOutputWithContext(ctx context.Context) KvstoreArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(KvstoreArrayOutput)
}
// KvstoreMapInput is an input type that accepts KvstoreMap and KvstoreMapOutput values.
// You can construct a concrete instance of `KvstoreMapInput` via:
//
// KvstoreMap{ "key": KvstoreArgs{...} }
type KvstoreMapInput interface {
pulumi.Input
ToKvstoreMapOutput() KvstoreMapOutput
ToKvstoreMapOutputWithContext(context.Context) KvstoreMapOutput
}
type KvstoreMap map[string]KvstoreInput
func (KvstoreMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Kvstore)(nil)).Elem()
}
func (i KvstoreMap) ToKvstoreMapOutput() KvstoreMapOutput {
return i.ToKvstoreMapOutputWithContext(context.Background())
}
func (i KvstoreMap) ToKvstoreMapOutputWithContext(ctx context.Context) KvstoreMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(KvstoreMapOutput)
}
type KvstoreOutput struct{ *pulumi.OutputState }
func (KvstoreOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Kvstore)(nil)).Elem()
}
func (o KvstoreOutput) ToKvstoreOutput() KvstoreOutput {
return o
}
func (o KvstoreOutput) ToKvstoreOutputWithContext(ctx context.Context) KvstoreOutput {
return o
}
// Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
func (o KvstoreOutput) ForceDestroy() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Kvstore) pulumi.BoolPtrOutput { return v.ForceDestroy }).(pulumi.BoolPtrOutput)
}
// The regional location of the KV Store. Valid values are `US`, `EU`, `ASIA`, and `AUS`.
func (o KvstoreOutput) Location() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Kvstore) pulumi.StringPtrOutput { return v.Location }).(pulumi.StringPtrOutput)
}
// A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resourceLink block from your service before modifying this field.
func (o KvstoreOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Kvstore) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
type KvstoreArrayOutput struct{ *pulumi.OutputState }
func (KvstoreArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Kvstore)(nil)).Elem()
}
func (o KvstoreArrayOutput) ToKvstoreArrayOutput() KvstoreArrayOutput {
return o
}
func (o KvstoreArrayOutput) ToKvstoreArrayOutputWithContext(ctx context.Context) KvstoreArrayOutput {
return o
}
func (o KvstoreArrayOutput) Index(i pulumi.IntInput) KvstoreOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Kvstore {
return vs[0].([]*Kvstore)[vs[1].(int)]
}).(KvstoreOutput)
}
type KvstoreMapOutput struct{ *pulumi.OutputState }
func (KvstoreMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Kvstore)(nil)).Elem()
}
func (o KvstoreMapOutput) ToKvstoreMapOutput() KvstoreMapOutput {
return o
}
func (o KvstoreMapOutput) ToKvstoreMapOutputWithContext(ctx context.Context) KvstoreMapOutput {
return o
}
func (o KvstoreMapOutput) MapIndex(k pulumi.StringInput) KvstoreOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Kvstore {
return vs[0].(map[string]*Kvstore)[vs[1].(string)]
}).(KvstoreOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*KvstoreInput)(nil)).Elem(), &Kvstore{})
pulumi.RegisterInputType(reflect.TypeOf((*KvstoreArrayInput)(nil)).Elem(), KvstoreArray{})
pulumi.RegisterInputType(reflect.TypeOf((*KvstoreMapInput)(nil)).Elem(), KvstoreMap{})
pulumi.RegisterOutputType(KvstoreOutput{})
pulumi.RegisterOutputType(KvstoreArrayOutput{})
pulumi.RegisterOutputType(KvstoreMapOutput{})
}