All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azurenative.network.kotlin.PacketCaptureArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.network.kotlin

import com.pulumi.azurenative.network.PacketCaptureArgs.builder
import com.pulumi.azurenative.network.kotlin.enums.PacketCaptureTargetType
import com.pulumi.azurenative.network.kotlin.inputs.PacketCaptureFilterArgs
import com.pulumi.azurenative.network.kotlin.inputs.PacketCaptureFilterArgsBuilder
import com.pulumi.azurenative.network.kotlin.inputs.PacketCaptureMachineScopeArgs
import com.pulumi.azurenative.network.kotlin.inputs.PacketCaptureMachineScopeArgsBuilder
import com.pulumi.azurenative.network.kotlin.inputs.PacketCaptureStorageLocationArgs
import com.pulumi.azurenative.network.kotlin.inputs.PacketCaptureStorageLocationArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Double
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Information about packet capture session.
 * Azure REST API version: 2023-02-01. Prior API version in Azure Native 1.x: 2020-11-01.
 * Other available API versions: 2018-01-01, 2020-06-01, 2023-04-01, 2023-05-01, 2023-06-01, 2023-09-01, 2023-11-01, 2024-01-01.
 * ## Example Usage
 * ### Create packet capture
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var packetCapture = new AzureNative.Network.PacketCapture("packetCapture", new()
 *     {
 *         BytesToCapturePerPacket = 10000,
 *         Filters = new[]
 *         {
 *             new AzureNative.Network.Inputs.PacketCaptureFilterArgs
 *             {
 *                 LocalIPAddress = "10.0.0.4",
 *                 LocalPort = "80",
 *                 Protocol = AzureNative.Network.PcProtocol.TCP,
 *             },
 *         },
 *         NetworkWatcherName = "nw1",
 *         PacketCaptureName = "pc1",
 *         ResourceGroupName = "rg1",
 *         StorageLocation = new AzureNative.Network.Inputs.PacketCaptureStorageLocationArgs
 *         {
 *             FilePath = "D:\\capture\\pc1.cap",
 *             StorageId = "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore",
 *             StoragePath = "https://mytestaccountname.blob.core.windows.net/capture/pc1.cap",
 *         },
 *         Target = "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1",
 *         TimeLimitInSeconds = 100,
 *         TotalBytesPerSession = 100000,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := network.NewPacketCapture(ctx, "packetCapture", &network.PacketCaptureArgs{
 * 			BytesToCapturePerPacket: pulumi.Float64(10000),
 * 			Filters: network.PacketCaptureFilterArray{
 * 				&network.PacketCaptureFilterArgs{
 * 					LocalIPAddress: pulumi.String("10.0.0.4"),
 * 					LocalPort:      pulumi.String("80"),
 * 					Protocol:       pulumi.String(network.PcProtocolTCP),
 * 				},
 * 			},
 * 			NetworkWatcherName: pulumi.String("nw1"),
 * 			PacketCaptureName:  pulumi.String("pc1"),
 * 			ResourceGroupName:  pulumi.String("rg1"),
 * 			StorageLocation: &network.PacketCaptureStorageLocationArgs{
 * 				FilePath:    pulumi.String("D:\\capture\\pc1.cap"),
 * 				StorageId:   pulumi.String("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore"),
 * 				StoragePath: pulumi.String("https://mytestaccountname.blob.core.windows.net/capture/pc1.cap"),
 * 			},
 * 			Target:               pulumi.String("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"),
 * 			TimeLimitInSeconds:   pulumi.Int(100),
 * 			TotalBytesPerSession: pulumi.Float64(100000),
 * 		})
 * 		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.azurenative.network.PacketCapture;
 * import com.pulumi.azurenative.network.PacketCaptureArgs;
 * import com.pulumi.azurenative.network.inputs.PacketCaptureFilterArgs;
 * import com.pulumi.azurenative.network.inputs.PacketCaptureStorageLocationArgs;
 * 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 packetCapture = new PacketCapture("packetCapture", PacketCaptureArgs.builder()
 *             .bytesToCapturePerPacket(10000)
 *             .filters(PacketCaptureFilterArgs.builder()
 *                 .localIPAddress("10.0.0.4")
 *                 .localPort("80")
 *                 .protocol("TCP")
 *                 .build())
 *             .networkWatcherName("nw1")
 *             .packetCaptureName("pc1")
 *             .resourceGroupName("rg1")
 *             .storageLocation(PacketCaptureStorageLocationArgs.builder()
 *                 .filePath("D:\\capture\\pc1.cap")
 *                 .storageId("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore")
 *                 .storagePath("https://mytestaccountname.blob.core.windows.net/capture/pc1.cap")
 *                 .build())
 *             .target("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1")
 *             .timeLimitInSeconds(100)
 *             .totalBytesPerSession(100000)
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:network:PacketCapture pc1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}
 * ```
 * @property bytesToCapturePerPacket Number of bytes captured per packet, the remaining bytes are truncated.
 * @property filters A list of packet capture filters.
 * @property networkWatcherName The name of the network watcher.
 * @property packetCaptureName The name of the packet capture session.
 * @property resourceGroupName The name of the resource group.
 * @property scope A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS.
 * @property storageLocation The storage location for a packet capture session.
 * @property target The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported.
 * @property targetType Target type of the resource provided.
 * @property timeLimitInSeconds Maximum duration of the capture session in seconds.
 * @property totalBytesPerSession Maximum size of the capture output.
 */
public data class PacketCaptureArgs(
    public val bytesToCapturePerPacket: Output? = null,
    public val filters: Output>? = null,
    public val networkWatcherName: Output? = null,
    public val packetCaptureName: Output? = null,
    public val resourceGroupName: Output? = null,
    public val scope: Output? = null,
    public val storageLocation: Output? = null,
    public val target: Output? = null,
    public val targetType: Output? = null,
    public val timeLimitInSeconds: Output? = null,
    public val totalBytesPerSession: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azurenative.network.PacketCaptureArgs =
        com.pulumi.azurenative.network.PacketCaptureArgs.builder()
            .bytesToCapturePerPacket(bytesToCapturePerPacket?.applyValue({ args0 -> args0 }))
            .filters(
                filters?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .networkWatcherName(networkWatcherName?.applyValue({ args0 -> args0 }))
            .packetCaptureName(packetCaptureName?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .scope(scope?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .storageLocation(storageLocation?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .target(target?.applyValue({ args0 -> args0 }))
            .targetType(targetType?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .timeLimitInSeconds(timeLimitInSeconds?.applyValue({ args0 -> args0 }))
            .totalBytesPerSession(totalBytesPerSession?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [PacketCaptureArgs].
 */
@PulumiTagMarker
public class PacketCaptureArgsBuilder internal constructor() {
    private var bytesToCapturePerPacket: Output? = null

    private var filters: Output>? = null

    private var networkWatcherName: Output? = null

    private var packetCaptureName: Output? = null

    private var resourceGroupName: Output? = null

    private var scope: Output? = null

    private var storageLocation: Output? = null

    private var target: Output? = null

    private var targetType: Output? = null

    private var timeLimitInSeconds: Output? = null

    private var totalBytesPerSession: Output? = null

    /**
     * @param value Number of bytes captured per packet, the remaining bytes are truncated.
     */
    @JvmName("prymvkiukmyphvgb")
    public suspend fun bytesToCapturePerPacket(`value`: Output) {
        this.bytesToCapturePerPacket = value
    }

    /**
     * @param value A list of packet capture filters.
     */
    @JvmName("pitoiolsjlqcjibk")
    public suspend fun filters(`value`: Output>) {
        this.filters = value
    }

    @JvmName("pvhloahdydbndvgv")
    public suspend fun filters(vararg values: Output) {
        this.filters = Output.all(values.asList())
    }

    /**
     * @param values A list of packet capture filters.
     */
    @JvmName("fdgxqguhhhjinnqr")
    public suspend fun filters(values: List>) {
        this.filters = Output.all(values)
    }

    /**
     * @param value The name of the network watcher.
     */
    @JvmName("jbycujchwmkquepu")
    public suspend fun networkWatcherName(`value`: Output) {
        this.networkWatcherName = value
    }

    /**
     * @param value The name of the packet capture session.
     */
    @JvmName("kepefcxwnwrgrtwp")
    public suspend fun packetCaptureName(`value`: Output) {
        this.packetCaptureName = value
    }

    /**
     * @param value The name of the resource group.
     */
    @JvmName("hebgogfsirpatrwu")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS.
     */
    @JvmName("pwjqnehqjvceqavn")
    public suspend fun scope(`value`: Output) {
        this.scope = value
    }

    /**
     * @param value The storage location for a packet capture session.
     */
    @JvmName("cghneudpnsghbguh")
    public suspend fun storageLocation(`value`: Output) {
        this.storageLocation = value
    }

    /**
     * @param value The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported.
     */
    @JvmName("mgmpjtknnrtxgxvp")
    public suspend fun target(`value`: Output) {
        this.target = value
    }

    /**
     * @param value Target type of the resource provided.
     */
    @JvmName("lfrtlcsvvwddfgaq")
    public suspend fun targetType(`value`: Output) {
        this.targetType = value
    }

    /**
     * @param value Maximum duration of the capture session in seconds.
     */
    @JvmName("spqtojfbtpltjehf")
    public suspend fun timeLimitInSeconds(`value`: Output) {
        this.timeLimitInSeconds = value
    }

    /**
     * @param value Maximum size of the capture output.
     */
    @JvmName("groqkoqlqsnodyca")
    public suspend fun totalBytesPerSession(`value`: Output) {
        this.totalBytesPerSession = value
    }

    /**
     * @param value Number of bytes captured per packet, the remaining bytes are truncated.
     */
    @JvmName("wsdbccpmositiceq")
    public suspend fun bytesToCapturePerPacket(`value`: Double?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.bytesToCapturePerPacket = mapped
    }

    /**
     * @param value A list of packet capture filters.
     */
    @JvmName("gmiegrfcikjsbjvb")
    public suspend fun filters(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.filters = mapped
    }

    /**
     * @param argument A list of packet capture filters.
     */
    @JvmName("uvdmjqcvawgntsjv")
    public suspend fun filters(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            PacketCaptureFilterArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param argument A list of packet capture filters.
     */
    @JvmName("tgpwhwhygcylcysq")
    public suspend fun filters(vararg argument: suspend PacketCaptureFilterArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            PacketCaptureFilterArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param argument A list of packet capture filters.
     */
    @JvmName("odttybvjxtfqnnhv")
    public suspend fun filters(argument: suspend PacketCaptureFilterArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(PacketCaptureFilterArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param values A list of packet capture filters.
     */
    @JvmName("adkuodntohqsjqyb")
    public suspend fun filters(vararg values: PacketCaptureFilterArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.filters = mapped
    }

    /**
     * @param value The name of the network watcher.
     */
    @JvmName("cprhhrmvgaxtsxag")
    public suspend fun networkWatcherName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.networkWatcherName = mapped
    }

    /**
     * @param value The name of the packet capture session.
     */
    @JvmName("qmnegquidhxlfqqj")
    public suspend fun packetCaptureName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.packetCaptureName = mapped
    }

    /**
     * @param value The name of the resource group.
     */
    @JvmName("warpcraqtrkawiyh")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS.
     */
    @JvmName("mdhvodhwwsgyjmai")
    public suspend fun scope(`value`: PacketCaptureMachineScopeArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scope = mapped
    }

    /**
     * @param argument A list of AzureVMSS instances which can be included or excluded to run packet capture. If both included and excluded are empty, then the packet capture will run on all instances of AzureVMSS.
     */
    @JvmName("wxqsnegitdcslvbc")
    public suspend fun scope(argument: suspend PacketCaptureMachineScopeArgsBuilder.() -> Unit) {
        val toBeMapped = PacketCaptureMachineScopeArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.scope = mapped
    }

    /**
     * @param value The storage location for a packet capture session.
     */
    @JvmName("oulckjyecfrlfrqu")
    public suspend fun storageLocation(`value`: PacketCaptureStorageLocationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.storageLocation = mapped
    }

    /**
     * @param argument The storage location for a packet capture session.
     */
    @JvmName("wtlsggwkbmjaacot")
    public suspend fun storageLocation(argument: suspend PacketCaptureStorageLocationArgsBuilder.() -> Unit) {
        val toBeMapped = PacketCaptureStorageLocationArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.storageLocation = mapped
    }

    /**
     * @param value The ID of the targeted resource, only AzureVM and AzureVMSS as target type are currently supported.
     */
    @JvmName("wxurcmtrymukjrhp")
    public suspend fun target(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.target = mapped
    }

    /**
     * @param value Target type of the resource provided.
     */
    @JvmName("jqtrablsqycqlrdn")
    public suspend fun targetType(`value`: PacketCaptureTargetType?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.targetType = mapped
    }

    /**
     * @param value Maximum duration of the capture session in seconds.
     */
    @JvmName("mrpkphbtsufagomo")
    public suspend fun timeLimitInSeconds(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.timeLimitInSeconds = mapped
    }

    /**
     * @param value Maximum size of the capture output.
     */
    @JvmName("gimtxqgetbmncfeo")
    public suspend fun totalBytesPerSession(`value`: Double?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.totalBytesPerSession = mapped
    }

    internal fun build(): PacketCaptureArgs = PacketCaptureArgs(
        bytesToCapturePerPacket = bytesToCapturePerPacket,
        filters = filters,
        networkWatcherName = networkWatcherName,
        packetCaptureName = packetCaptureName,
        resourceGroupName = resourceGroupName,
        scope = scope,
        storageLocation = storageLocation,
        target = target,
        targetType = targetType,
        timeLimitInSeconds = timeLimitInSeconds,
        totalBytesPerSession = totalBytesPerSession,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy