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

com.azure.resourcemanager.hybridcompute.fluent.models.MachineRunCommandInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.

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

package com.azure.resourcemanager.hybridcompute.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.hybridcompute.models.MachineRunCommandInstanceView;
import com.azure.resourcemanager.hybridcompute.models.MachineRunCommandScriptSource;
import com.azure.resourcemanager.hybridcompute.models.RunCommandInputParameter;
import com.azure.resourcemanager.hybridcompute.models.RunCommandManagedIdentity;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Describes a Run Command.
 */
@Fluent
public final class MachineRunCommandInner extends Resource {
    /*
     * Describes Run Command Properties
     */
    private MachineRunCommandProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    private SystemData systemData;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the innerProperties property: Describes Run Command Properties.
     * 
     * @return the innerProperties value.
     */
    private MachineRunCommandProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     * 
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public MachineRunCommandInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public MachineRunCommandInner withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the source property: The source of the run command script.
     * 
     * @return the source value.
     */
    public MachineRunCommandScriptSource source() {
        return this.innerProperties() == null ? null : this.innerProperties().source();
    }

    /**
     * Set the source property: The source of the run command script.
     * 
     * @param source the source value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withSource(MachineRunCommandScriptSource source) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withSource(source);
        return this;
    }

    /**
     * Get the parameters property: The parameters used by the script.
     * 
     * @return the parameters value.
     */
    public List parameters() {
        return this.innerProperties() == null ? null : this.innerProperties().parameters();
    }

    /**
     * Set the parameters property: The parameters used by the script.
     * 
     * @param parameters the parameters value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withParameters(List parameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withParameters(parameters);
        return this;
    }

    /**
     * Get the protectedParameters property: The parameters used by the script.
     * 
     * @return the protectedParameters value.
     */
    public List protectedParameters() {
        return this.innerProperties() == null ? null : this.innerProperties().protectedParameters();
    }

    /**
     * Set the protectedParameters property: The parameters used by the script.
     * 
     * @param protectedParameters the protectedParameters value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withProtectedParameters(List protectedParameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withProtectedParameters(protectedParameters);
        return this;
    }

    /**
     * Get the asyncExecution property: Optional. If set to true, provisioning will complete as soon as script starts
     * and will not wait for script to complete.
     * 
     * @return the asyncExecution value.
     */
    public Boolean asyncExecution() {
        return this.innerProperties() == null ? null : this.innerProperties().asyncExecution();
    }

    /**
     * Set the asyncExecution property: Optional. If set to true, provisioning will complete as soon as script starts
     * and will not wait for script to complete.
     * 
     * @param asyncExecution the asyncExecution value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withAsyncExecution(Boolean asyncExecution) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withAsyncExecution(asyncExecution);
        return this;
    }

    /**
     * Get the runAsUser property: Specifies the user account on the machine when executing the run command.
     * 
     * @return the runAsUser value.
     */
    public String runAsUser() {
        return this.innerProperties() == null ? null : this.innerProperties().runAsUser();
    }

    /**
     * Set the runAsUser property: Specifies the user account on the machine when executing the run command.
     * 
     * @param runAsUser the runAsUser value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withRunAsUser(String runAsUser) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withRunAsUser(runAsUser);
        return this;
    }

    /**
     * Get the runAsPassword property: Specifies the user account password on the machine when executing the run
     * command.
     * 
     * @return the runAsPassword value.
     */
    public String runAsPassword() {
        return this.innerProperties() == null ? null : this.innerProperties().runAsPassword();
    }

    /**
     * Set the runAsPassword property: Specifies the user account password on the machine when executing the run
     * command.
     * 
     * @param runAsPassword the runAsPassword value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withRunAsPassword(String runAsPassword) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withRunAsPassword(runAsPassword);
        return this;
    }

    /**
     * Get the timeoutInSeconds property: The timeout in seconds to execute the run command.
     * 
     * @return the timeoutInSeconds value.
     */
    public Integer timeoutInSeconds() {
        return this.innerProperties() == null ? null : this.innerProperties().timeoutInSeconds();
    }

    /**
     * Set the timeoutInSeconds property: The timeout in seconds to execute the run command.
     * 
     * @param timeoutInSeconds the timeoutInSeconds value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withTimeoutInSeconds(Integer timeoutInSeconds) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withTimeoutInSeconds(timeoutInSeconds);
        return this;
    }

    /**
     * Get the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. Use
     * a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob.
     * Refer outputBlobManagedIdentity parameter.
     * 
     * @return the outputBlobUri value.
     */
    public String outputBlobUri() {
        return this.innerProperties() == null ? null : this.innerProperties().outputBlobUri();
    }

    /**
     * Set the outputBlobUri property: Specifies the Azure storage blob where script output stream will be uploaded. Use
     * a SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob.
     * Refer outputBlobManagedIdentity parameter.
     * 
     * @param outputBlobUri the outputBlobUri value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withOutputBlobUri(String outputBlobUri) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withOutputBlobUri(outputBlobUri);
        return this;
    }

    /**
     * Get the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. Use a
     * SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob.
     * Refer errorBlobManagedIdentity parameter.
     * 
     * @return the errorBlobUri value.
     */
    public String errorBlobUri() {
        return this.innerProperties() == null ? null : this.innerProperties().errorBlobUri();
    }

    /**
     * Set the errorBlobUri property: Specifies the Azure storage blob where script error stream will be uploaded. Use a
     * SAS URI with read, append, create, write access OR use managed identity to provide the VM access to the blob.
     * Refer errorBlobManagedIdentity parameter.
     * 
     * @param errorBlobUri the errorBlobUri value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withErrorBlobUri(String errorBlobUri) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withErrorBlobUri(errorBlobUri);
        return this;
    }

    /**
     * Get the outputBlobManagedIdentity property: User-assigned managed identity that has access to outputBlobUri
     * storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given
     * access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned
     * identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer
     * https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.
     * 
     * @return the outputBlobManagedIdentity value.
     */
    public RunCommandManagedIdentity outputBlobManagedIdentity() {
        return this.innerProperties() == null ? null : this.innerProperties().outputBlobManagedIdentity();
    }

    /**
     * Set the outputBlobManagedIdentity property: User-assigned managed identity that has access to outputBlobUri
     * storage blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given
     * access to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned
     * identity, make sure you add it under VM's identity. For more info on managed identity and Run Command, refer
     * https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.
     * 
     * @param outputBlobManagedIdentity the outputBlobManagedIdentity value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withOutputBlobManagedIdentity(RunCommandManagedIdentity outputBlobManagedIdentity) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withOutputBlobManagedIdentity(outputBlobManagedIdentity);
        return this;
    }

    /**
     * Get the errorBlobManagedIdentity property: User-assigned managed identity that has access to errorBlobUri storage
     * blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access
     * to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make
     * sure you add it under VM's identity. For more info on managed identity and Run Command, refer
     * https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.
     * 
     * @return the errorBlobManagedIdentity value.
     */
    public RunCommandManagedIdentity errorBlobManagedIdentity() {
        return this.innerProperties() == null ? null : this.innerProperties().errorBlobManagedIdentity();
    }

    /**
     * Set the errorBlobManagedIdentity property: User-assigned managed identity that has access to errorBlobUri storage
     * blob. Use an empty object in case of system-assigned identity. Make sure managed identity has been given access
     * to blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make
     * sure you add it under VM's identity. For more info on managed identity and Run Command, refer
     * https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged.
     * 
     * @param errorBlobManagedIdentity the errorBlobManagedIdentity value to set.
     * @return the MachineRunCommandInner object itself.
     */
    public MachineRunCommandInner withErrorBlobManagedIdentity(RunCommandManagedIdentity errorBlobManagedIdentity) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MachineRunCommandProperties();
        }
        this.innerProperties().withErrorBlobManagedIdentity(errorBlobManagedIdentity);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state, which only appears in the response.
     * 
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the instanceView property: The machine run command instance view.
     * 
     * @return the instanceView value.
     */
    public MachineRunCommandInstanceView instanceView() {
        return this.innerProperties() == null ? null : this.innerProperties().instanceView();
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("location", location());
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of MachineRunCommandInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of MachineRunCommandInner if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the MachineRunCommandInner.
     */
    public static MachineRunCommandInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            MachineRunCommandInner deserializedMachineRunCommandInner = new MachineRunCommandInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedMachineRunCommandInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedMachineRunCommandInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedMachineRunCommandInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedMachineRunCommandInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedMachineRunCommandInner.withTags(tags);
                } else if ("properties".equals(fieldName)) {
                    deserializedMachineRunCommandInner.innerProperties = MachineRunCommandProperties.fromJson(reader);
                } else if ("systemData".equals(fieldName)) {
                    deserializedMachineRunCommandInner.systemData = SystemData.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMachineRunCommandInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy