-
Notifications
You must be signed in to change notification settings - Fork 51
/
cacheAccessPolicy.go
313 lines (264 loc) · 12.3 KB
/
cacheAccessPolicy.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
// 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 redis
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a Redis Cache Access Policy
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/redis"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("example-resources"),
// Location: pulumi.String("East US"),
// })
// if err != nil {
// return err
// }
// exampleCache, err := redis.NewCache(ctx, "example", &redis.CacheArgs{
// Name: pulumi.String("example"),
// Location: example.Location,
// ResourceGroupName: example.Name,
// Capacity: pulumi.Int(1),
// Family: pulumi.String("P"),
// SkuName: pulumi.String("Premium"),
// EnableNonSslPort: pulumi.Bool(false),
// RedisConfiguration: &redis.CacheRedisConfigurationArgs{
// MaxmemoryReserved: pulumi.Int(2),
// MaxmemoryDelta: pulumi.Int(2),
// MaxmemoryPolicy: pulumi.String("allkeys-lru"),
// },
// })
// if err != nil {
// return err
// }
// _, err = redis.NewCacheAccessPolicy(ctx, "example", &redis.CacheAccessPolicyArgs{
// Name: pulumi.String("example"),
// RedisCacheId: exampleCache.ID(),
// Permissions: pulumi.String("+@read +@connection +cluster|info"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Redis Cache Access Policy can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:redis/cacheAccessPolicy:CacheAccessPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/accessPolicies/policy1
// ```
type CacheAccessPolicy struct {
pulumi.CustomResourceState
// The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Name pulumi.StringOutput `pulumi:"name"`
// Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Permissions pulumi.StringOutput `pulumi:"permissions"`
// The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
RedisCacheId pulumi.StringOutput `pulumi:"redisCacheId"`
}
// NewCacheAccessPolicy registers a new resource with the given unique name, arguments, and options.
func NewCacheAccessPolicy(ctx *pulumi.Context,
name string, args *CacheAccessPolicyArgs, opts ...pulumi.ResourceOption) (*CacheAccessPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Permissions == nil {
return nil, errors.New("invalid value for required argument 'Permissions'")
}
if args.RedisCacheId == nil {
return nil, errors.New("invalid value for required argument 'RedisCacheId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource CacheAccessPolicy
err := ctx.RegisterResource("azure:redis/cacheAccessPolicy:CacheAccessPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCacheAccessPolicy gets an existing CacheAccessPolicy 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 GetCacheAccessPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CacheAccessPolicyState, opts ...pulumi.ResourceOption) (*CacheAccessPolicy, error) {
var resource CacheAccessPolicy
err := ctx.ReadResource("azure:redis/cacheAccessPolicy:CacheAccessPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering CacheAccessPolicy resources.
type cacheAccessPolicyState struct {
// The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Name *string `pulumi:"name"`
// Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Permissions *string `pulumi:"permissions"`
// The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
RedisCacheId *string `pulumi:"redisCacheId"`
}
type CacheAccessPolicyState struct {
// The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Name pulumi.StringPtrInput
// Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Permissions pulumi.StringPtrInput
// The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
RedisCacheId pulumi.StringPtrInput
}
func (CacheAccessPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*cacheAccessPolicyState)(nil)).Elem()
}
type cacheAccessPolicyArgs struct {
// The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Name *string `pulumi:"name"`
// Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Permissions string `pulumi:"permissions"`
// The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
RedisCacheId string `pulumi:"redisCacheId"`
}
// The set of arguments for constructing a CacheAccessPolicy resource.
type CacheAccessPolicyArgs struct {
// The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Name pulumi.StringPtrInput
// Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
Permissions pulumi.StringInput
// The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
RedisCacheId pulumi.StringInput
}
func (CacheAccessPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*cacheAccessPolicyArgs)(nil)).Elem()
}
type CacheAccessPolicyInput interface {
pulumi.Input
ToCacheAccessPolicyOutput() CacheAccessPolicyOutput
ToCacheAccessPolicyOutputWithContext(ctx context.Context) CacheAccessPolicyOutput
}
func (*CacheAccessPolicy) ElementType() reflect.Type {
return reflect.TypeOf((**CacheAccessPolicy)(nil)).Elem()
}
func (i *CacheAccessPolicy) ToCacheAccessPolicyOutput() CacheAccessPolicyOutput {
return i.ToCacheAccessPolicyOutputWithContext(context.Background())
}
func (i *CacheAccessPolicy) ToCacheAccessPolicyOutputWithContext(ctx context.Context) CacheAccessPolicyOutput {
return pulumi.ToOutputWithContext(ctx, i).(CacheAccessPolicyOutput)
}
// CacheAccessPolicyArrayInput is an input type that accepts CacheAccessPolicyArray and CacheAccessPolicyArrayOutput values.
// You can construct a concrete instance of `CacheAccessPolicyArrayInput` via:
//
// CacheAccessPolicyArray{ CacheAccessPolicyArgs{...} }
type CacheAccessPolicyArrayInput interface {
pulumi.Input
ToCacheAccessPolicyArrayOutput() CacheAccessPolicyArrayOutput
ToCacheAccessPolicyArrayOutputWithContext(context.Context) CacheAccessPolicyArrayOutput
}
type CacheAccessPolicyArray []CacheAccessPolicyInput
func (CacheAccessPolicyArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CacheAccessPolicy)(nil)).Elem()
}
func (i CacheAccessPolicyArray) ToCacheAccessPolicyArrayOutput() CacheAccessPolicyArrayOutput {
return i.ToCacheAccessPolicyArrayOutputWithContext(context.Background())
}
func (i CacheAccessPolicyArray) ToCacheAccessPolicyArrayOutputWithContext(ctx context.Context) CacheAccessPolicyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CacheAccessPolicyArrayOutput)
}
// CacheAccessPolicyMapInput is an input type that accepts CacheAccessPolicyMap and CacheAccessPolicyMapOutput values.
// You can construct a concrete instance of `CacheAccessPolicyMapInput` via:
//
// CacheAccessPolicyMap{ "key": CacheAccessPolicyArgs{...} }
type CacheAccessPolicyMapInput interface {
pulumi.Input
ToCacheAccessPolicyMapOutput() CacheAccessPolicyMapOutput
ToCacheAccessPolicyMapOutputWithContext(context.Context) CacheAccessPolicyMapOutput
}
type CacheAccessPolicyMap map[string]CacheAccessPolicyInput
func (CacheAccessPolicyMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CacheAccessPolicy)(nil)).Elem()
}
func (i CacheAccessPolicyMap) ToCacheAccessPolicyMapOutput() CacheAccessPolicyMapOutput {
return i.ToCacheAccessPolicyMapOutputWithContext(context.Background())
}
func (i CacheAccessPolicyMap) ToCacheAccessPolicyMapOutputWithContext(ctx context.Context) CacheAccessPolicyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CacheAccessPolicyMapOutput)
}
type CacheAccessPolicyOutput struct{ *pulumi.OutputState }
func (CacheAccessPolicyOutput) ElementType() reflect.Type {
return reflect.TypeOf((**CacheAccessPolicy)(nil)).Elem()
}
func (o CacheAccessPolicyOutput) ToCacheAccessPolicyOutput() CacheAccessPolicyOutput {
return o
}
func (o CacheAccessPolicyOutput) ToCacheAccessPolicyOutputWithContext(ctx context.Context) CacheAccessPolicyOutput {
return o
}
// The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
func (o CacheAccessPolicyOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *CacheAccessPolicy) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
func (o CacheAccessPolicyOutput) Permissions() pulumi.StringOutput {
return o.ApplyT(func(v *CacheAccessPolicy) pulumi.StringOutput { return v.Permissions }).(pulumi.StringOutput)
}
// The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
func (o CacheAccessPolicyOutput) RedisCacheId() pulumi.StringOutput {
return o.ApplyT(func(v *CacheAccessPolicy) pulumi.StringOutput { return v.RedisCacheId }).(pulumi.StringOutput)
}
type CacheAccessPolicyArrayOutput struct{ *pulumi.OutputState }
func (CacheAccessPolicyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CacheAccessPolicy)(nil)).Elem()
}
func (o CacheAccessPolicyArrayOutput) ToCacheAccessPolicyArrayOutput() CacheAccessPolicyArrayOutput {
return o
}
func (o CacheAccessPolicyArrayOutput) ToCacheAccessPolicyArrayOutputWithContext(ctx context.Context) CacheAccessPolicyArrayOutput {
return o
}
func (o CacheAccessPolicyArrayOutput) Index(i pulumi.IntInput) CacheAccessPolicyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CacheAccessPolicy {
return vs[0].([]*CacheAccessPolicy)[vs[1].(int)]
}).(CacheAccessPolicyOutput)
}
type CacheAccessPolicyMapOutput struct{ *pulumi.OutputState }
func (CacheAccessPolicyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CacheAccessPolicy)(nil)).Elem()
}
func (o CacheAccessPolicyMapOutput) ToCacheAccessPolicyMapOutput() CacheAccessPolicyMapOutput {
return o
}
func (o CacheAccessPolicyMapOutput) ToCacheAccessPolicyMapOutputWithContext(ctx context.Context) CacheAccessPolicyMapOutput {
return o
}
func (o CacheAccessPolicyMapOutput) MapIndex(k pulumi.StringInput) CacheAccessPolicyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CacheAccessPolicy {
return vs[0].(map[string]*CacheAccessPolicy)[vs[1].(string)]
}).(CacheAccessPolicyOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*CacheAccessPolicyInput)(nil)).Elem(), &CacheAccessPolicy{})
pulumi.RegisterInputType(reflect.TypeOf((*CacheAccessPolicyArrayInput)(nil)).Elem(), CacheAccessPolicyArray{})
pulumi.RegisterInputType(reflect.TypeOf((*CacheAccessPolicyMapInput)(nil)).Elem(), CacheAccessPolicyMap{})
pulumi.RegisterOutputType(CacheAccessPolicyOutput{})
pulumi.RegisterOutputType(CacheAccessPolicyArrayOutput{})
pulumi.RegisterOutputType(CacheAccessPolicyMapOutput{})
}