// 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.CommunityActionTypes;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/** Samples for IpExtendedCommunities Create. */
public final class IpExtendedCommunitiesCreateSamples {
    /*
     * x-ms-original-file: specification/managednetworkfabric/resource-manager/Microsoft.ManagedNetworkFabric/preview/2023-02-01-preview/examples/IpExtendedCommunities_Create_MaximumSet_Gen.json
     */
    /**
     * Sample code: IpExtendedCommunities_Create_MaximumSet_Gen.
     *
     * @param manager Entry point to ManagedNetworkFabricManager.
     */
    public static void ipExtendedCommunitiesCreateMaximumSetGen(
        com.azure.resourcemanager.managednetworkfabric.ManagedNetworkFabricManager manager) {
        manager
            .ipExtendedCommunities()
            .define("example_ipExtendedCommunity")
            .withRegion("EastUs")
            .withExistingResourceGroup("rgIpExtendedCommunityLists")
            .withTags(mapOf("key5054", "key"))
            .withAction(CommunityActionTypes.PERMIT)
            .withRouteTargets(Arrays.asList("1234:5678"))
            .withAnnotation("annotationValue")
            .create();
    }

    @SuppressWarnings("unchecked")
    private static <T> Map<String, T> mapOf(Object... inputs) {
        Map<String, T> map = new HashMap<>();
        for (int i = 0; i < inputs.length; i += 2) {
            String key = (String) inputs[i];
            T value = (T) inputs[i + 1];
            map.put(key, value);
        }
        return map;
    }
}
