/
trafficMirrorSession.go
593 lines (533 loc) · 32 KB
/
trafficMirrorSession.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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
// 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 vpc
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a VPC Traffic Mirror Session resource. Traffic mirroring session.
//
// For information about VPC Traffic Mirror Session and how to use it, see [What is Traffic Mirror Session](https://www.alibabacloud.com/help/en/doc-detail/261364.htm).
//
// > **NOTE:** Available since v1.142.0.
//
// ## Example Usage
//
// # Basic Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// name := "tf-example"
// if param := cfg.Get("name"); param != "" {
// name = param
// }
// _default, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
// InstanceTypeFamily: pulumi.StringRef("ecs.g7"),
// }, nil)
// if err != nil {
// return err
// }
// defaultGetZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
// AvailableResourceCreation: pulumi.StringRef("Instance"),
// AvailableInstanceType: pulumi.StringRef(_default.InstanceTypes[0].Id),
// }, nil)
// if err != nil {
// return err
// }
// defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
// VpcName: pulumi.String(name),
// CidrBlock: pulumi.String("10.4.0.0/16"),
// })
// if err != nil {
// return err
// }
// defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
// VswitchName: pulumi.String(name),
// CidrBlock: pulumi.String("10.4.0.0/24"),
// VpcId: defaultNetwork.ID(),
// ZoneId: pulumi.String(defaultGetZones.Zones[0].Id),
// })
// if err != nil {
// return err
// }
// defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
// Name: pulumi.String(name),
// Description: pulumi.String(name),
// VpcId: defaultNetwork.ID(),
// })
// if err != nil {
// return err
// }
// defaultGetImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
// NameRegex: pulumi.StringRef("^ubuntu_[0-9]+_[0-9]+_x64*"),
// MostRecent: pulumi.BoolRef(true),
// Owners: pulumi.StringRef("system"),
// }, nil)
// if err != nil {
// return err
// }
// var defaultInstance []*ecs.Instance
// for index := 0; index < 2; index++ {
// key0 := index
// _ := index
// __res, err := ecs.NewInstance(ctx, fmt.Sprintf("default-%v", key0), &ecs.InstanceArgs{
// AvailabilityZone: pulumi.String(defaultGetZones.Zones[0].Id),
// InstanceName: pulumi.String(name),
// HostName: pulumi.String(name),
// ImageId: pulumi.String(defaultGetImages.Images[0].Id),
// InstanceType: pulumi.String(_default.InstanceTypes[0].Id),
// SecurityGroups: pulumi.StringArray{
// defaultSecurityGroup.ID(),
// },
// VswitchId: defaultSwitch.ID(),
// SystemDiskCategory: pulumi.String("cloud_essd"),
// })
// if err != nil {
// return err
// }
// defaultInstance = append(defaultInstance, __res)
// }
// var defaultEcsNetworkInterface []*ecs.EcsNetworkInterface
// for index := 0; index < 2; index++ {
// key0 := index
// _ := index
// __res, err := ecs.NewEcsNetworkInterface(ctx, fmt.Sprintf("default-%v", key0), &ecs.EcsNetworkInterfaceArgs{
// NetworkInterfaceName: pulumi.String(name),
// VswitchId: defaultSwitch.ID(),
// SecurityGroupIds: pulumi.StringArray{
// defaultSecurityGroup.ID(),
// },
// })
// if err != nil {
// return err
// }
// defaultEcsNetworkInterface = append(defaultEcsNetworkInterface, __res)
// }
// var defaultEcsNetworkInterfaceAttachment []*ecs.EcsNetworkInterfaceAttachment
// for index := 0; index < 2; index++ {
// key0 := index
// val0 := index
// __res, err := ecs.NewEcsNetworkInterfaceAttachment(ctx, fmt.Sprintf("default-%v", key0), &ecs.EcsNetworkInterfaceAttachmentArgs{
// InstanceId: defaultInstance[val0].ID(),
// NetworkInterfaceId: defaultEcsNetworkInterface[val0].ID(),
// })
// if err != nil {
// return err
// }
// defaultEcsNetworkInterfaceAttachment = append(defaultEcsNetworkInterfaceAttachment, __res)
// }
// defaultTrafficMirrorFilter, err := vpc.NewTrafficMirrorFilter(ctx, "default", &vpc.TrafficMirrorFilterArgs{
// TrafficMirrorFilterName: pulumi.String(name),
// TrafficMirrorFilterDescription: pulumi.String(name),
// })
// if err != nil {
// return err
// }
// _, err = vpc.NewTrafficMirrorSession(ctx, "default", &vpc.TrafficMirrorSessionArgs{
// Priority: pulumi.Int(1),
// VirtualNetworkId: pulumi.Int(10),
// TrafficMirrorSessionDescription: pulumi.String(name),
// TrafficMirrorSessionName: pulumi.String(name),
// TrafficMirrorTargetId: defaultEcsNetworkInterfaceAttachment[0].NetworkInterfaceId,
// TrafficMirrorSourceIds: pulumi.StringArray{
// defaultEcsNetworkInterfaceAttachment[1].NetworkInterfaceId,
// },
// TrafficMirrorFilterId: defaultTrafficMirrorFilter.ID(),
// TrafficMirrorTargetType: pulumi.String("NetworkInterface"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// VPC Traffic Mirror Session can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:vpc/trafficMirrorSession:TrafficMirrorSession example <id>
// ```
type TrafficMirrorSession struct {
pulumi.CustomResourceState
// Whether to PreCheck only this request, value:
// - **true**: sends a check request and does not create a mirror session. Check items include whether required parameters are filled in, request format, and restrictions. If the check fails, the corresponding error is returned. If the check passes, the error code 'DryRunOperation' is returned '.
// - **false** (default): Sends a normal request and directly creates a mirror session after checking.
DryRun pulumi.BoolPtrOutput `pulumi:"dryRun"`
// Specifies whether to enable traffic mirror sessions. default to `false`.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// Maximum Transmission Unit (MTU).
PacketLength pulumi.IntOutput `pulumi:"packetLength"`
// The priority of the traffic mirror session. Valid values: `1` to `32766`. A smaller value indicates a higher priority. You cannot specify the same priority for traffic mirror sessions that are created in the same region with the same Alibaba Cloud account.
Priority pulumi.IntOutput `pulumi:"priority"`
// The ID of the resource group.
ResourceGroupId pulumi.StringOutput `pulumi:"resourceGroupId"`
// The status of the resource.
Status pulumi.StringOutput `pulumi:"status"`
// The tags of this resource.
Tags pulumi.MapOutput `pulumi:"tags"`
// The ID of the filter.
TrafficMirrorFilterId pulumi.StringOutput `pulumi:"trafficMirrorFilterId"`
// The description of the traffic mirror session. The description must be `2` to `256` characters in length and cannot start with `http://` or `https://`.
TrafficMirrorSessionDescription pulumi.StringPtrOutput `pulumi:"trafficMirrorSessionDescription"`
// The name of the traffic mirror session. The name must be `2` to `128` characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter.
TrafficMirrorSessionName pulumi.StringPtrOutput `pulumi:"trafficMirrorSessionName"`
// The ID of the image source instance. Currently, the Eni is supported as the image source. The default value of N is 1, that is, only one mirror source can be added to a mirror session.
TrafficMirrorSourceIds pulumi.StringArrayOutput `pulumi:"trafficMirrorSourceIds"`
// The ID of the mirror destination. You can specify only an ENI or a Server Load Balancer (SLB) instance as a mirror destination.
TrafficMirrorTargetId pulumi.StringOutput `pulumi:"trafficMirrorTargetId"`
// The type of the mirror destination. Valid values: `NetworkInterface` or `SLB`. `NetworkInterface`: an ENI. `SLB`: an internal-facing SLB instance.
TrafficMirrorTargetType pulumi.StringOutput `pulumi:"trafficMirrorTargetType"`
// The VXLAN network identifier (VNI) that is used to distinguish different mirrored traffic. Valid values: `0` to `16777215`. You can specify VNIs for the traffic mirror destination to identify mirrored traffic from different sessions. If you do not specify a VNI, the system randomly allocates a VNI. If you want the system to randomly allocate a VNI, ignore this parameter.
VirtualNetworkId pulumi.IntOutput `pulumi:"virtualNetworkId"`
}
// NewTrafficMirrorSession registers a new resource with the given unique name, arguments, and options.
func NewTrafficMirrorSession(ctx *pulumi.Context,
name string, args *TrafficMirrorSessionArgs, opts ...pulumi.ResourceOption) (*TrafficMirrorSession, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Priority == nil {
return nil, errors.New("invalid value for required argument 'Priority'")
}
if args.TrafficMirrorFilterId == nil {
return nil, errors.New("invalid value for required argument 'TrafficMirrorFilterId'")
}
if args.TrafficMirrorSourceIds == nil {
return nil, errors.New("invalid value for required argument 'TrafficMirrorSourceIds'")
}
if args.TrafficMirrorTargetId == nil {
return nil, errors.New("invalid value for required argument 'TrafficMirrorTargetId'")
}
if args.TrafficMirrorTargetType == nil {
return nil, errors.New("invalid value for required argument 'TrafficMirrorTargetType'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource TrafficMirrorSession
err := ctx.RegisterResource("alicloud:vpc/trafficMirrorSession:TrafficMirrorSession", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTrafficMirrorSession gets an existing TrafficMirrorSession 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 GetTrafficMirrorSession(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TrafficMirrorSessionState, opts ...pulumi.ResourceOption) (*TrafficMirrorSession, error) {
var resource TrafficMirrorSession
err := ctx.ReadResource("alicloud:vpc/trafficMirrorSession:TrafficMirrorSession", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TrafficMirrorSession resources.
type trafficMirrorSessionState struct {
// Whether to PreCheck only this request, value:
// - **true**: sends a check request and does not create a mirror session. Check items include whether required parameters are filled in, request format, and restrictions. If the check fails, the corresponding error is returned. If the check passes, the error code 'DryRunOperation' is returned '.
// - **false** (default): Sends a normal request and directly creates a mirror session after checking.
DryRun *bool `pulumi:"dryRun"`
// Specifies whether to enable traffic mirror sessions. default to `false`.
Enabled *bool `pulumi:"enabled"`
// Maximum Transmission Unit (MTU).
PacketLength *int `pulumi:"packetLength"`
// The priority of the traffic mirror session. Valid values: `1` to `32766`. A smaller value indicates a higher priority. You cannot specify the same priority for traffic mirror sessions that are created in the same region with the same Alibaba Cloud account.
Priority *int `pulumi:"priority"`
// The ID of the resource group.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// The status of the resource.
Status *string `pulumi:"status"`
// The tags of this resource.
Tags map[string]interface{} `pulumi:"tags"`
// The ID of the filter.
TrafficMirrorFilterId *string `pulumi:"trafficMirrorFilterId"`
// The description of the traffic mirror session. The description must be `2` to `256` characters in length and cannot start with `http://` or `https://`.
TrafficMirrorSessionDescription *string `pulumi:"trafficMirrorSessionDescription"`
// The name of the traffic mirror session. The name must be `2` to `128` characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter.
TrafficMirrorSessionName *string `pulumi:"trafficMirrorSessionName"`
// The ID of the image source instance. Currently, the Eni is supported as the image source. The default value of N is 1, that is, only one mirror source can be added to a mirror session.
TrafficMirrorSourceIds []string `pulumi:"trafficMirrorSourceIds"`
// The ID of the mirror destination. You can specify only an ENI or a Server Load Balancer (SLB) instance as a mirror destination.
TrafficMirrorTargetId *string `pulumi:"trafficMirrorTargetId"`
// The type of the mirror destination. Valid values: `NetworkInterface` or `SLB`. `NetworkInterface`: an ENI. `SLB`: an internal-facing SLB instance.
TrafficMirrorTargetType *string `pulumi:"trafficMirrorTargetType"`
// The VXLAN network identifier (VNI) that is used to distinguish different mirrored traffic. Valid values: `0` to `16777215`. You can specify VNIs for the traffic mirror destination to identify mirrored traffic from different sessions. If you do not specify a VNI, the system randomly allocates a VNI. If you want the system to randomly allocate a VNI, ignore this parameter.
VirtualNetworkId *int `pulumi:"virtualNetworkId"`
}
type TrafficMirrorSessionState struct {
// Whether to PreCheck only this request, value:
// - **true**: sends a check request and does not create a mirror session. Check items include whether required parameters are filled in, request format, and restrictions. If the check fails, the corresponding error is returned. If the check passes, the error code 'DryRunOperation' is returned '.
// - **false** (default): Sends a normal request and directly creates a mirror session after checking.
DryRun pulumi.BoolPtrInput
// Specifies whether to enable traffic mirror sessions. default to `false`.
Enabled pulumi.BoolPtrInput
// Maximum Transmission Unit (MTU).
PacketLength pulumi.IntPtrInput
// The priority of the traffic mirror session. Valid values: `1` to `32766`. A smaller value indicates a higher priority. You cannot specify the same priority for traffic mirror sessions that are created in the same region with the same Alibaba Cloud account.
Priority pulumi.IntPtrInput
// The ID of the resource group.
ResourceGroupId pulumi.StringPtrInput
// The status of the resource.
Status pulumi.StringPtrInput
// The tags of this resource.
Tags pulumi.MapInput
// The ID of the filter.
TrafficMirrorFilterId pulumi.StringPtrInput
// The description of the traffic mirror session. The description must be `2` to `256` characters in length and cannot start with `http://` or `https://`.
TrafficMirrorSessionDescription pulumi.StringPtrInput
// The name of the traffic mirror session. The name must be `2` to `128` characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter.
TrafficMirrorSessionName pulumi.StringPtrInput
// The ID of the image source instance. Currently, the Eni is supported as the image source. The default value of N is 1, that is, only one mirror source can be added to a mirror session.
TrafficMirrorSourceIds pulumi.StringArrayInput
// The ID of the mirror destination. You can specify only an ENI or a Server Load Balancer (SLB) instance as a mirror destination.
TrafficMirrorTargetId pulumi.StringPtrInput
// The type of the mirror destination. Valid values: `NetworkInterface` or `SLB`. `NetworkInterface`: an ENI. `SLB`: an internal-facing SLB instance.
TrafficMirrorTargetType pulumi.StringPtrInput
// The VXLAN network identifier (VNI) that is used to distinguish different mirrored traffic. Valid values: `0` to `16777215`. You can specify VNIs for the traffic mirror destination to identify mirrored traffic from different sessions. If you do not specify a VNI, the system randomly allocates a VNI. If you want the system to randomly allocate a VNI, ignore this parameter.
VirtualNetworkId pulumi.IntPtrInput
}
func (TrafficMirrorSessionState) ElementType() reflect.Type {
return reflect.TypeOf((*trafficMirrorSessionState)(nil)).Elem()
}
type trafficMirrorSessionArgs struct {
// Whether to PreCheck only this request, value:
// - **true**: sends a check request and does not create a mirror session. Check items include whether required parameters are filled in, request format, and restrictions. If the check fails, the corresponding error is returned. If the check passes, the error code 'DryRunOperation' is returned '.
// - **false** (default): Sends a normal request and directly creates a mirror session after checking.
DryRun *bool `pulumi:"dryRun"`
// Specifies whether to enable traffic mirror sessions. default to `false`.
Enabled *bool `pulumi:"enabled"`
// Maximum Transmission Unit (MTU).
PacketLength *int `pulumi:"packetLength"`
// The priority of the traffic mirror session. Valid values: `1` to `32766`. A smaller value indicates a higher priority. You cannot specify the same priority for traffic mirror sessions that are created in the same region with the same Alibaba Cloud account.
Priority int `pulumi:"priority"`
// The ID of the resource group.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// The tags of this resource.
Tags map[string]interface{} `pulumi:"tags"`
// The ID of the filter.
TrafficMirrorFilterId string `pulumi:"trafficMirrorFilterId"`
// The description of the traffic mirror session. The description must be `2` to `256` characters in length and cannot start with `http://` or `https://`.
TrafficMirrorSessionDescription *string `pulumi:"trafficMirrorSessionDescription"`
// The name of the traffic mirror session. The name must be `2` to `128` characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter.
TrafficMirrorSessionName *string `pulumi:"trafficMirrorSessionName"`
// The ID of the image source instance. Currently, the Eni is supported as the image source. The default value of N is 1, that is, only one mirror source can be added to a mirror session.
TrafficMirrorSourceIds []string `pulumi:"trafficMirrorSourceIds"`
// The ID of the mirror destination. You can specify only an ENI or a Server Load Balancer (SLB) instance as a mirror destination.
TrafficMirrorTargetId string `pulumi:"trafficMirrorTargetId"`
// The type of the mirror destination. Valid values: `NetworkInterface` or `SLB`. `NetworkInterface`: an ENI. `SLB`: an internal-facing SLB instance.
TrafficMirrorTargetType string `pulumi:"trafficMirrorTargetType"`
// The VXLAN network identifier (VNI) that is used to distinguish different mirrored traffic. Valid values: `0` to `16777215`. You can specify VNIs for the traffic mirror destination to identify mirrored traffic from different sessions. If you do not specify a VNI, the system randomly allocates a VNI. If you want the system to randomly allocate a VNI, ignore this parameter.
VirtualNetworkId *int `pulumi:"virtualNetworkId"`
}
// The set of arguments for constructing a TrafficMirrorSession resource.
type TrafficMirrorSessionArgs struct {
// Whether to PreCheck only this request, value:
// - **true**: sends a check request and does not create a mirror session. Check items include whether required parameters are filled in, request format, and restrictions. If the check fails, the corresponding error is returned. If the check passes, the error code 'DryRunOperation' is returned '.
// - **false** (default): Sends a normal request and directly creates a mirror session after checking.
DryRun pulumi.BoolPtrInput
// Specifies whether to enable traffic mirror sessions. default to `false`.
Enabled pulumi.BoolPtrInput
// Maximum Transmission Unit (MTU).
PacketLength pulumi.IntPtrInput
// The priority of the traffic mirror session. Valid values: `1` to `32766`. A smaller value indicates a higher priority. You cannot specify the same priority for traffic mirror sessions that are created in the same region with the same Alibaba Cloud account.
Priority pulumi.IntInput
// The ID of the resource group.
ResourceGroupId pulumi.StringPtrInput
// The tags of this resource.
Tags pulumi.MapInput
// The ID of the filter.
TrafficMirrorFilterId pulumi.StringInput
// The description of the traffic mirror session. The description must be `2` to `256` characters in length and cannot start with `http://` or `https://`.
TrafficMirrorSessionDescription pulumi.StringPtrInput
// The name of the traffic mirror session. The name must be `2` to `128` characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter.
TrafficMirrorSessionName pulumi.StringPtrInput
// The ID of the image source instance. Currently, the Eni is supported as the image source. The default value of N is 1, that is, only one mirror source can be added to a mirror session.
TrafficMirrorSourceIds pulumi.StringArrayInput
// The ID of the mirror destination. You can specify only an ENI or a Server Load Balancer (SLB) instance as a mirror destination.
TrafficMirrorTargetId pulumi.StringInput
// The type of the mirror destination. Valid values: `NetworkInterface` or `SLB`. `NetworkInterface`: an ENI. `SLB`: an internal-facing SLB instance.
TrafficMirrorTargetType pulumi.StringInput
// The VXLAN network identifier (VNI) that is used to distinguish different mirrored traffic. Valid values: `0` to `16777215`. You can specify VNIs for the traffic mirror destination to identify mirrored traffic from different sessions. If you do not specify a VNI, the system randomly allocates a VNI. If you want the system to randomly allocate a VNI, ignore this parameter.
VirtualNetworkId pulumi.IntPtrInput
}
func (TrafficMirrorSessionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*trafficMirrorSessionArgs)(nil)).Elem()
}
type TrafficMirrorSessionInput interface {
pulumi.Input
ToTrafficMirrorSessionOutput() TrafficMirrorSessionOutput
ToTrafficMirrorSessionOutputWithContext(ctx context.Context) TrafficMirrorSessionOutput
}
func (*TrafficMirrorSession) ElementType() reflect.Type {
return reflect.TypeOf((**TrafficMirrorSession)(nil)).Elem()
}
func (i *TrafficMirrorSession) ToTrafficMirrorSessionOutput() TrafficMirrorSessionOutput {
return i.ToTrafficMirrorSessionOutputWithContext(context.Background())
}
func (i *TrafficMirrorSession) ToTrafficMirrorSessionOutputWithContext(ctx context.Context) TrafficMirrorSessionOutput {
return pulumi.ToOutputWithContext(ctx, i).(TrafficMirrorSessionOutput)
}
// TrafficMirrorSessionArrayInput is an input type that accepts TrafficMirrorSessionArray and TrafficMirrorSessionArrayOutput values.
// You can construct a concrete instance of `TrafficMirrorSessionArrayInput` via:
//
// TrafficMirrorSessionArray{ TrafficMirrorSessionArgs{...} }
type TrafficMirrorSessionArrayInput interface {
pulumi.Input
ToTrafficMirrorSessionArrayOutput() TrafficMirrorSessionArrayOutput
ToTrafficMirrorSessionArrayOutputWithContext(context.Context) TrafficMirrorSessionArrayOutput
}
type TrafficMirrorSessionArray []TrafficMirrorSessionInput
func (TrafficMirrorSessionArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TrafficMirrorSession)(nil)).Elem()
}
func (i TrafficMirrorSessionArray) ToTrafficMirrorSessionArrayOutput() TrafficMirrorSessionArrayOutput {
return i.ToTrafficMirrorSessionArrayOutputWithContext(context.Background())
}
func (i TrafficMirrorSessionArray) ToTrafficMirrorSessionArrayOutputWithContext(ctx context.Context) TrafficMirrorSessionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TrafficMirrorSessionArrayOutput)
}
// TrafficMirrorSessionMapInput is an input type that accepts TrafficMirrorSessionMap and TrafficMirrorSessionMapOutput values.
// You can construct a concrete instance of `TrafficMirrorSessionMapInput` via:
//
// TrafficMirrorSessionMap{ "key": TrafficMirrorSessionArgs{...} }
type TrafficMirrorSessionMapInput interface {
pulumi.Input
ToTrafficMirrorSessionMapOutput() TrafficMirrorSessionMapOutput
ToTrafficMirrorSessionMapOutputWithContext(context.Context) TrafficMirrorSessionMapOutput
}
type TrafficMirrorSessionMap map[string]TrafficMirrorSessionInput
func (TrafficMirrorSessionMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TrafficMirrorSession)(nil)).Elem()
}
func (i TrafficMirrorSessionMap) ToTrafficMirrorSessionMapOutput() TrafficMirrorSessionMapOutput {
return i.ToTrafficMirrorSessionMapOutputWithContext(context.Background())
}
func (i TrafficMirrorSessionMap) ToTrafficMirrorSessionMapOutputWithContext(ctx context.Context) TrafficMirrorSessionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TrafficMirrorSessionMapOutput)
}
type TrafficMirrorSessionOutput struct{ *pulumi.OutputState }
func (TrafficMirrorSessionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TrafficMirrorSession)(nil)).Elem()
}
func (o TrafficMirrorSessionOutput) ToTrafficMirrorSessionOutput() TrafficMirrorSessionOutput {
return o
}
func (o TrafficMirrorSessionOutput) ToTrafficMirrorSessionOutputWithContext(ctx context.Context) TrafficMirrorSessionOutput {
return o
}
// Whether to PreCheck only this request, value:
// - **true**: sends a check request and does not create a mirror session. Check items include whether required parameters are filled in, request format, and restrictions. If the check fails, the corresponding error is returned. If the check passes, the error code 'DryRunOperation' is returned '.
// - **false** (default): Sends a normal request and directly creates a mirror session after checking.
func (o TrafficMirrorSessionOutput) DryRun() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.BoolPtrOutput { return v.DryRun }).(pulumi.BoolPtrOutput)
}
// Specifies whether to enable traffic mirror sessions. default to `false`.
func (o TrafficMirrorSessionOutput) Enabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
}
// Maximum Transmission Unit (MTU).
func (o TrafficMirrorSessionOutput) PacketLength() pulumi.IntOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.IntOutput { return v.PacketLength }).(pulumi.IntOutput)
}
// The priority of the traffic mirror session. Valid values: `1` to `32766`. A smaller value indicates a higher priority. You cannot specify the same priority for traffic mirror sessions that are created in the same region with the same Alibaba Cloud account.
func (o TrafficMirrorSessionOutput) Priority() pulumi.IntOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.IntOutput { return v.Priority }).(pulumi.IntOutput)
}
// The ID of the resource group.
func (o TrafficMirrorSessionOutput) ResourceGroupId() pulumi.StringOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.StringOutput { return v.ResourceGroupId }).(pulumi.StringOutput)
}
// The status of the resource.
func (o TrafficMirrorSessionOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// The tags of this resource.
func (o TrafficMirrorSessionOutput) Tags() pulumi.MapOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.MapOutput { return v.Tags }).(pulumi.MapOutput)
}
// The ID of the filter.
func (o TrafficMirrorSessionOutput) TrafficMirrorFilterId() pulumi.StringOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.StringOutput { return v.TrafficMirrorFilterId }).(pulumi.StringOutput)
}
// The description of the traffic mirror session. The description must be `2` to `256` characters in length and cannot start with `http://` or `https://`.
func (o TrafficMirrorSessionOutput) TrafficMirrorSessionDescription() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.StringPtrOutput { return v.TrafficMirrorSessionDescription }).(pulumi.StringPtrOutput)
}
// The name of the traffic mirror session. The name must be `2` to `128` characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter.
func (o TrafficMirrorSessionOutput) TrafficMirrorSessionName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.StringPtrOutput { return v.TrafficMirrorSessionName }).(pulumi.StringPtrOutput)
}
// The ID of the image source instance. Currently, the Eni is supported as the image source. The default value of N is 1, that is, only one mirror source can be added to a mirror session.
func (o TrafficMirrorSessionOutput) TrafficMirrorSourceIds() pulumi.StringArrayOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.StringArrayOutput { return v.TrafficMirrorSourceIds }).(pulumi.StringArrayOutput)
}
// The ID of the mirror destination. You can specify only an ENI or a Server Load Balancer (SLB) instance as a mirror destination.
func (o TrafficMirrorSessionOutput) TrafficMirrorTargetId() pulumi.StringOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.StringOutput { return v.TrafficMirrorTargetId }).(pulumi.StringOutput)
}
// The type of the mirror destination. Valid values: `NetworkInterface` or `SLB`. `NetworkInterface`: an ENI. `SLB`: an internal-facing SLB instance.
func (o TrafficMirrorSessionOutput) TrafficMirrorTargetType() pulumi.StringOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.StringOutput { return v.TrafficMirrorTargetType }).(pulumi.StringOutput)
}
// The VXLAN network identifier (VNI) that is used to distinguish different mirrored traffic. Valid values: `0` to `16777215`. You can specify VNIs for the traffic mirror destination to identify mirrored traffic from different sessions. If you do not specify a VNI, the system randomly allocates a VNI. If you want the system to randomly allocate a VNI, ignore this parameter.
func (o TrafficMirrorSessionOutput) VirtualNetworkId() pulumi.IntOutput {
return o.ApplyT(func(v *TrafficMirrorSession) pulumi.IntOutput { return v.VirtualNetworkId }).(pulumi.IntOutput)
}
type TrafficMirrorSessionArrayOutput struct{ *pulumi.OutputState }
func (TrafficMirrorSessionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TrafficMirrorSession)(nil)).Elem()
}
func (o TrafficMirrorSessionArrayOutput) ToTrafficMirrorSessionArrayOutput() TrafficMirrorSessionArrayOutput {
return o
}
func (o TrafficMirrorSessionArrayOutput) ToTrafficMirrorSessionArrayOutputWithContext(ctx context.Context) TrafficMirrorSessionArrayOutput {
return o
}
func (o TrafficMirrorSessionArrayOutput) Index(i pulumi.IntInput) TrafficMirrorSessionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TrafficMirrorSession {
return vs[0].([]*TrafficMirrorSession)[vs[1].(int)]
}).(TrafficMirrorSessionOutput)
}
type TrafficMirrorSessionMapOutput struct{ *pulumi.OutputState }
func (TrafficMirrorSessionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TrafficMirrorSession)(nil)).Elem()
}
func (o TrafficMirrorSessionMapOutput) ToTrafficMirrorSessionMapOutput() TrafficMirrorSessionMapOutput {
return o
}
func (o TrafficMirrorSessionMapOutput) ToTrafficMirrorSessionMapOutputWithContext(ctx context.Context) TrafficMirrorSessionMapOutput {
return o
}
func (o TrafficMirrorSessionMapOutput) MapIndex(k pulumi.StringInput) TrafficMirrorSessionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TrafficMirrorSession {
return vs[0].(map[string]*TrafficMirrorSession)[vs[1].(string)]
}).(TrafficMirrorSessionOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TrafficMirrorSessionInput)(nil)).Elem(), &TrafficMirrorSession{})
pulumi.RegisterInputType(reflect.TypeOf((*TrafficMirrorSessionArrayInput)(nil)).Elem(), TrafficMirrorSessionArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TrafficMirrorSessionMapInput)(nil)).Elem(), TrafficMirrorSessionMap{})
pulumi.RegisterOutputType(TrafficMirrorSessionOutput{})
pulumi.RegisterOutputType(TrafficMirrorSessionArrayOutput{})
pulumi.RegisterOutputType(TrafficMirrorSessionMapOutput{})
}