generated from pulumi/pulumi-tf-provider-boilerplate
/
ipStrategy.go
341 lines (289 loc) · 11.1 KB
/
ipStrategy.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
// 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 apigateway
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this resource to create IP strategy of API gateway.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/tencentcloudstack/pulumi-tencentcloud/sdk/go/tencentcloud/ApiGateway"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// service, err := ApiGateway.NewService(ctx, "service", &ApiGateway.ServiceArgs{
// ServiceName: pulumi.String("niceservice"),
// Protocol: pulumi.String("http&https"),
// ServiceDesc: pulumi.String("your nice service"),
// NetTypes: pulumi.StringArray{
// pulumi.String("INNER"),
// pulumi.String("OUTER"),
// },
// IpVersion: pulumi.String("IPv4"),
// })
// if err != nil {
// return err
// }
// _, err = ApiGateway.NewIpStrategy(ctx, "test", &ApiGateway.IpStrategyArgs{
// ServiceId: service.ID(),
// StrategyName: pulumi.String("tf_test"),
// StrategyType: pulumi.String("BLACK"),
// StrategyData: pulumi.String("9.9.9.9"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// IP strategy of API gateway can be imported using the id, e.g.
//
// ```sh
// $ pulumi import tencentcloud:ApiGateway/ipStrategy:IpStrategy test service-ohxqslqe#IPStrategy-q1lk8ud2
// ```
type IpStrategy struct {
pulumi.CustomResourceState
// Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
CreateTime pulumi.StringOutput `pulumi:"createTime"`
// The ID of the API gateway service.
ServiceId pulumi.StringOutput `pulumi:"serviceId"`
// IP address data.
StrategyData pulumi.StringOutput `pulumi:"strategyData"`
// IP policy ID.
StrategyId pulumi.StringOutput `pulumi:"strategyId"`
// User defined strategy name.
StrategyName pulumi.StringOutput `pulumi:"strategyName"`
// Blacklist or whitelist.
StrategyType pulumi.StringOutput `pulumi:"strategyType"`
}
// NewIpStrategy registers a new resource with the given unique name, arguments, and options.
func NewIpStrategy(ctx *pulumi.Context,
name string, args *IpStrategyArgs, opts ...pulumi.ResourceOption) (*IpStrategy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ServiceId == nil {
return nil, errors.New("invalid value for required argument 'ServiceId'")
}
if args.StrategyData == nil {
return nil, errors.New("invalid value for required argument 'StrategyData'")
}
if args.StrategyName == nil {
return nil, errors.New("invalid value for required argument 'StrategyName'")
}
if args.StrategyType == nil {
return nil, errors.New("invalid value for required argument 'StrategyType'")
}
opts = pkgResourceDefaultOpts(opts)
var resource IpStrategy
err := ctx.RegisterResource("tencentcloud:ApiGateway/ipStrategy:IpStrategy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIpStrategy gets an existing IpStrategy 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 GetIpStrategy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IpStrategyState, opts ...pulumi.ResourceOption) (*IpStrategy, error) {
var resource IpStrategy
err := ctx.ReadResource("tencentcloud:ApiGateway/ipStrategy:IpStrategy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering IpStrategy resources.
type ipStrategyState struct {
// Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
CreateTime *string `pulumi:"createTime"`
// The ID of the API gateway service.
ServiceId *string `pulumi:"serviceId"`
// IP address data.
StrategyData *string `pulumi:"strategyData"`
// IP policy ID.
StrategyId *string `pulumi:"strategyId"`
// User defined strategy name.
StrategyName *string `pulumi:"strategyName"`
// Blacklist or whitelist.
StrategyType *string `pulumi:"strategyType"`
}
type IpStrategyState struct {
// Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
CreateTime pulumi.StringPtrInput
// The ID of the API gateway service.
ServiceId pulumi.StringPtrInput
// IP address data.
StrategyData pulumi.StringPtrInput
// IP policy ID.
StrategyId pulumi.StringPtrInput
// User defined strategy name.
StrategyName pulumi.StringPtrInput
// Blacklist or whitelist.
StrategyType pulumi.StringPtrInput
}
func (IpStrategyState) ElementType() reflect.Type {
return reflect.TypeOf((*ipStrategyState)(nil)).Elem()
}
type ipStrategyArgs struct {
// The ID of the API gateway service.
ServiceId string `pulumi:"serviceId"`
// IP address data.
StrategyData string `pulumi:"strategyData"`
// User defined strategy name.
StrategyName string `pulumi:"strategyName"`
// Blacklist or whitelist.
StrategyType string `pulumi:"strategyType"`
}
// The set of arguments for constructing a IpStrategy resource.
type IpStrategyArgs struct {
// The ID of the API gateway service.
ServiceId pulumi.StringInput
// IP address data.
StrategyData pulumi.StringInput
// User defined strategy name.
StrategyName pulumi.StringInput
// Blacklist or whitelist.
StrategyType pulumi.StringInput
}
func (IpStrategyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ipStrategyArgs)(nil)).Elem()
}
type IpStrategyInput interface {
pulumi.Input
ToIpStrategyOutput() IpStrategyOutput
ToIpStrategyOutputWithContext(ctx context.Context) IpStrategyOutput
}
func (*IpStrategy) ElementType() reflect.Type {
return reflect.TypeOf((**IpStrategy)(nil)).Elem()
}
func (i *IpStrategy) ToIpStrategyOutput() IpStrategyOutput {
return i.ToIpStrategyOutputWithContext(context.Background())
}
func (i *IpStrategy) ToIpStrategyOutputWithContext(ctx context.Context) IpStrategyOutput {
return pulumi.ToOutputWithContext(ctx, i).(IpStrategyOutput)
}
// IpStrategyArrayInput is an input type that accepts IpStrategyArray and IpStrategyArrayOutput values.
// You can construct a concrete instance of `IpStrategyArrayInput` via:
//
// IpStrategyArray{ IpStrategyArgs{...} }
type IpStrategyArrayInput interface {
pulumi.Input
ToIpStrategyArrayOutput() IpStrategyArrayOutput
ToIpStrategyArrayOutputWithContext(context.Context) IpStrategyArrayOutput
}
type IpStrategyArray []IpStrategyInput
func (IpStrategyArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*IpStrategy)(nil)).Elem()
}
func (i IpStrategyArray) ToIpStrategyArrayOutput() IpStrategyArrayOutput {
return i.ToIpStrategyArrayOutputWithContext(context.Background())
}
func (i IpStrategyArray) ToIpStrategyArrayOutputWithContext(ctx context.Context) IpStrategyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(IpStrategyArrayOutput)
}
// IpStrategyMapInput is an input type that accepts IpStrategyMap and IpStrategyMapOutput values.
// You can construct a concrete instance of `IpStrategyMapInput` via:
//
// IpStrategyMap{ "key": IpStrategyArgs{...} }
type IpStrategyMapInput interface {
pulumi.Input
ToIpStrategyMapOutput() IpStrategyMapOutput
ToIpStrategyMapOutputWithContext(context.Context) IpStrategyMapOutput
}
type IpStrategyMap map[string]IpStrategyInput
func (IpStrategyMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*IpStrategy)(nil)).Elem()
}
func (i IpStrategyMap) ToIpStrategyMapOutput() IpStrategyMapOutput {
return i.ToIpStrategyMapOutputWithContext(context.Background())
}
func (i IpStrategyMap) ToIpStrategyMapOutputWithContext(ctx context.Context) IpStrategyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(IpStrategyMapOutput)
}
type IpStrategyOutput struct{ *pulumi.OutputState }
func (IpStrategyOutput) ElementType() reflect.Type {
return reflect.TypeOf((**IpStrategy)(nil)).Elem()
}
func (o IpStrategyOutput) ToIpStrategyOutput() IpStrategyOutput {
return o
}
func (o IpStrategyOutput) ToIpStrategyOutputWithContext(ctx context.Context) IpStrategyOutput {
return o
}
// Creation time in the format of YYYY-MM-DDThh:mm:ssZ according to ISO 8601 standard. UTC time is used.
func (o IpStrategyOutput) CreateTime() pulumi.StringOutput {
return o.ApplyT(func(v *IpStrategy) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)
}
// The ID of the API gateway service.
func (o IpStrategyOutput) ServiceId() pulumi.StringOutput {
return o.ApplyT(func(v *IpStrategy) pulumi.StringOutput { return v.ServiceId }).(pulumi.StringOutput)
}
// IP address data.
func (o IpStrategyOutput) StrategyData() pulumi.StringOutput {
return o.ApplyT(func(v *IpStrategy) pulumi.StringOutput { return v.StrategyData }).(pulumi.StringOutput)
}
// IP policy ID.
func (o IpStrategyOutput) StrategyId() pulumi.StringOutput {
return o.ApplyT(func(v *IpStrategy) pulumi.StringOutput { return v.StrategyId }).(pulumi.StringOutput)
}
// User defined strategy name.
func (o IpStrategyOutput) StrategyName() pulumi.StringOutput {
return o.ApplyT(func(v *IpStrategy) pulumi.StringOutput { return v.StrategyName }).(pulumi.StringOutput)
}
// Blacklist or whitelist.
func (o IpStrategyOutput) StrategyType() pulumi.StringOutput {
return o.ApplyT(func(v *IpStrategy) pulumi.StringOutput { return v.StrategyType }).(pulumi.StringOutput)
}
type IpStrategyArrayOutput struct{ *pulumi.OutputState }
func (IpStrategyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*IpStrategy)(nil)).Elem()
}
func (o IpStrategyArrayOutput) ToIpStrategyArrayOutput() IpStrategyArrayOutput {
return o
}
func (o IpStrategyArrayOutput) ToIpStrategyArrayOutputWithContext(ctx context.Context) IpStrategyArrayOutput {
return o
}
func (o IpStrategyArrayOutput) Index(i pulumi.IntInput) IpStrategyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *IpStrategy {
return vs[0].([]*IpStrategy)[vs[1].(int)]
}).(IpStrategyOutput)
}
type IpStrategyMapOutput struct{ *pulumi.OutputState }
func (IpStrategyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*IpStrategy)(nil)).Elem()
}
func (o IpStrategyMapOutput) ToIpStrategyMapOutput() IpStrategyMapOutput {
return o
}
func (o IpStrategyMapOutput) ToIpStrategyMapOutputWithContext(ctx context.Context) IpStrategyMapOutput {
return o
}
func (o IpStrategyMapOutput) MapIndex(k pulumi.StringInput) IpStrategyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *IpStrategy {
return vs[0].(map[string]*IpStrategy)[vs[1].(string)]
}).(IpStrategyOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*IpStrategyInput)(nil)).Elem(), &IpStrategy{})
pulumi.RegisterInputType(reflect.TypeOf((*IpStrategyArrayInput)(nil)).Elem(), IpStrategyArray{})
pulumi.RegisterInputType(reflect.TypeOf((*IpStrategyMapInput)(nil)).Elem(), IpStrategyMap{})
pulumi.RegisterOutputType(IpStrategyOutput{})
pulumi.RegisterOutputType(IpStrategyArrayOutput{})
pulumi.RegisterOutputType(IpStrategyMapOutput{})
}