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

package com.azure.resourcemanager.avs.models;

import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.resourcemanager.avs.fluent.models.ScriptExecutionInner;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** An immutable client-side representation of ScriptExecution. */
public interface ScriptExecution {
    /**
     * Gets the id property: Fully qualified resource Id for the resource.
     *
     * @return the id value.
     */
    String id();

    /**
     * Gets the name property: The name of the resource.
     *
     * @return the name value.
     */
    String name();

    /**
     * Gets the type property: The type of the resource.
     *
     * @return the type value.
     */
    String type();

    /**
     * Gets the scriptCmdletId property: A reference to the script cmdlet resource if user is running a AVS script.
     *
     * @return the scriptCmdletId value.
     */
    String scriptCmdletId();

    /**
     * Gets the parameters property: Parameters the script will accept.
     *
     * @return the parameters value.
     */
    List<ScriptExecutionParameter> parameters();

    /**
     * Gets the hiddenParameters property: Parameters that will be hidden/not visible to ARM, such as passwords and
     * credentials.
     *
     * @return the hiddenParameters value.
     */
    List<ScriptExecutionParameter> hiddenParameters();

    /**
     * Gets the failureReason property: Error message if the script was able to run, but if the script itself had errors
     * or powershell threw an exception.
     *
     * @return the failureReason value.
     */
    String failureReason();

    /**
     * Gets the timeout property: Time limit for execution.
     *
     * @return the timeout value.
     */
    String timeout();

    /**
     * Gets the retention property: Time to live for the resource. If not provided, will be available for 60 days.
     *
     * @return the retention value.
     */
    String retention();

    /**
     * Gets the submittedAt property: Time the script execution was submitted.
     *
     * @return the submittedAt value.
     */
    OffsetDateTime submittedAt();

    /**
     * Gets the startedAt property: Time the script execution was started.
     *
     * @return the startedAt value.
     */
    OffsetDateTime startedAt();

    /**
     * Gets the finishedAt property: Time the script execution was finished.
     *
     * @return the finishedAt value.
     */
    OffsetDateTime finishedAt();

    /**
     * Gets the provisioningState property: The state of the script execution resource.
     *
     * @return the provisioningState value.
     */
    ScriptExecutionProvisioningState provisioningState();

    /**
     * Gets the output property: Standard output stream from the powershell execution.
     *
     * @return the output value.
     */
    List<String> output();

    /**
     * Gets the namedOutputs property: User-defined dictionary.
     *
     * @return the namedOutputs value.
     */
    Map<String, Object> namedOutputs();

    /**
     * Gets the information property: Standard information out stream from the powershell execution.
     *
     * @return the information value.
     */
    List<String> information();

    /**
     * Gets the warnings property: Standard warning out stream from the powershell execution.
     *
     * @return the warnings value.
     */
    List<String> warnings();

    /**
     * Gets the errors property: Standard error output stream from the powershell execution.
     *
     * @return the errors value.
     */
    List<String> errors();

    /**
     * Gets the name of the resource group.
     *
     * @return the name of the resource group.
     */
    String resourceGroupName();

    /**
     * Gets the inner com.azure.resourcemanager.avs.fluent.models.ScriptExecutionInner object.
     *
     * @return the inner object.
     */
    ScriptExecutionInner innerModel();

    /** The entirety of the ScriptExecution definition. */
    interface Definition
        extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate {
    }
    /** The ScriptExecution definition stages. */
    interface DefinitionStages {
        /** The first stage of the ScriptExecution definition. */
        interface Blank extends WithParentResource {
        }
        /** The stage of the ScriptExecution definition allowing to specify parent resource. */
        interface WithParentResource {
            /**
             * Specifies resourceGroupName, privateCloudName.
             *
             * @param resourceGroupName The name of the resource group. The name is case insensitive.
             * @param privateCloudName The name of the private cloud.
             * @return the next definition stage.
             */
            WithCreate withExistingPrivateCloud(String resourceGroupName, String privateCloudName);
        }
        /**
         * The stage of the ScriptExecution definition which contains all the minimum required properties for the
         * resource to be created, but also allows for any other optional properties to be specified.
         */
        interface WithCreate
            extends DefinitionStages.WithScriptCmdletId,
                DefinitionStages.WithParameters,
                DefinitionStages.WithHiddenParameters,
                DefinitionStages.WithFailureReason,
                DefinitionStages.WithTimeout,
                DefinitionStages.WithRetention,
                DefinitionStages.WithOutput,
                DefinitionStages.WithNamedOutputs {
            /**
             * Executes the create request.
             *
             * @return the created resource.
             */
            ScriptExecution create();

            /**
             * Executes the create request.
             *
             * @param context The context to associate with this operation.
             * @return the created resource.
             */
            ScriptExecution create(Context context);
        }
        /** The stage of the ScriptExecution definition allowing to specify scriptCmdletId. */
        interface WithScriptCmdletId {
            /**
             * Specifies the scriptCmdletId property: A reference to the script cmdlet resource if user is running a AVS
             * script.
             *
             * @param scriptCmdletId A reference to the script cmdlet resource if user is running a AVS script.
             * @return the next definition stage.
             */
            WithCreate withScriptCmdletId(String scriptCmdletId);
        }
        /** The stage of the ScriptExecution definition allowing to specify parameters. */
        interface WithParameters {
            /**
             * Specifies the parameters property: Parameters the script will accept.
             *
             * @param parameters Parameters the script will accept.
             * @return the next definition stage.
             */
            WithCreate withParameters(List<ScriptExecutionParameter> parameters);
        }
        /** The stage of the ScriptExecution definition allowing to specify hiddenParameters. */
        interface WithHiddenParameters {
            /**
             * Specifies the hiddenParameters property: Parameters that will be hidden/not visible to ARM, such as
             * passwords and credentials.
             *
             * @param hiddenParameters Parameters that will be hidden/not visible to ARM, such as passwords and
             *     credentials.
             * @return the next definition stage.
             */
            WithCreate withHiddenParameters(List<ScriptExecutionParameter> hiddenParameters);
        }
        /** The stage of the ScriptExecution definition allowing to specify failureReason. */
        interface WithFailureReason {
            /**
             * Specifies the failureReason property: Error message if the script was able to run, but if the script
             * itself had errors or powershell threw an exception.
             *
             * @param failureReason Error message if the script was able to run, but if the script itself had errors or
             *     powershell threw an exception.
             * @return the next definition stage.
             */
            WithCreate withFailureReason(String failureReason);
        }
        /** The stage of the ScriptExecution definition allowing to specify timeout. */
        interface WithTimeout {
            /**
             * Specifies the timeout property: Time limit for execution.
             *
             * @param timeout Time limit for execution.
             * @return the next definition stage.
             */
            WithCreate withTimeout(String timeout);
        }
        /** The stage of the ScriptExecution definition allowing to specify retention. */
        interface WithRetention {
            /**
             * Specifies the retention property: Time to live for the resource. If not provided, will be available for
             * 60 days.
             *
             * @param retention Time to live for the resource. If not provided, will be available for 60 days.
             * @return the next definition stage.
             */
            WithCreate withRetention(String retention);
        }
        /** The stage of the ScriptExecution definition allowing to specify output. */
        interface WithOutput {
            /**
             * Specifies the output property: Standard output stream from the powershell execution.
             *
             * @param output Standard output stream from the powershell execution.
             * @return the next definition stage.
             */
            WithCreate withOutput(List<String> output);
        }
        /** The stage of the ScriptExecution definition allowing to specify namedOutputs. */
        interface WithNamedOutputs {
            /**
             * Specifies the namedOutputs property: User-defined dictionary..
             *
             * @param namedOutputs User-defined dictionary.
             * @return the next definition stage.
             */
            WithCreate withNamedOutputs(Map<String, Object> namedOutputs);
        }
    }
    /**
     * Begins update for the ScriptExecution resource.
     *
     * @return the stage of resource update.
     */
    ScriptExecution.Update update();

