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

package com.azure.resourcemanager.maps.generated;

import com.azure.resourcemanager.maps.fluent.models.CreatorProperties;
import java.util.HashMap;
import java.util.Map;

/** Samples for Creators CreateOrUpdate. */
public final class CreatorsCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2021-02-01/examples/CreateMapsCreator.json
     */
    /**
     * Sample code: Create Creator Resource.
     *
     * @param manager Entry point to AzureMapsManager.
     */
    public static void createCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) {
        manager
            .creators()
            .define("myCreator")
            .withRegion("eastus2")
            .withExistingAccount("myResourceGroup", "myMapsAccount")
            .withProperties(new CreatorProperties().withStorageUnits(5))
            .withTags(mapOf("test", "true"))
            .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;
    }
}
