All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.avs.implementation.ScriptExecutionImpl Maven / Gradle / Ivy

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

import com.azure.core.http.rest.Response;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.avs.fluent.models.ScriptExecutionInner;
import com.azure.resourcemanager.avs.models.ScriptExecution;
import com.azure.resourcemanager.avs.models.ScriptExecutionParameter;
import com.azure.resourcemanager.avs.models.ScriptExecutionProvisioningState;
import com.azure.resourcemanager.avs.models.ScriptOutputStreamType;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public final class ScriptExecutionImpl implements ScriptExecution, ScriptExecution.Definition, ScriptExecution.Update {
    private ScriptExecutionInner innerObject;

    private final com.azure.resourcemanager.avs.AvsManager serviceManager;

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public String scriptCmdletId() {
        return this.innerModel().scriptCmdletId();
    }

    public List parameters() {
        List inner = this.innerModel().parameters();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public List hiddenParameters() {
        List inner = this.innerModel().hiddenParameters();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public String failureReason() {
        return this.innerModel().failureReason();
    }

    public String timeout() {
        return this.innerModel().timeout();
    }

    public String retention() {
        return this.innerModel().retention();
    }

    public OffsetDateTime submittedAt() {
        return this.innerModel().submittedAt();
    }

    public OffsetDateTime startedAt() {
        return this.innerModel().startedAt();
    }

    public OffsetDateTime finishedAt() {
        return this.innerModel().finishedAt();
    }

    public ScriptExecutionProvisioningState provisioningState() {
        return this.innerModel().provisioningState();
    }

    public List output() {
        List inner = this.innerModel().output();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public Map namedOutputs() {
        Map inner = this.innerModel().namedOutputs();
        if (inner != null) {
            return Collections.unmodifiableMap(inner);
        } else {
            return Collections.emptyMap();
        }
    }

    public List information() {
        List inner = this.innerModel().information();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public List warnings() {
        List inner = this.innerModel().warnings();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public List errors() {
        List inner = this.innerModel().errors();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

    public ScriptExecutionInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.avs.AvsManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String privateCloudName;

    private String scriptExecutionName;

    public ScriptExecutionImpl withExistingPrivateCloud(String resourceGroupName, String privateCloudName) {
        this.resourceGroupName = resourceGroupName;
        this.privateCloudName = privateCloudName;
        return this;
    }

    public ScriptExecution create() {
        this.innerObject = serviceManager.serviceClient()
            .getScriptExecutions()
            .createOrUpdate(resourceGroupName, privateCloudName, scriptExecutionName, this.innerModel(), Context.NONE);
        return this;
    }

    public ScriptExecution create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getScriptExecutions()
            .createOrUpdate(resourceGroupName, privateCloudName, scriptExecutionName, this.innerModel(), context);
        return this;
    }

    ScriptExecutionImpl(String name, com.azure.resourcemanager.avs.AvsManager serviceManager) {
        this.innerObject = new ScriptExecutionInner();
        this.serviceManager = serviceManager;
        this.scriptExecutionName = name;
    }

    public ScriptExecutionImpl update() {
        return this;
    }

    public ScriptExecution apply() {
        this.innerObject = serviceManager.serviceClient()
            .getScriptExecutions()
            .createOrUpdate(resourceGroupName, privateCloudName, scriptExecutionName, this.innerModel(), Context.NONE);
        return this;
    }

    public ScriptExecution apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getScriptExecutions()
            .createOrUpdate(resourceGroupName, privateCloudName, scriptExecutionName, this.innerModel(), context);
        return this;
    }

    ScriptExecutionImpl(ScriptExecutionInner innerObject, com.azure.resourcemanager.avs.AvsManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.privateCloudName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateClouds");
        this.scriptExecutionName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "scriptExecutions");
    }

    public ScriptExecution refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getScriptExecutions()
            .getWithResponse(resourceGroupName, privateCloudName, scriptExecutionName, Context.NONE)
            .getValue();
        return this;
    }

    public ScriptExecution refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getScriptExecutions()
            .getWithResponse(resourceGroupName, privateCloudName, scriptExecutionName, context)
            .getValue();
        return this;
    }

    public Response getExecutionLogsWithResponse(List scriptOutputStreamType,
        Context context) {
        return serviceManager.scriptExecutions()
            .getExecutionLogsWithResponse(resourceGroupName, privateCloudName, scriptExecutionName,
                scriptOutputStreamType, context);
    }

    public ScriptExecution getExecutionLogs() {
        return serviceManager.scriptExecutions()
            .getExecutionLogs(resourceGroupName, privateCloudName, scriptExecutionName);
    }

    public ScriptExecutionImpl withScriptCmdletId(String scriptCmdletId) {
        this.innerModel().withScriptCmdletId(scriptCmdletId);
        return this;
    }

    public ScriptExecutionImpl withParameters(List parameters) {
        this.innerModel().withParameters(parameters);
        return this;
    }

    public ScriptExecutionImpl withHiddenParameters(List hiddenParameters) {
        this.innerModel().withHiddenParameters(hiddenParameters);
        return this;
    }

    public ScriptExecutionImpl withFailureReason(String failureReason) {
        this.innerModel().withFailureReason(failureReason);
        return this;
    }

    public ScriptExecutionImpl withTimeout(String timeout) {
        this.innerModel().withTimeout(timeout);
        return this;
    }

    public ScriptExecutionImpl withRetention(String retention) {
        this.innerModel().withRetention(retention);
        return this;
    }

    public ScriptExecutionImpl withOutput(List output) {
        this.innerModel().withOutput(output);
        return this;
    }

    public ScriptExecutionImpl withNamedOutputs(Map namedOutputs) {
        this.innerModel().withNamedOutputs(namedOutputs);
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy