// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.resourcemanager.managednetworkfabric.models.BfdConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.ExternalNetwork;
import com.azure.resourcemanager.managednetworkfabric.models.Layer3OptionAProperties;
import com.azure.resourcemanager.managednetworkfabric.models.OptionBProperties;
import com.azure.resourcemanager.managednetworkfabric.models.PeeringOption;
import java.util.Arrays;

/** Samples for ExternalNetworks Update. */
public final class ExternalNetworksUpdateSamples {
    /*
     * x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/ExternalNetworks_Update_MaximumSet_Gen.json
     */
    /**
     * Sample code: ExternalNetworks_Update_MaximumSet_Gen.
     *
     * @param manager Entry point to ManagedNetworkFabricManager.
     */
    public static void externalNetworksUpdateMaximumSetGen(
        com.azure.resourcemanager.managednetworkfabric.ManagedNetworkFabricManager manager) {
        ExternalNetwork resource =
            manager
                .externalNetworks()
                .getWithResponse(
                    "resourceGroupName",
                    "example-l3domain",
                    "example-externalnetwork",
                    com.azure.core.util.Context.NONE)
                .getValue();
        resource
            .update()
            .withPeeringOption(PeeringOption.OPTIONA)
            .withOptionBProperties(
                new OptionBProperties()
                    .withImportRouteTargets(Arrays.asList("65046:10039"))
                    .withExportRouteTargets(Arrays.asList("65046:10039")))
            .withOptionAProperties(
                new Layer3OptionAProperties()
                    .withPrimaryIpv4Prefix("10.1.1.0/30")
                    .withPrimaryIpv6Prefix("3FFE:FFFF:0:CD30::a0/126")
                    .withSecondaryIpv4Prefix("10.1.1.4/30")
                    .withSecondaryIpv6Prefix("3FFE:FFFF:0:CD30::a4/126")
                    .withMtu(1500)
                    .withVlanId(1001)
                    .withPeerAsn(65047)
                    .withBfdConfiguration(new BfdConfiguration()))
            .withImportRoutePolicyId(
                "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName")
            .withExportRoutePolicyId(
                "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName")
            .withAnnotation("Lab 1")
            .apply();
    }
}
