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

package com.azure.resourcemanager.servicefabric.generated;

import com.azure.resourcemanager.servicefabric.models.ApplicationMetricDescription;
import com.azure.resourcemanager.servicefabric.models.ApplicationResource;
import java.util.Arrays;

/** Samples for Applications Update. */
public final class ApplicationsUpdateSamples {
    /*
     * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationPatchOperation_example.json
     */
    /**
     * Sample code: Patch an application.
     *
     * @param manager Entry point to ServiceFabricManager.
     */
    public static void patchAnApplication(com.azure.resourcemanager.servicefabric.ServiceFabricManager manager) {
        ApplicationResource resource =
            manager
                .applications()
                .getWithResponse("resRg", "myCluster", "myApp", com.azure.core.util.Context.NONE)
                .getValue();
        resource
            .update()
            .withTypeVersion("1.0")
            .withRemoveApplicationCapacity(false)
            .withMetrics(
                Arrays
                    .asList(
                        new ApplicationMetricDescription()
                            .withName("metric1")
                            .withMaximumCapacity(3L)
                            .withReservationCapacity(1L)
                            .withTotalApplicationCapacity(5L)))
            .apply();
    }
}
