generated from pulumi/pulumi-tf-provider-boilerplate
/
accessRule.go
273 lines (225 loc) · 8.28 KB
/
accessRule.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
// 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 chdfs
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a resource to create a chdfs accessRule
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-tencentcloud/sdk/go/tencentcloud/Chdfs"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/tencentcloudstack/pulumi-tencentcloud/sdk/go/tencentcloud/Chdfs"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := Chdfs.NewAccessRule(ctx, "accessRule", &Chdfs.AccessRuleArgs{
// AccessGroupId: pulumi.String("ag-bvmzrbsm"),
// AccessRule: &chdfs.AccessRuleAccessRuleArgs{
// AccessMode: pulumi.Int(2),
// Address: pulumi.String("10.0.1.1"),
// Priority: pulumi.Int(12),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// chdfs access_rule can be imported using the id, e.g.
//
// ```sh
// $ pulumi import tencentcloud:Chdfs/accessRule:AccessRule access_rule access_group_id#access_rule_id
// ```
type AccessRule struct {
pulumi.CustomResourceState
// access group id.
AccessGroupId pulumi.StringOutput `pulumi:"accessGroupId"`
// rule detail.
AccessRule AccessRuleAccessRuleOutput `pulumi:"accessRule"`
}
// NewAccessRule registers a new resource with the given unique name, arguments, and options.
func NewAccessRule(ctx *pulumi.Context,
name string, args *AccessRuleArgs, opts ...pulumi.ResourceOption) (*AccessRule, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AccessGroupId == nil {
return nil, errors.New("invalid value for required argument 'AccessGroupId'")
}
if args.AccessRule == nil {
return nil, errors.New("invalid value for required argument 'AccessRule'")
}
opts = pkgResourceDefaultOpts(opts)
var resource AccessRule
err := ctx.RegisterResource("tencentcloud:Chdfs/accessRule:AccessRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAccessRule gets an existing AccessRule 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 GetAccessRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AccessRuleState, opts ...pulumi.ResourceOption) (*AccessRule, error) {
var resource AccessRule
err := ctx.ReadResource("tencentcloud:Chdfs/accessRule:AccessRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AccessRule resources.
type accessRuleState struct {
// access group id.
AccessGroupId *string `pulumi:"accessGroupId"`
// rule detail.
AccessRule *AccessRuleAccessRule `pulumi:"accessRule"`
}
type AccessRuleState struct {
// access group id.
AccessGroupId pulumi.StringPtrInput
// rule detail.
AccessRule AccessRuleAccessRulePtrInput
}
func (AccessRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*accessRuleState)(nil)).Elem()
}
type accessRuleArgs struct {
// access group id.
AccessGroupId string `pulumi:"accessGroupId"`
// rule detail.
AccessRule AccessRuleAccessRule `pulumi:"accessRule"`
}
// The set of arguments for constructing a AccessRule resource.
type AccessRuleArgs struct {
// access group id.
AccessGroupId pulumi.StringInput
// rule detail.
AccessRule AccessRuleAccessRuleInput
}
func (AccessRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*accessRuleArgs)(nil)).Elem()
}
type AccessRuleInput interface {
pulumi.Input
ToAccessRuleOutput() AccessRuleOutput
ToAccessRuleOutputWithContext(ctx context.Context) AccessRuleOutput
}
func (*AccessRule) ElementType() reflect.Type {
return reflect.TypeOf((**AccessRule)(nil)).Elem()
}
func (i *AccessRule) ToAccessRuleOutput() AccessRuleOutput {
return i.ToAccessRuleOutputWithContext(context.Background())
}
func (i *AccessRule) ToAccessRuleOutputWithContext(ctx context.Context) AccessRuleOutput {
return pulumi.ToOutputWithContext(ctx, i).(AccessRuleOutput)
}
// AccessRuleArrayInput is an input type that accepts AccessRuleArray and AccessRuleArrayOutput values.
// You can construct a concrete instance of `AccessRuleArrayInput` via:
//
// AccessRuleArray{ AccessRuleArgs{...} }
type AccessRuleArrayInput interface {
pulumi.Input
ToAccessRuleArrayOutput() AccessRuleArrayOutput
ToAccessRuleArrayOutputWithContext(context.Context) AccessRuleArrayOutput
}
type AccessRuleArray []AccessRuleInput
func (AccessRuleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AccessRule)(nil)).Elem()
}
func (i AccessRuleArray) ToAccessRuleArrayOutput() AccessRuleArrayOutput {
return i.ToAccessRuleArrayOutputWithContext(context.Background())
}
func (i AccessRuleArray) ToAccessRuleArrayOutputWithContext(ctx context.Context) AccessRuleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AccessRuleArrayOutput)
}
// AccessRuleMapInput is an input type that accepts AccessRuleMap and AccessRuleMapOutput values.
// You can construct a concrete instance of `AccessRuleMapInput` via:
//
// AccessRuleMap{ "key": AccessRuleArgs{...} }
type AccessRuleMapInput interface {
pulumi.Input
ToAccessRuleMapOutput() AccessRuleMapOutput
ToAccessRuleMapOutputWithContext(context.Context) AccessRuleMapOutput
}
type AccessRuleMap map[string]AccessRuleInput
func (AccessRuleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AccessRule)(nil)).Elem()
}
func (i AccessRuleMap) ToAccessRuleMapOutput() AccessRuleMapOutput {
return i.ToAccessRuleMapOutputWithContext(context.Background())
}
func (i AccessRuleMap) ToAccessRuleMapOutputWithContext(ctx context.Context) AccessRuleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AccessRuleMapOutput)
}
type AccessRuleOutput struct{ *pulumi.OutputState }
func (AccessRuleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**AccessRule)(nil)).Elem()
}
func (o AccessRuleOutput) ToAccessRuleOutput() AccessRuleOutput {
return o
}
func (o AccessRuleOutput) ToAccessRuleOutputWithContext(ctx context.Context) AccessRuleOutput {
return o
}
// access group id.
func (o AccessRuleOutput) AccessGroupId() pulumi.StringOutput {
return o.ApplyT(func(v *AccessRule) pulumi.StringOutput { return v.AccessGroupId }).(pulumi.StringOutput)
}
// rule detail.
func (o AccessRuleOutput) AccessRule() AccessRuleAccessRuleOutput {
return o.ApplyT(func(v *AccessRule) AccessRuleAccessRuleOutput { return v.AccessRule }).(AccessRuleAccessRuleOutput)
}
type AccessRuleArrayOutput struct{ *pulumi.OutputState }
func (AccessRuleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AccessRule)(nil)).Elem()
}
func (o AccessRuleArrayOutput) ToAccessRuleArrayOutput() AccessRuleArrayOutput {
return o
}
func (o AccessRuleArrayOutput) ToAccessRuleArrayOutputWithContext(ctx context.Context) AccessRuleArrayOutput {
return o
}
func (o AccessRuleArrayOutput) Index(i pulumi.IntInput) AccessRuleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AccessRule {
return vs[0].([]*AccessRule)[vs[1].(int)]
}).(AccessRuleOutput)
}
type AccessRuleMapOutput struct{ *pulumi.OutputState }
func (AccessRuleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AccessRule)(nil)).Elem()
}
func (o AccessRuleMapOutput) ToAccessRuleMapOutput() AccessRuleMapOutput {
return o
}
func (o AccessRuleMapOutput) ToAccessRuleMapOutputWithContext(ctx context.Context) AccessRuleMapOutput {
return o
}
func (o AccessRuleMapOutput) MapIndex(k pulumi.StringInput) AccessRuleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AccessRule {
return vs[0].(map[string]*AccessRule)[vs[1].(string)]
}).(AccessRuleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AccessRuleInput)(nil)).Elem(), &AccessRule{})
pulumi.RegisterInputType(reflect.TypeOf((*AccessRuleArrayInput)(nil)).Elem(), AccessRuleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AccessRuleMapInput)(nil)).Elem(), AccessRuleMap{})
pulumi.RegisterOutputType(AccessRuleOutput{})
pulumi.RegisterOutputType(AccessRuleArrayOutput{})
pulumi.RegisterOutputType(AccessRuleMapOutput{})
}