com.pulumi.aws.ec2.kotlin.TrafficMirrorSession.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.ec2.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
/**
* Builder for [TrafficMirrorSession].
*/
@PulumiTagMarker
public class TrafficMirrorSessionResourceBuilder internal constructor() {
public var name: String? = null
public var args: TrafficMirrorSessionArgs = TrafficMirrorSessionArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend TrafficMirrorSessionArgsBuilder.() -> Unit) {
val builder = TrafficMirrorSessionArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): TrafficMirrorSession {
val builtJavaResource = com.pulumi.aws.ec2.TrafficMirrorSession(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return TrafficMirrorSession(builtJavaResource)
}
}
/**
* Provides an Traffic mirror session.
* Read [limits and considerations](https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-considerations.html) for traffic mirroring
* ## Example Usage
* To create a basic traffic mirror session
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const filter = new aws.ec2.TrafficMirrorFilter("filter", {
* description: "traffic mirror filter - example",
* networkServices: ["amazon-dns"],
* });
* const target = new aws.ec2.TrafficMirrorTarget("target", {networkLoadBalancerArn: lb.arn});
* const session = new aws.ec2.TrafficMirrorSession("session", {
* description: "traffic mirror session - example",
* networkInterfaceId: test.primaryNetworkInterfaceId,
* sessionNumber: 1,
* trafficMirrorFilterId: filter.id,
* trafficMirrorTargetId: target.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* filter = aws.ec2.TrafficMirrorFilter("filter",
* description="traffic mirror filter - example",
* network_services=["amazon-dns"])
* target = aws.ec2.TrafficMirrorTarget("target", network_load_balancer_arn=lb["arn"])
* session = aws.ec2.TrafficMirrorSession("session",
* description="traffic mirror session - example",
* network_interface_id=test["primaryNetworkInterfaceId"],
* session_number=1,
* traffic_mirror_filter_id=filter.id,
* traffic_mirror_target_id=target.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var filter = new Aws.Ec2.TrafficMirrorFilter("filter", new()
* {
* Description = "traffic mirror filter - example",
* NetworkServices = new[]
* {
* "amazon-dns",
* },
* });
* var target = new Aws.Ec2.TrafficMirrorTarget("target", new()
* {
* NetworkLoadBalancerArn = lb.Arn,
* });
* var session = new Aws.Ec2.TrafficMirrorSession("session", new()
* {
* Description = "traffic mirror session - example",
* NetworkInterfaceId = test.PrimaryNetworkInterfaceId,
* SessionNumber = 1,
* TrafficMirrorFilterId = filter.Id,
* TrafficMirrorTargetId = target.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* filter, err := ec2.NewTrafficMirrorFilter(ctx, "filter", &ec2.TrafficMirrorFilterArgs{
* Description: pulumi.String("traffic mirror filter - example"),
* NetworkServices: pulumi.StringArray{
* pulumi.String("amazon-dns"),
* },
* })
* if err != nil {
* return err
* }
* target, err := ec2.NewTrafficMirrorTarget(ctx, "target", &ec2.TrafficMirrorTargetArgs{
* NetworkLoadBalancerArn: pulumi.Any(lb.Arn),
* })
* if err != nil {
* return err
* }
* _, err = ec2.NewTrafficMirrorSession(ctx, "session", &ec2.TrafficMirrorSessionArgs{
* Description: pulumi.String("traffic mirror session - example"),
* NetworkInterfaceId: pulumi.Any(test.PrimaryNetworkInterfaceId),
* SessionNumber: pulumi.Int(1),
* TrafficMirrorFilterId: filter.ID(),
* TrafficMirrorTargetId: target.ID(),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.ec2.TrafficMirrorFilter;
* import com.pulumi.aws.ec2.TrafficMirrorFilterArgs;
* import com.pulumi.aws.ec2.TrafficMirrorTarget;
* import com.pulumi.aws.ec2.TrafficMirrorTargetArgs;
* import com.pulumi.aws.ec2.TrafficMirrorSession;
* import com.pulumi.aws.ec2.TrafficMirrorSessionArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var filter = new TrafficMirrorFilter("filter", TrafficMirrorFilterArgs.builder()
* .description("traffic mirror filter - example")
* .networkServices("amazon-dns")
* .build());
* var target = new TrafficMirrorTarget("target", TrafficMirrorTargetArgs.builder()
* .networkLoadBalancerArn(lb.arn())
* .build());
* var session = new TrafficMirrorSession("session", TrafficMirrorSessionArgs.builder()
* .description("traffic mirror session - example")
* .networkInterfaceId(test.primaryNetworkInterfaceId())
* .sessionNumber(1)
* .trafficMirrorFilterId(filter.id())
* .trafficMirrorTargetId(target.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* filter:
* type: aws:ec2:TrafficMirrorFilter
* properties:
* description: traffic mirror filter - example
* networkServices:
* - amazon-dns
* target:
* type: aws:ec2:TrafficMirrorTarget
* properties:
* networkLoadBalancerArn: ${lb.arn}
* session:
* type: aws:ec2:TrafficMirrorSession
* properties:
* description: traffic mirror session - example
* networkInterfaceId: ${test.primaryNetworkInterfaceId}
* sessionNumber: 1
* trafficMirrorFilterId: ${filter.id}
* trafficMirrorTargetId: ${target.id}
* ```
*
* ## Import
* Using `pulumi import`, import traffic mirror sessions using the `id`. For example:
* ```sh
* $ pulumi import aws:ec2/trafficMirrorSession:TrafficMirrorSession session tms-0d8aa3ca35897b82e
* ```
*/
public class TrafficMirrorSession internal constructor(
override val javaResource: com.pulumi.aws.ec2.TrafficMirrorSession,
) : KotlinCustomResource(javaResource, TrafficMirrorSessionMapper) {
/**
* The ARN of the traffic mirror session.
*/
public val arn: Output
get() = javaResource.arn().applyValue({ args0 -> args0 })
/**
* A description of the traffic mirror session.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* ID of the source network interface. Not all network interfaces are eligible as mirror sources. On EC2 instances only nitro based instances support mirroring.
*/
public val networkInterfaceId: Output
get() = javaResource.networkInterfaceId().applyValue({ args0 -> args0 })
/**
* The AWS account ID of the session owner.
*/
public val ownerId: Output
get() = javaResource.ownerId().applyValue({ args0 -> args0 })
/**
* The number of bytes in each packet to mirror. These are bytes after the VXLAN header. Do not specify this parameter when you want to mirror the entire packet. To mirror a subset of the packet, set this to the length (in bytes) that you want to mirror.
*/
public val packetLength: Output
get() = javaResource.packetLength().applyValue({ args0 -> args0 })
/**
* The session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets.
*/
public val sessionNumber: Output
get() = javaResource.sessionNumber().applyValue({ args0 -> args0 })
/**
* Key-value map of resource tags. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
public val tags: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy