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

package com.azure.resourcemanager.machinelearning.generated;

import com.azure.resourcemanager.machinelearning.models.BatchDeployment;
import com.azure.resourcemanager.machinelearning.models.PartialBatchDeployment;
import java.util.HashMap;
import java.util.Map;

/** Samples for BatchDeployments Update. */
public final class BatchDeploymentsUpdateSamples {
    /*
     * x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/BatchDeployment/update.json
     */
    /**
     * Sample code: Update Batch Deployment.
     *
     * @param manager Entry point to MachineLearningManager.
     */
    public static void updateBatchDeployment(com.azure.resourcemanager.machinelearning.MachineLearningManager manager) {
        BatchDeployment resource =
            manager
                .batchDeployments()
                .getWithResponse(
                    "test-rg",
                    "my-aml-workspace",
                    "testEndpointName",
                    "testDeploymentName",
                    com.azure.core.util.Context.NONE)
                .getValue();
        resource
            .update()
            .withTags(mapOf())
            .withProperties(new PartialBatchDeployment().withDescription("string"))
            .apply();
    }

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