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

com.pulumi.azure.network.kotlin.NetworkPacketCaptureArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.network.kotlin

import com.pulumi.azure.network.NetworkPacketCaptureArgs.builder
import com.pulumi.azure.network.kotlin.inputs.NetworkPacketCaptureFilterArgs
import com.pulumi.azure.network.kotlin.inputs.NetworkPacketCaptureFilterArgsBuilder
import com.pulumi.azure.network.kotlin.inputs.NetworkPacketCaptureStorageLocationArgs
import com.pulumi.azure.network.kotlin.inputs.NetworkPacketCaptureStorageLocationArgsBuilder
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Configures Network Packet Capturing against a Virtual Machine using a Network Watcher.
 * !> **NOTE:** The `azure.network.NetworkPacketCapture` resource is deprecated and will be removed in favour of `azure.compute.PacketCapture` and `azure.compute.ScaleSetPacketCapture` in version 4.0 of the AzureRM Provider.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "packet-capture-rg",
 *     location: "West Europe",
 * });
 * const exampleNetworkWatcher = new azure.network.NetworkWatcher("example", {
 *     name: "network-watcher",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "production-network",
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "internal",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 * });
 * const exampleNetworkInterface = new azure.network.NetworkInterface("example", {
 *     name: "pctest-nic",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     ipConfigurations: [{
 *         name: "testconfiguration1",
 *         subnetId: exampleSubnet.id,
 *         privateIpAddressAllocation: "Dynamic",
 *     }],
 * });
 * const exampleVirtualMachine = new azure.compute.VirtualMachine("example", {
 *     name: "pctest-vm",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     networkInterfaceIds: [exampleNetworkInterface.id],
 *     vmSize: "Standard_F2",
 *     storageImageReference: {
 *         publisher: "Canonical",
 *         offer: "0001-com-ubuntu-server-jammy",
 *         sku: "22_04-lts",
 *         version: "latest",
 *     },
 *     storageOsDisk: {
 *         name: "osdisk",
 *         caching: "ReadWrite",
 *         createOption: "FromImage",
 *         managedDiskType: "Standard_LRS",
 *     },
 *     osProfile: {
 *         computerName: "pctest-vm",
 *         adminUsername: "testadmin",
 *         adminPassword: "Password1234!",
 *     },
 *     osProfileLinuxConfig: {
 *         disablePasswordAuthentication: false,
 *     },
 * });
 * const exampleExtension = new azure.compute.Extension("example", {
 *     name: "network-watcher",
 *     virtualMachineId: exampleVirtualMachine.id,
 *     publisher: "Microsoft.Azure.NetworkWatcher",
 *     type: "NetworkWatcherAgentLinux",
 *     typeHandlerVersion: "1.4",
 *     autoUpgradeMinorVersion: true,
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "pctestsa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleNetworkPacketCapture = new azure.network.NetworkPacketCapture("example", {
 *     name: "pctestcapture",
 *     networkWatcherName: exampleNetworkWatcher.name,
 *     resourceGroupName: example.name,
 *     targetResourceId: exampleVirtualMachine.id,
 *     storageLocation: {
 *         storageAccountId: exampleAccount.id,
 *     },
 * }, {
 *     dependsOn: [exampleExtension],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="packet-capture-rg",
 *     location="West Europe")
 * example_network_watcher = azure.network.NetworkWatcher("example",
 *     name="network-watcher",
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_virtual_network = azure.network.VirtualNetwork("example",
 *     name="production-network",
 *     address_spaces=["10.0.0.0/16"],
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_subnet = azure.network.Subnet("example",
 *     name="internal",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_virtual_network.name,
 *     address_prefixes=["10.0.2.0/24"])
 * example_network_interface = azure.network.NetworkInterface("example",
 *     name="pctest-nic",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     ip_configurations=[{
 *         "name": "testconfiguration1",
 *         "subnet_id": example_subnet.id,
 *         "private_ip_address_allocation": "Dynamic",
 *     }])
 * example_virtual_machine = azure.compute.VirtualMachine("example",
 *     name="pctest-vm",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     network_interface_ids=[example_network_interface.id],
 *     vm_size="Standard_F2",
 *     storage_image_reference={
 *         "publisher": "Canonical",
 *         "offer": "0001-com-ubuntu-server-jammy",
 *         "sku": "22_04-lts",
 *         "version": "latest",
 *     },
 *     storage_os_disk={
 *         "name": "osdisk",
 *         "caching": "ReadWrite",
 *         "create_option": "FromImage",
 *         "managed_disk_type": "Standard_LRS",
 *     },
 *     os_profile={
 *         "computer_name": "pctest-vm",
 *         "admin_username": "testadmin",
 *         "admin_password": "Password1234!",
 *     },
 *     os_profile_linux_config={
 *         "disable_password_authentication": False,
 *     })
 * example_extension = azure.compute.Extension("example",
 *     name="network-watcher",
 *     virtual_machine_id=example_virtual_machine.id,
 *     publisher="Microsoft.Azure.NetworkWatcher",
 *     type="NetworkWatcherAgentLinux",
 *     type_handler_version="1.4",
 *     auto_upgrade_minor_version=True)
 * example_account = azure.storage.Account("example",
 *     name="pctestsa",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_network_packet_capture = azure.network.NetworkPacketCapture("example",
 *     name="pctestcapture",
 *     network_watcher_name=example_network_watcher.name,
 *     resource_group_name=example.name,
 *     target_resource_id=example_virtual_machine.id,
 *     storage_location={
 *         "storage_account_id": example_account.id,
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[example_extension]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "packet-capture-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleNetworkWatcher = new Azure.Network.NetworkWatcher("example", new()
 *     {
 *         Name = "network-watcher",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
 *     {
 *         Name = "production-network",
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "internal",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.0.2.0/24",
 *         },
 *     });
 *     var exampleNetworkInterface = new Azure.Network.NetworkInterface("example", new()
 *     {
 *         Name = "pctest-nic",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         IpConfigurations = new[]
 *         {
 *             new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
 *             {
 *                 Name = "testconfiguration1",
 *                 SubnetId = exampleSubnet.Id,
 *                 PrivateIpAddressAllocation = "Dynamic",
 *             },
 *         },
 *     });
 *     var exampleVirtualMachine = new Azure.Compute.VirtualMachine("example", new()
 *     {
 *         Name = "pctest-vm",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         NetworkInterfaceIds = new[]
 *         {
 *             exampleNetworkInterface.Id,
 *         },
 *         VmSize = "Standard_F2",
 *         StorageImageReference = new Azure.Compute.Inputs.VirtualMachineStorageImageReferenceArgs
 *         {
 *             Publisher = "Canonical",
 *             Offer = "0001-com-ubuntu-server-jammy",
 *             Sku = "22_04-lts",
 *             Version = "latest",
 *         },
 *         StorageOsDisk = new Azure.Compute.Inputs.VirtualMachineStorageOsDiskArgs
 *         {
 *             Name = "osdisk",
 *             Caching = "ReadWrite",
 *             CreateOption = "FromImage",
 *             ManagedDiskType = "Standard_LRS",
 *         },
 *         OsProfile = new Azure.Compute.Inputs.VirtualMachineOsProfileArgs
 *         {
 *             ComputerName = "pctest-vm",
 *             AdminUsername = "testadmin",
 *             AdminPassword = "Password1234!",
 *         },
 *         OsProfileLinuxConfig = new Azure.Compute.Inputs.VirtualMachineOsProfileLinuxConfigArgs
 *         {
 *             DisablePasswordAuthentication = false,
 *         },
 *     });
 *     var exampleExtension = new Azure.Compute.Extension("example", new()
 *     {
 *         Name = "network-watcher",
 *         VirtualMachineId = exampleVirtualMachine.Id,
 *         Publisher = "Microsoft.Azure.NetworkWatcher",
 *         Type = "NetworkWatcherAgentLinux",
 *         TypeHandlerVersion = "1.4",
 *         AutoUpgradeMinorVersion = true,
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "pctestsa",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleNetworkPacketCapture = new Azure.Network.NetworkPacketCapture("example", new()
 *     {
 *         Name = "pctestcapture",
 *         NetworkWatcherName = exampleNetworkWatcher.Name,
 *         ResourceGroupName = example.Name,
 *         TargetResourceId = exampleVirtualMachine.Id,
 *         StorageLocation = new Azure.Network.Inputs.NetworkPacketCaptureStorageLocationArgs
 *         {
 *             StorageAccountId = exampleAccount.Id,
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             exampleExtension,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("packet-capture-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleNetworkWatcher, err := network.NewNetworkWatcher(ctx, "example", &network.NetworkWatcherArgs{
 * 			Name:              pulumi.String("network-watcher"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
 * 			Name: pulumi.String("production-network"),
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/16"),
 * 			},
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
 * 			Name:               pulumi.String("internal"),
 * 			ResourceGroupName:  example.Name,
 * 			VirtualNetworkName: exampleVirtualNetwork.Name,
 * 			AddressPrefixes: pulumi.StringArray{
 * 				pulumi.String("10.0.2.0/24"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleNetworkInterface, err := network.NewNetworkInterface(ctx, "example", &network.NetworkInterfaceArgs{
 * 			Name:              pulumi.String("pctest-nic"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			IpConfigurations: network.NetworkInterfaceIpConfigurationArray{
 * 				&network.NetworkInterfaceIpConfigurationArgs{
 * 					Name:                       pulumi.String("testconfiguration1"),
 * 					SubnetId:                   exampleSubnet.ID(),
 * 					PrivateIpAddressAllocation: pulumi.String("Dynamic"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualMachine, err := compute.NewVirtualMachine(ctx, "example", &compute.VirtualMachineArgs{
 * 			Name:              pulumi.String("pctest-vm"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			NetworkInterfaceIds: pulumi.StringArray{
 * 				exampleNetworkInterface.ID(),
 * 			},
 * 			VmSize: pulumi.String("Standard_F2"),
 * 			StorageImageReference: &compute.VirtualMachineStorageImageReferenceArgs{
 * 				Publisher: pulumi.String("Canonical"),
 * 				Offer:     pulumi.String("0001-com-ubuntu-server-jammy"),
 * 				Sku:       pulumi.String("22_04-lts"),
 * 				Version:   pulumi.String("latest"),
 * 			},
 * 			StorageOsDisk: &compute.VirtualMachineStorageOsDiskArgs{
 * 				Name:            pulumi.String("osdisk"),
 * 				Caching:         pulumi.String("ReadWrite"),
 * 				CreateOption:    pulumi.String("FromImage"),
 * 				ManagedDiskType: pulumi.String("Standard_LRS"),
 * 			},
 * 			OsProfile: &compute.VirtualMachineOsProfileArgs{
 * 				ComputerName:  pulumi.String("pctest-vm"),
 * 				AdminUsername: pulumi.String("testadmin"),
 * 				AdminPassword: pulumi.String("Password1234!"),
 * 			},
 * 			OsProfileLinuxConfig: &compute.VirtualMachineOsProfileLinuxConfigArgs{
 * 				DisablePasswordAuthentication: pulumi.Bool(false),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleExtension, err := compute.NewExtension(ctx, "example", &compute.ExtensionArgs{
 * 			Name:                    pulumi.String("network-watcher"),
 * 			VirtualMachineId:        exampleVirtualMachine.ID(),
 * 			Publisher:               pulumi.String("Microsoft.Azure.NetworkWatcher"),
 * 			Type:                    pulumi.String("NetworkWatcherAgentLinux"),
 * 			TypeHandlerVersion:      pulumi.String("1.4"),
 * 			AutoUpgradeMinorVersion: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("pctestsa"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewNetworkPacketCapture(ctx, "example", &network.NetworkPacketCaptureArgs{
 * 			Name:               pulumi.String("pctestcapture"),
 * 			NetworkWatcherName: exampleNetworkWatcher.Name,
 * 			ResourceGroupName:  example.Name,
 * 			TargetResourceId:   exampleVirtualMachine.ID(),
 * 			StorageLocation: &network.NetworkPacketCaptureStorageLocationArgs{
 * 				StorageAccountId: exampleAccount.ID(),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			exampleExtension,
 * 		}))
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.network.NetworkWatcher;
 * import com.pulumi.azure.network.NetworkWatcherArgs;
 * import com.pulumi.azure.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.network.NetworkInterface;
 * import com.pulumi.azure.network.NetworkInterfaceArgs;
 * import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
 * import com.pulumi.azure.compute.VirtualMachine;
 * import com.pulumi.azure.compute.VirtualMachineArgs;
 * import com.pulumi.azure.compute.inputs.VirtualMachineStorageImageReferenceArgs;
 * import com.pulumi.azure.compute.inputs.VirtualMachineStorageOsDiskArgs;
 * import com.pulumi.azure.compute.inputs.VirtualMachineOsProfileArgs;
 * import com.pulumi.azure.compute.inputs.VirtualMachineOsProfileLinuxConfigArgs;
 * import com.pulumi.azure.compute.Extension;
 * import com.pulumi.azure.compute.ExtensionArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.network.NetworkPacketCapture;
 * import com.pulumi.azure.network.NetworkPacketCaptureArgs;
 * import com.pulumi.azure.network.inputs.NetworkPacketCaptureStorageLocationArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("packet-capture-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleNetworkWatcher = new NetworkWatcher("exampleNetworkWatcher", NetworkWatcherArgs.builder()
 *             .name("network-watcher")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
 *             .name("production-network")
 *             .addressSpaces("10.0.0.0/16")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("internal")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.0.2.0/24")
 *             .build());
 *         var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
 *             .name("pctest-nic")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
 *                 .name("testconfiguration1")
 *                 .subnetId(exampleSubnet.id())
 *                 .privateIpAddressAllocation("Dynamic")
 *                 .build())
 *             .build());
 *         var exampleVirtualMachine = new VirtualMachine("exampleVirtualMachine", VirtualMachineArgs.builder()
 *             .name("pctest-vm")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .networkInterfaceIds(exampleNetworkInterface.id())
 *             .vmSize("Standard_F2")
 *             .storageImageReference(VirtualMachineStorageImageReferenceArgs.builder()
 *                 .publisher("Canonical")
 *                 .offer("0001-com-ubuntu-server-jammy")
 *                 .sku("22_04-lts")
 *                 .version("latest")
 *                 .build())
 *             .storageOsDisk(VirtualMachineStorageOsDiskArgs.builder()
 *                 .name("osdisk")
 *                 .caching("ReadWrite")
 *                 .createOption("FromImage")
 *                 .managedDiskType("Standard_LRS")
 *                 .build())
 *             .osProfile(VirtualMachineOsProfileArgs.builder()
 *                 .computerName("pctest-vm")
 *                 .adminUsername("testadmin")
 *                 .adminPassword("Password1234!")
 *                 .build())
 *             .osProfileLinuxConfig(VirtualMachineOsProfileLinuxConfigArgs.builder()
 *                 .disablePasswordAuthentication(false)
 *                 .build())
 *             .build());
 *         var exampleExtension = new Extension("exampleExtension", ExtensionArgs.builder()
 *             .name("network-watcher")
 *             .virtualMachineId(exampleVirtualMachine.id())
 *             .publisher("Microsoft.Azure.NetworkWatcher")
 *             .type("NetworkWatcherAgentLinux")
 *             .typeHandlerVersion("1.4")
 *             .autoUpgradeMinorVersion(true)
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("pctestsa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleNetworkPacketCapture = new NetworkPacketCapture("exampleNetworkPacketCapture", NetworkPacketCaptureArgs.builder()
 *             .name("pctestcapture")
 *             .networkWatcherName(exampleNetworkWatcher.name())
 *             .resourceGroupName(example.name())
 *             .targetResourceId(exampleVirtualMachine.id())
 *             .storageLocation(NetworkPacketCaptureStorageLocationArgs.builder()
 *                 .storageAccountId(exampleAccount.id())
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(exampleExtension)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: packet-capture-rg
 *       location: West Europe
 *   exampleNetworkWatcher:
 *     type: azure:network:NetworkWatcher
 *     name: example
 *     properties:
 *       name: network-watcher
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleVirtualNetwork:
 *     type: azure:network:VirtualNetwork
 *     name: example
 *     properties:
 *       name: production-network
 *       addressSpaces:
 *         - 10.0.0.0/16
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: internal
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       addressPrefixes:
 *         - 10.0.2.0/24
 *   exampleNetworkInterface:
 *     type: azure:network:NetworkInterface
 *     name: example
 *     properties:
 *       name: pctest-nic
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       ipConfigurations:
 *         - name: testconfiguration1
 *           subnetId: ${exampleSubnet.id}
 *           privateIpAddressAllocation: Dynamic
 *   exampleVirtualMachine:
 *     type: azure:compute:VirtualMachine
 *     name: example
 *     properties:
 *       name: pctest-vm
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       networkInterfaceIds:
 *         - ${exampleNetworkInterface.id}
 *       vmSize: Standard_F2
 *       storageImageReference:
 *         publisher: Canonical
 *         offer: 0001-com-ubuntu-server-jammy
 *         sku: 22_04-lts
 *         version: latest
 *       storageOsDisk:
 *         name: osdisk
 *         caching: ReadWrite
 *         createOption: FromImage
 *         managedDiskType: Standard_LRS
 *       osProfile:
 *         computerName: pctest-vm
 *         adminUsername: testadmin
 *         adminPassword: Password1234!
 *       osProfileLinuxConfig:
 *         disablePasswordAuthentication: false
 *   exampleExtension:
 *     type: azure:compute:Extension
 *     name: example
 *     properties:
 *       name: network-watcher
 *       virtualMachineId: ${exampleVirtualMachine.id}
 *       publisher: Microsoft.Azure.NetworkWatcher
 *       type: NetworkWatcherAgentLinux
 *       typeHandlerVersion: '1.4'
 *       autoUpgradeMinorVersion: true
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: pctestsa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleNetworkPacketCapture:
 *     type: azure:network:NetworkPacketCapture
 *     name: example
 *     properties:
 *       name: pctestcapture
 *       networkWatcherName: ${exampleNetworkWatcher.name}
 *       resourceGroupName: ${example.name}
 *       targetResourceId: ${exampleVirtualMachine.id}
 *       storageLocation:
 *         storageAccountId: ${exampleAccount.id}
 *     options:
 *       dependson:
 *         - ${exampleExtension}
 * ```
 * 
 * > **NOTE:** This Resource requires that [the Network Watcher Virtual Machine Extension](https://docs.microsoft.com/azure/network-watcher/network-watcher-packet-capture-manage-portal#before-you-begin) is installed on the Virtual Machine before capturing can be enabled which can be installed via the `azure.compute.Extension` resource.
 * ## Import
 * Packet Captures can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/networkPacketCapture:NetworkPacketCapture capture1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkWatchers/watcher1/packetCaptures/capture1
 * ```
 * @property filters One or more `filter` blocks as defined below. Changing this forces a new resource to be created.
 * @property maximumBytesPerPacket The number of bytes captured per packet. The remaining bytes are truncated. Defaults to `0` (Entire Packet Captured). Changing this forces a new resource to be created.
 * @property maximumBytesPerSession Maximum size of the capture in Bytes. Defaults to `1073741824` (1GB). Changing this forces a new resource to be created.
 * @property maximumCaptureDuration The maximum duration of the capture session in seconds. Defaults to `18000` (5 hours). Changing this forces a new resource to be created.
 * @property name The name to use for this Network Packet Capture. Changing this forces a new resource to be created.
 * @property networkWatcherName The name of the Network Watcher. Changing this forces a new resource to be created.
 * @property resourceGroupName The name of the resource group in which the Network Watcher exists. Changing this forces a new resource to be created.
 * @property storageLocation A `storage_location` block as defined below. Changing this forces a new resource to be created.
 * @property targetResourceId The ID of the Resource to capture packets from. Changing this forces a new resource to be created.
 * > **NOTE:** Currently only Virtual Machines IDs are supported.
 */
public data class NetworkPacketCaptureArgs(
    public val filters: Output>? = null,
    public val maximumBytesPerPacket: Output? = null,
    public val maximumBytesPerSession: Output? = null,
    public val maximumCaptureDuration: Output? = null,
    public val name: Output? = null,
    public val networkWatcherName: Output? = null,
    public val resourceGroupName: Output? = null,
    public val storageLocation: Output? = null,
    public val targetResourceId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.network.NetworkPacketCaptureArgs =
        com.pulumi.azure.network.NetworkPacketCaptureArgs.builder()
            .filters(
                filters?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .maximumBytesPerPacket(maximumBytesPerPacket?.applyValue({ args0 -> args0 }))
            .maximumBytesPerSession(maximumBytesPerSession?.applyValue({ args0 -> args0 }))
            .maximumCaptureDuration(maximumCaptureDuration?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .networkWatcherName(networkWatcherName?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .storageLocation(storageLocation?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .targetResourceId(targetResourceId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [NetworkPacketCaptureArgs].
 */
@PulumiTagMarker
public class NetworkPacketCaptureArgsBuilder internal constructor() {
    private var filters: Output>? = null

    private var maximumBytesPerPacket: Output? = null

    private var maximumBytesPerSession: Output? = null

    private var maximumCaptureDuration: Output? = null

    private var name: Output? = null

    private var networkWatcherName: Output? = null

    private var resourceGroupName: Output? = null

    private var storageLocation: Output? = null

    private var targetResourceId: Output? = null

    /**
     * @param value One or more `filter` blocks as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("cyjgodhamroqbsly")
    public suspend fun filters(`value`: Output>) {
        this.filters = value
    }

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

    /**
     * @param values One or more `filter` blocks as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("goikrcccswpbnvjs")
    public suspend fun filters(values: List>) {
        this.filters = Output.all(values)
    }

    /**
     * @param value The number of bytes captured per packet. The remaining bytes are truncated. Defaults to `0` (Entire Packet Captured). Changing this forces a new resource to be created.
     */
    @JvmName("kgwxjnbjvvawksvn")
    public suspend fun maximumBytesPerPacket(`value`: Output) {
        this.maximumBytesPerPacket = value
    }

    /**
     * @param value Maximum size of the capture in Bytes. Defaults to `1073741824` (1GB). Changing this forces a new resource to be created.
     */
    @JvmName("riunaioxqpymnptg")
    public suspend fun maximumBytesPerSession(`value`: Output) {
        this.maximumBytesPerSession = value
    }

    /**
     * @param value The maximum duration of the capture session in seconds. Defaults to `18000` (5 hours). Changing this forces a new resource to be created.
     */
    @JvmName("ehocavcqvdrhpqpi")
    public suspend fun maximumCaptureDuration(`value`: Output) {
        this.maximumCaptureDuration = value
    }

    /**
     * @param value The name to use for this Network Packet Capture. Changing this forces a new resource to be created.
     */
    @JvmName("fsuphuwihwvaqprg")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The name of the Network Watcher. Changing this forces a new resource to be created.
     */
    @JvmName("xqasetsirnrlsnai")
    public suspend fun networkWatcherName(`value`: Output) {
        this.networkWatcherName = value
    }

    /**
     * @param value The name of the resource group in which the Network Watcher exists. Changing this forces a new resource to be created.
     */
    @JvmName("xhehnmnaruxccxfp")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value A `storage_location` block as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("dqxqabsdcjxpyuvx")
    public suspend fun storageLocation(`value`: Output) {
        this.storageLocation = value
    }

    /**
     * @param value The ID of the Resource to capture packets from. Changing this forces a new resource to be created.
     * > **NOTE:** Currently only Virtual Machines IDs are supported.
     */
    @JvmName("kdldktricmyiukou")
    public suspend fun targetResourceId(`value`: Output) {
        this.targetResourceId = value
    }

    /**
     * @param value One or more `filter` blocks as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("rpxnlevlpwnfveuc")
    public suspend fun filters(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.filters = mapped
    }

    /**
     * @param argument One or more `filter` blocks as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("ksyloxlcetlmkxmn")
    public suspend fun filters(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            NetworkPacketCaptureFilterArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param argument One or more `filter` blocks as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("ymwrpyjvnwyarxgj")
    public suspend fun filters(vararg argument: suspend NetworkPacketCaptureFilterArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            NetworkPacketCaptureFilterArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param argument One or more `filter` blocks as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("hvdkbbyphckivrri")
    public suspend fun filters(argument: suspend NetworkPacketCaptureFilterArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            NetworkPacketCaptureFilterArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.filters = mapped
    }

    /**
     * @param values One or more `filter` blocks as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("ckdpjsvmxhegxvil")
    public suspend fun filters(vararg values: NetworkPacketCaptureFilterArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.filters = mapped
    }

    /**
     * @param value The number of bytes captured per packet. The remaining bytes are truncated. Defaults to `0` (Entire Packet Captured). Changing this forces a new resource to be created.
     */
    @JvmName("bxefthrrntbplmtq")
    public suspend fun maximumBytesPerPacket(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maximumBytesPerPacket = mapped
    }

    /**
     * @param value Maximum size of the capture in Bytes. Defaults to `1073741824` (1GB). Changing this forces a new resource to be created.
     */
    @JvmName("mwihxfyqtfgaoiuj")
    public suspend fun maximumBytesPerSession(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maximumBytesPerSession = mapped
    }

    /**
     * @param value The maximum duration of the capture session in seconds. Defaults to `18000` (5 hours). Changing this forces a new resource to be created.
     */
    @JvmName("pxllxhmledpkspva")
    public suspend fun maximumCaptureDuration(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maximumCaptureDuration = mapped
    }

    /**
     * @param value The name to use for this Network Packet Capture. Changing this forces a new resource to be created.
     */
    @JvmName("ftegkuqjolvlfrhl")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The name of the Network Watcher. Changing this forces a new resource to be created.
     */
    @JvmName("rcpalubjuqpwfgmb")
    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 resource group in which the Network Watcher exists. Changing this forces a new resource to be created.
     */
    @JvmName("obowvictwofmdgck")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value A `storage_location` block as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("bybutcxfkysljoow")
    public suspend fun storageLocation(`value`: NetworkPacketCaptureStorageLocationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.storageLocation = mapped
    }

    /**
     * @param argument A `storage_location` block as defined below. Changing this forces a new resource to be created.
     */
    @JvmName("fftkpuajrtyrhrme")
    public suspend fun storageLocation(argument: suspend NetworkPacketCaptureStorageLocationArgsBuilder.() -> Unit) {
        val toBeMapped = NetworkPacketCaptureStorageLocationArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.storageLocation = mapped
    }

    /**
     * @param value The ID of the Resource to capture packets from. Changing this forces a new resource to be created.
     * > **NOTE:** Currently only Virtual Machines IDs are supported.
     */
    @JvmName("niwramevmvhidaaw")
    public suspend fun targetResourceId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.targetResourceId = mapped
    }

    internal fun build(): NetworkPacketCaptureArgs = NetworkPacketCaptureArgs(
        filters = filters,
        maximumBytesPerPacket = maximumBytesPerPacket,
        maximumBytesPerSession = maximumBytesPerSession,
        maximumCaptureDuration = maximumCaptureDuration,
        name = name,
        networkWatcherName = networkWatcherName,
        resourceGroupName = resourceGroupName,
        storageLocation = storageLocation,
        targetResourceId = targetResourceId,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy