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

package com.azure.resourcemanager.appcontainers.generated;

import com.azure.resourcemanager.appcontainers.models.ContainerResources;
import com.azure.resourcemanager.appcontainers.models.JobExecutionContainer;
import com.azure.resourcemanager.appcontainers.models.JobExecutionTemplate;
import java.util.Arrays;

/** Samples for Jobs Start. */
public final class JobsStartSamples {
    /*
     * x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-11-01-preview/examples/Job_Start.json
     */
    /**
     * Sample code: Run a Container Apps Job.
     *
     * @param manager Entry point to ContainerAppsApiManager.
     */
    public static void runAContainerAppsJob(com.azure.resourcemanager.appcontainers.ContainerAppsApiManager manager) {
        manager
            .jobs()
            .start(
                "rg",
                "testcontainerAppsJob0",
                new JobExecutionTemplate()
                    .withContainers(
                        Arrays
                            .asList(
                                new JobExecutionContainer()
                                    .withImage("repo/testcontainerAppsJob0:v4")
                                    .withName("testcontainerAppsJob0")
                                    .withResources(new ContainerResources().withCpu(0.2D).withMemory("100Mi"))))
                    .withInitContainers(
                        Arrays
                            .asList(
                                new JobExecutionContainer()
                                    .withImage("repo/testcontainerAppsJob0:v4")
                                    .withName("testinitcontainerAppsJob0")
                                    .withCommand(Arrays.asList("/bin/sh"))
                                    .withArgs(Arrays.asList("-c", "while true; do echo hello; sleep 10;done"))
                                    .withResources(new ContainerResources().withCpu(0.2D).withMemory("100Mi")))),
                com.azure.core.util.Context.NONE);
    }
}
