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

package com.azure.resourcemanager.hanaonazure.generated;

import com.azure.resourcemanager.hanaonazure.models.IpAddress;
import com.azure.resourcemanager.hanaonazure.models.NetworkProfile;
import com.azure.resourcemanager.hanaonazure.models.OSProfile;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/** Samples for HanaInstances Create. */
public final class HanaInstancesCreateSamples {
    /*
     * x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2017-11-03-preview/examples/HanaInstances_Create.json
     */
    /**
     * Sample code: Create a HANA instance.
     *
     * @param manager Entry point to HanaManager.
     */
    public static void createAHANAInstance(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
        manager
            .hanaInstances()
            .define("myHanaInstance")
            .withRegion("westus")
            .withExistingResourceGroup("myResourceGroup")
            .withTags(mapOf("key", "value"))
            .withOsProfile(new OSProfile().withComputerName("myComputerName").withSshPublicKey("fakeTokenPlaceholder"))
            .withNetworkProfile(
                new NetworkProfile()
                    .withNetworkInterfaces(Arrays.asList(new IpAddress().withIpAddress("100.100.100.100"))))
            .withPartnerNodeId(
                "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/hanaInstances/myHanaInstance2")
            .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;
    }
}
