// 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.ExportRoutePolicyInformation;
import com.azure.resourcemanager.managednetworkfabric.models.ImportRoutePolicyInformation;
import com.azure.resourcemanager.managednetworkfabric.models.Layer2Configuration;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkToNetworkInterconnect;
import com.azure.resourcemanager.managednetworkfabric.models.NpbStaticRouteConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.OptionBLayer3Configuration;
import com.azure.resourcemanager.managednetworkfabric.models.StaticRouteProperties;
import java.util.Arrays;

/** Samples for NetworkToNetworkInterconnects Update. */
public final class NetworkToNetworkInterconnectsUpdateSamples {
    /*
     * x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/stable/2023-06-15/examples/NetworkToNetworkInterconnects_Update_MaximumSet_Gen.json
     */
    /**
     * Sample code: NetworkToNetworkInterconnects_Update_MaximumSet_Gen.
     *
     * @param manager Entry point to ManagedNetworkFabricManager.
     */
    public static void networkToNetworkInterconnectsUpdateMaximumSetGen(
        com.azure.resourcemanager.managednetworkfabric.ManagedNetworkFabricManager manager) {
        NetworkToNetworkInterconnect resource =
            manager
                .networkToNetworkInterconnects()
                .getWithResponse("example-rg", "example-fabric", "example-nni", com.azure.core.util.Context.NONE)
                .getValue();
        resource
            .update()
            .withLayer2Configuration(
                new Layer2Configuration()
                    .withMtu(1500)
                    .withInterfaces(
                        Arrays
                            .asList(
                                "/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourceGroups/example-rg/providers/Microsoft.ManagedNetworkFabric/networkDevices/example-networkDevice/networkInterfaces/example-networkInterface")))
            .withOptionBLayer3Configuration(
                new OptionBLayer3Configuration()
                    .withPrimaryIpv4Prefix("20.0.0.12/29")
                    .withPrimaryIpv6Prefix("4FFE:FFFF:0:CD30::a8/127")
                    .withSecondaryIpv4Prefix("20.0.0.14/29")
                    .withSecondaryIpv6Prefix("6FFE:FFFF:0:CD30::ac/127")
                    .withPeerAsn(2345L)
                    .withVlanId(1235))
            .withNpbStaticRouteConfiguration(
                new NpbStaticRouteConfiguration()
                    .withBfdConfiguration(new BfdConfiguration().withIntervalInMilliSeconds(310).withMultiplier(15))
                    .withIpv4Routes(
                        Arrays
                            .asList(
                                new StaticRouteProperties()
                                    .withPrefix("20.0.0.11/30")
                                    .withNextHop(Arrays.asList("21.20.20.10"))))
                    .withIpv6Routes(
                        Arrays
                            .asList(
                                new StaticRouteProperties()
                                    .withPrefix("4FFE:FFFF:0:CD30::ac/127")
                                    .withNextHop(Arrays.asList("5FFE:FFFF:0:CD30::ac")))))
            .withImportRoutePolicy(
                new ImportRoutePolicyInformation()
                    .withImportIpv4RoutePolicyId(
                        "/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourceGroups/example-rg/providers/Microsoft.ManagedNetworkFabric/routePolicies/example-routePolicy1")
                    .withImportIpv6RoutePolicyId(
                        "/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourceGroups/example-rg/providers/Microsoft.ManagedNetworkFabric/routePolicies/example-routePolicy1"))
            .withExportRoutePolicy(
                new ExportRoutePolicyInformation()
                    .withExportIpv4RoutePolicyId(
                        "/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourceGroups/example-rg/providers/Microsoft.ManagedNetworkFabric/routePolicies/example-routePolicy1")
                    .withExportIpv6RoutePolicyId(
                        "/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourceGroups/example-rg/providers/Microsoft.ManagedNetworkFabric/routePolicies/example-routePolicy1"))
            .withEgressAclId(
                "/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourceGroups/example-rg/providers/Microsoft.ManagedNetworkFabric/accessControlLists/example-acl")
            .withIngressAclId(
                "/subscriptions/1234ABCD-0A1B-1234-5678-123456ABCDEF/resourceGroups/example-rg/providers/Microsoft.ManagedNetworkFabric/accessControlLists/example-acl")
            .apply();
    }
}
