// 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.AllowASOverride;
import com.azure.resourcemanager.managednetworkfabric.models.BfdConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.BgpConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.BooleanEnumProperty;
import com.azure.resourcemanager.managednetworkfabric.models.ConnectedSubnet;
import com.azure.resourcemanager.managednetworkfabric.models.InternalNetwork;
import com.azure.resourcemanager.managednetworkfabric.models.NeighborAddress;
import com.azure.resourcemanager.managednetworkfabric.models.StaticRouteConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.StaticRouteProperties;
import java.util.Arrays;

/** Samples for InternalNetworks Update. */
public final class InternalNetworksUpdateSamples {
    /*
     * x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/InternalNetworks_Update_MaximumSet_Gen.json
     */
    /**
     * Sample code: InternalNetworks_Update_MaximumSet_Gen.
     *
     * @param manager Entry point to ManagedNetworkFabricManager.
     */
    public static void internalNetworksUpdateMaximumSetGen(
        com.azure.resourcemanager.managednetworkfabric.ManagedNetworkFabricManager manager) {
        InternalNetwork resource =
            manager
                .internalNetworks()
                .getWithResponse(
                    "resourceGroupName",
                    "example-l3domain",
                    "example-internalnetwork",
                    com.azure.core.util.Context.NONE)
                .getValue();
        resource
            .update()
            .withMtu(1500)
            .withConnectedIPv4Subnets(Arrays.asList(new ConnectedSubnet().withPrefix("10.0.0.0/24")))
            .withConnectedIPv6Subnets(Arrays.asList(new ConnectedSubnet().withPrefix("3FFE:FFFF:0:CD30::a0/29")))
            .withStaticRouteConfiguration(
                new StaticRouteConfiguration()
                    .withBfdConfiguration(new BfdConfiguration())
                    .withIpv4Routes(
                        Arrays
                            .asList(
                                new StaticRouteProperties()
                                    .withPrefix("10.1.0.0/24")
                                    .withNextHop(Arrays.asList("10.0.0.1"))))
                    .withIpv6Routes(
                        Arrays
                            .asList(
                                new StaticRouteProperties()
                                    .withPrefix("2fff::/64")
                                    .withNextHop(Arrays.asList("2ffe::1")))))
            .withBgpConfiguration(
                new BgpConfiguration()
                    .withBfdConfiguration(new BfdConfiguration())
                    .withDefaultRouteOriginate(BooleanEnumProperty.TRUE)
                    .withAllowAS(1)
                    .withAllowASOverride(AllowASOverride.ENABLE)
                    .withPeerAsn(6)
                    .withIpv4ListenRangePrefixes(Arrays.asList("10.1.0.0/25"))
                    .withIpv6ListenRangePrefixes(Arrays.asList("2fff::/66"))
                    .withIpv4NeighborAddress(Arrays.asList(new NeighborAddress().withAddress("10.1.0.0")))
                    .withIpv6NeighborAddress(Arrays.asList(new NeighborAddress().withAddress("2fff::"))))
            .withImportRoutePolicyId(
                "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName1")
            .withExportRoutePolicyId(
                "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/routePolicies/routePolicyName2")
            .apply();
    }
}
