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

package com.azure.resourcemanager.containerservicefleet.generated;

import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate;
import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeSpec;
import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType;
import com.azure.resourcemanager.containerservicefleet.models.UpdateGroup;
import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStrategy;
import com.azure.resourcemanager.containerservicefleet.models.UpdateStage;
import java.util.Arrays;

/** Samples for UpdateRuns CreateOrUpdate. */
public final class UpdateRunsCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_CreateOrUpdate.json
     */
    /**
     * Sample code: Create an UpdateRun.
     *
     * @param manager Entry point to ContainerServiceFleetManager.
     */
    public static void createAnUpdateRun(
        com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager manager) {
        manager
            .updateRuns()
            .define("run1")
            .withExistingFleet("rg1", "fleet1")
            .withStrategy(
                new UpdateRunStrategy()
                    .withStages(
                        Arrays
                            .asList(
                                new UpdateStage()
                                    .withName("stage1")
                                    .withGroups(Arrays.asList(new UpdateGroup().withName("group-a")))
                                    .withAfterStageWaitInSeconds(3600))))
            .withManagedClusterUpdate(
                new ManagedClusterUpdate()
                    .withUpgrade(
                        new ManagedClusterUpgradeSpec()
                            .withType(ManagedClusterUpgradeType.FULL)
                            .withKubernetesVersion("1.26.1")))
            .create();
    }
}
