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

package com.azure.resourcemanager.servicenetworking.generated;

import java.util.HashMap;
import java.util.Map;

/** Samples for TrafficControllerInterface CreateOrUpdate. */
public final class TrafficControllerInterfaceCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerPut.json
     */
    /**
     * Sample code: Put Traffic Controller.
     *
     * @param manager Entry point to TrafficControllerManager.
     */
    public static void putTrafficController(
        com.azure.resourcemanager.servicenetworking.TrafficControllerManager manager) {
        manager
            .trafficControllerInterfaces()
            .define("tc1")
            .withRegion("NorthCentralUS")
            .withExistingResourceGroup("rg1")
            .withTags(mapOf("key1", "value1"))
            .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;
    }
}
