// 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;

/**
 * StorageApplianceRunReadCommandsParameters represents the body of request containing list of read-only commands to run
 * for a storage appliance.
 */
@Fluent
public final class StorageApplianceRunReadCommandsParameters {
    /*
     * The list of read-only commands to run.
     */
    @JsonProperty(value = "commands", required = true)
    private List<StorageApplianceCommandSpecification> commands;

    /*
     * The maximum time the commands are 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;

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

    /**
     * Get the commands property: The list of read-only commands to run.
     *
     * @return the commands value.
     */
    public List<StorageApplianceCommandSpecification> commands() {
        return this.commands;
    }

    /**
     * Set the commands property: The list of read-only commands to run.
     *
     * @param commands the commands value to set.
     * @return the StorageApplianceRunReadCommandsParameters object itself.
     */
    public StorageApplianceRunReadCommandsParameters withCommands(List<StorageApplianceCommandSpecification> commands) {
        this.commands = commands;
        return this;
    }

    /**
     * Get the limitTimeSeconds property: The maximum time the commands are 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 commands are 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 StorageApplianceRunReadCommandsParameters object itself.
     */
    public StorageApplianceRunReadCommandsParameters withLimitTimeSeconds(long limitTimeSeconds) {
        this.limitTimeSeconds = limitTimeSeconds;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (commands() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property commands in model StorageApplianceRunReadCommandsParameters"));
        } else {
            commands().forEach(e -> e.validate());
        }
    }

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