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

package com.azure.resourcemanager.devtestlabs.generated;

import com.azure.resourcemanager.devtestlabs.models.Secret;
import java.util.HashMap;
import java.util.Map;

/** Samples for Secrets Update. */
public final class SecretsUpdateSamples {
    /*
     * x-ms-original-file: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Update.json
     */
    /**
     * Sample code: Secrets_Update.
     *
     * @param manager Entry point to DevTestLabsManager.
     */
    public static void secretsUpdate(com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager) {
        Secret resource =
            manager
                .secrets()
                .getWithResponse(
                    "resourceGroupName",
                    "{labName}",
                    "{userName}",
                    "{secretName}",
                    null,
                    com.azure.core.util.Context.NONE)
                .getValue();
        resource.update().withTags(mapOf("tagName1", "tagValue1")).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;
    }
}
