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

package com.azure.resourcemanager.networkcloud.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * BareMetalMachineRunCommandParameters represents the body of the request to execute a script on the bare metal
 * machine.
 */
@Fluent
public final class BareMetalMachineRunCommandParameters {
    /*
     * The list of string arguments that will be passed to the script in order as separate arguments.
     */
    @JsonProperty(value = "arguments")
    private List<String> arguments;

    /*
     * The maximum time the script is allowed to run.
     * If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be
     * captured, and the exit code matching a timeout will be returned (252).
     */
    @JsonProperty(value = "limitTimeSeconds", required = true)
    private long limitTimeSeconds;

    /*
     * The base64 encoded script to execute on the bare metal machine.
     */
    @JsonProperty(value = "script", required = true)
    private String script;

    /** Creates an instance of BareMetalMachineRunCommandParameters class. */
    public BareMetalMachineRunCommandParameters() {
    }

    /**
     * Get the arguments property: The list of string arguments that will be passed to the script in order as separate
     * arguments.
     *
     * @return the arguments value.
     */
    public List<String> arguments() {
        return this.arguments;
    }

    /**
     * Set the arguments property: The list of string arguments that will be passed to the script in order as separate
     * arguments.
     *
     * @param arguments the arguments value to set.
     * @return the BareMetalMachineRunCommandParameters object itself.
     */
    public BareMetalMachineRunCommandParameters withArguments(List<String> arguments) {
        this.arguments = arguments;
        return this;
    }

    /**
     * Get the limitTimeSeconds property: The maximum time the script is allowed to run. If the execution time exceeds
     * the maximum, the script will be stopped, any output produced until then will be captured, and the exit code
     * matching a timeout will be returned (252).
     *
     * @return the limitTimeSeconds value.
     */
    public long limitTimeSeconds() {
        return this.limitTimeSeconds;
    }

    /**
     * Set the limitTimeSeconds property: The maximum time the script is allowed to run. If the execution time exceeds
     * the maximum, the script will be stopped, any output produced until then will be captured, and the exit code
     * matching a timeout will be returned (252).
     *
     * @param limitTimeSeconds the limitTimeSeconds value to set.
     * @return the BareMetalMachineRunCommandParameters object itself.
     */
    public BareMetalMachineRunCommandParameters withLimitTimeSeconds(long limitTimeSeconds) {
        this.limitTimeSeconds = limitTimeSeconds;
        return this;
    }

    /**
     * Get the script property: The base64 encoded script to execute on the bare metal machine.
     *
     * @return the script value.
     */
    public String script() {
        return this.script;
    }

    /**
     * Set the script property: The base64 encoded script to execute on the bare metal machine.
     *
     * @param script the script value to set.
     * @return the BareMetalMachineRunCommandParameters object itself.
     */
    public BareMetalMachineRunCommandParameters withScript(String script) {
        this.script = script;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (script() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property script in model BareMetalMachineRunCommandParameters"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(BareMetalMachineRunCommandParameters.class);
}
