text: /*
   * Copyright (c) Microsoft Corporation.
   * Licensed under the MIT License.
   *
   * Code generated by Microsoft (R) AutoRest Code Generator.
   * Changes may cause incorrect behavior and will be lost if the code is regenerated.
   */
  
  // Copyright (c) Microsoft Corporation.
  // Licensed under the MIT License.
  const { NetworkManagementClient } = require("@azure/arm-network");
  const { DefaultAzureCredential } = require("@azure/identity");
  
  /**
   * This sample demonstrates how to Starts packet capture on vpn gateway in the specified resource group.
   *
   * @summary Starts packet capture on vpn gateway in the specified resource group.
   * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayStartPacketCaptureFilterData.json
   */
  async function startPacketCaptureOnVpnGatewayWithFilter() {
    const subscriptionId = "subid";
    const resourceGroupName = "rg1";
    const gatewayName = "vpngw";
    const parameters = {
      filterData:
        "{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters': [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort': [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags': 16,'CaptureSingleDirectionTrafficOnly': true}]}",
    };
    const options = { parameters };
    const credential = new DefaultAzureCredential();
    const client = new NetworkManagementClient(credential, subscriptionId);
    const result = await client.vpnGateways.beginStartPacketCaptureAndWait(
      resourceGroupName,
      gatewayName,
      options
    );
    console.log(result);
  }
  
  startPacketCaptureOnVpnGatewayWithFilter().catch(console.error);
  
  /**
   * This sample demonstrates how to Starts packet capture on vpn gateway in the specified resource group.
   *
   * @summary Starts packet capture on vpn gateway in the specified resource group.
   * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayStartPacketCapture.json
   */
  async function startPacketCaptureOnVpnGatewayWithoutFilter() {
    const subscriptionId = "subid";
    const resourceGroupName = "rg1";
    const gatewayName = "vpngw";
    const credential = new DefaultAzureCredential();
    const client = new NetworkManagementClient(credential, subscriptionId);
    const result = await client.vpnGateways.beginStartPacketCaptureAndWait(
      resourceGroupName,
      gatewayName
    );
    console.log(result);
  }
  
  startPacketCaptureOnVpnGatewayWithoutFilter().catch(console.error);
  