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

package com.azure.resourcemanager.timeseriesinsights.generated;

import com.azure.resourcemanager.timeseriesinsights.models.EventSourceUpdateParameters;
import java.util.HashMap;
import java.util.Map;

/** Samples for EventSources Update. */
public final class EventSourcesUpdateSamples {
    /*
     * x-ms-original-file: specification/timeseriesinsights/resource-manager/Microsoft.TimeSeriesInsights/stable/2020-05-15/examples/EventSourcesPatchTags.json
     */
    /**
     * Sample code: UpdateEventSource.
     *
     * @param manager Entry point to TimeSeriesInsightsManager.
     */
    public static void updateEventSource(
        com.azure.resourcemanager.timeseriesinsights.TimeSeriesInsightsManager manager) {
        manager
            .eventSources()
            .updateWithResponse(
                "rg1",
                "env1",
                "es1",
                new EventSourceUpdateParameters().withTags(mapOf("someKey", "someValue")),
                com.azure.core.util.Context.NONE);
    }

    @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;
    }
}