    /** The template for ScriptExecution update. */
    interface Update
        extends UpdateStages.WithScriptCmdletId,
            UpdateStages.WithParameters,
            UpdateStages.WithHiddenParameters,
            UpdateStages.WithFailureReason,
            UpdateStages.WithTimeout,
            UpdateStages.WithRetention,
            UpdateStages.WithOutput,
            UpdateStages.WithNamedOutputs {
        /**
         * Executes the update request.
         *
         * @return the updated resource.
         */
        ScriptExecution apply();

        /**
         * Executes the update request.
         *
         * @param context The context to associate with this operation.
         * @return the updated resource.
         */
        ScriptExecution apply(Context context);
    }
    /** The ScriptExecution update stages. */
    interface UpdateStages {
        /** The stage of the ScriptExecution update allowing to specify scriptCmdletId. */
        interface WithScriptCmdletId {
            /**
             * Specifies the scriptCmdletId property: A reference to the script cmdlet resource if user is running a AVS
             * script.
             *
             * @param scriptCmdletId A reference to the script cmdlet resource if user is running a AVS script.
             * @return the next definition stage.
             */
            Update withScriptCmdletId(String scriptCmdletId);
        }
        /** The stage of the ScriptExecution update allowing to specify parameters. */
        interface WithParameters {
            /**
             * Specifies the parameters property: Parameters the script will accept.
             *
             * @param parameters Parameters the script will accept.
             * @return the next definition stage.
             */
            Update withParameters(List<ScriptExecutionParameter> parameters);
        }
        /** The stage of the ScriptExecution update allowing to specify hiddenParameters. */
        interface WithHiddenParameters {
            /**
             * Specifies the hiddenParameters property: Parameters that will be hidden/not visible to ARM, such as
             * passwords and credentials.
             *
             * @param hiddenParameters Parameters that will be hidden/not visible to ARM, such as passwords and
             *     credentials.
             * @return the next definition stage.
             */
            Update withHiddenParameters(List<ScriptExecutionParameter> hiddenParameters);
        }
        /** The stage of the ScriptExecution update allowing to specify failureReason. */
        interface WithFailureReason {
            /**
             * Specifies the failureReason property: Error message if the script was able to run, but if the script
             * itself had errors or powershell threw an exception.
             *
             * @param failureReason Error message if the script was able to run, but if the script itself had errors or
             *     powershell threw an exception.
             * @return the next definition stage.
             */
            Update withFailureReason(String failureReason);
        }
        /** The stage of the ScriptExecution update allowing to specify timeout. */
        interface WithTimeout {
            /**
             * Specifies the timeout property: Time limit for execution.
             *
             * @param timeout Time limit for execution.
             * @return the next definition stage.
             */
            Update withTimeout(String timeout);
        }
        /** The stage of the ScriptExecution update allowing to specify retention. */
        interface WithRetention {
            /**
             * Specifies the retention property: Time to live for the resource. If not provided, will be available for
             * 60 days.
             *
             * @param retention Time to live for the resource. If not provided, will be available for 60 days.
             * @return the next definition stage.
             */
            Update withRetention(String retention);
        }
        /** The stage of the ScriptExecution update allowing to specify output. */
        interface WithOutput {
            /**
             * Specifies the output property: Standard output stream from the powershell execution.
             *
             * @param output Standard output stream from the powershell execution.
             * @return the next definition stage.
             */
            Update withOutput(List<String> output);
        }
        /** The stage of the ScriptExecution update allowing to specify namedOutputs. */
        interface WithNamedOutputs {
            /**
             * Specifies the namedOutputs property: User-defined dictionary..
             *
             * @param namedOutputs User-defined dictionary.
             * @return the next definition stage.
             */
            Update withNamedOutputs(Map<String, Object> namedOutputs);
        }
    }
    /**
     * Refreshes the resource to sync with Azure.
     *
     * @return the refreshed resource.
     */
    ScriptExecution refresh();

    /**
     * Refreshes the resource to sync with Azure.
     *
     * @param context The context to associate with this operation.
     * @return the refreshed resource.
     */
    ScriptExecution refresh(Context context);

    /**
     * Return the logs for a script execution resource.
     *
     * @param scriptOutputStreamType Name of the desired output stream to return. If not provided, will return all. An
     *     empty array will return nothing.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an instance of a script executed by a user - custom or AVS along with {@link Response}.
     */
    Response<ScriptExecution> getExecutionLogsWithResponse(
        List<ScriptOutputStreamType> scriptOutputStreamType, Context context);

    /**
     * Return the logs for a script execution resource.
     *
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an instance of a script executed by a user - custom or AVS.
     */
    ScriptExecution getExecutionLogs();
}
