com.azure.resourcemanager.hybridcompute.fluent.models.MachineRunCommandProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hybridcompute Show documentation
Show all versions of azure-resourcemanager-hybridcompute Show documentation
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.json.JsonReader;
import com.azure.json.JsonSerializable;
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;
/**
* Describes the properties of a run command.
*/
@Fluent
public final class MachineRunCommandProperties implements JsonSerializable {
/*
* The source of the run command script.
*/
private MachineRunCommandScriptSource source;
/*
* The parameters used by the script.
*/
private List parameters;
/*
* The parameters used by the script.
*/
private List protectedParameters;
/*
* Optional. If set to true, provisioning will complete as soon as script starts and will not wait for script to
* complete.
*/
private Boolean asyncExecution;
/*
* Specifies the user account on the machine when executing the run command.
*/
private String runAsUser;
/*
* Specifies the user account password on the machine when executing the run command.
*/
private String runAsPassword;
/*
* The timeout in seconds to execute the run command.
*/
private Integer timeoutInSeconds;
/*
* 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.
*/
private String outputBlobUri;
/*
* 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.
*/
private String errorBlobUri;
/*
* 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
*/
private RunCommandManagedIdentity outputBlobManagedIdentity;
/*
* 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
*/
private RunCommandManagedIdentity errorBlobManagedIdentity;
/*
* The provisioning state, which only appears in the response.
*/
private String provisioningState;
/*
* The machine run command instance view.
*/
private MachineRunCommandInstanceView instanceView;
/**
* Creates an instance of MachineRunCommandProperties class.
*/
public MachineRunCommandProperties() {
}
/**
* Get the source property: The source of the run command script.
*
* @return the source value.
*/
public MachineRunCommandScriptSource source() {
return this.source;
}
/**
* Set the source property: The source of the run command script.
*
* @param source the source value to set.
* @return the MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withSource(MachineRunCommandScriptSource source) {
this.source = source;
return this;
}
/**
* Get the parameters property: The parameters used by the script.
*
* @return the parameters value.
*/
public List parameters() {
return this.parameters;
}
/**
* Set the parameters property: The parameters used by the script.
*
* @param parameters the parameters value to set.
* @return the MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withParameters(List parameters) {
this.parameters = parameters;
return this;
}
/**
* Get the protectedParameters property: The parameters used by the script.
*
* @return the protectedParameters value.
*/
public List protectedParameters() {
return this.protectedParameters;
}
/**
* Set the protectedParameters property: The parameters used by the script.
*
* @param protectedParameters the protectedParameters value to set.
* @return the MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withProtectedParameters(List protectedParameters) {
this.protectedParameters = 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.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 MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withAsyncExecution(Boolean asyncExecution) {
this.asyncExecution = 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.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 MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withRunAsUser(String runAsUser) {
this.runAsUser = 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.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 MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withRunAsPassword(String runAsPassword) {
this.runAsPassword = 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.timeoutInSeconds;
}
/**
* Set the timeoutInSeconds property: The timeout in seconds to execute the run command.
*
* @param timeoutInSeconds the timeoutInSeconds value to set.
* @return the MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withTimeoutInSeconds(Integer timeoutInSeconds) {
this.timeoutInSeconds = 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.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 MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withOutputBlobUri(String outputBlobUri) {
this.outputBlobUri = 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.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 MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties withErrorBlobUri(String errorBlobUri) {
this.errorBlobUri = 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.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 MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties
withOutputBlobManagedIdentity(RunCommandManagedIdentity outputBlobManagedIdentity) {
this.outputBlobManagedIdentity = 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.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 MachineRunCommandProperties object itself.
*/
public MachineRunCommandProperties
withErrorBlobManagedIdentity(RunCommandManagedIdentity errorBlobManagedIdentity) {
this.errorBlobManagedIdentity = 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.provisioningState;
}
/**
* Get the instanceView property: The machine run command instance view.
*
* @return the instanceView value.
*/
public MachineRunCommandInstanceView instanceView() {
return this.instanceView;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (source() != null) {
source().validate();
}
if (parameters() != null) {
parameters().forEach(e -> e.validate());
}
if (protectedParameters() != null) {
protectedParameters().forEach(e -> e.validate());
}
if (outputBlobManagedIdentity() != null) {
outputBlobManagedIdentity().validate();
}
if (errorBlobManagedIdentity() != null) {
errorBlobManagedIdentity().validate();
}
if (instanceView() != null) {
instanceView().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("source", this.source);
jsonWriter.writeArrayField("parameters", this.parameters, (writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("protectedParameters", this.protectedParameters,
(writer, element) -> writer.writeJson(element));
jsonWriter.writeBooleanField("asyncExecution", this.asyncExecution);
jsonWriter.writeStringField("runAsUser", this.runAsUser);
jsonWriter.writeStringField("runAsPassword", this.runAsPassword);
jsonWriter.writeNumberField("timeoutInSeconds", this.timeoutInSeconds);
jsonWriter.writeStringField("outputBlobUri", this.outputBlobUri);
jsonWriter.writeStringField("errorBlobUri", this.errorBlobUri);
jsonWriter.writeJsonField("outputBlobManagedIdentity", this.outputBlobManagedIdentity);
jsonWriter.writeJsonField("errorBlobManagedIdentity", this.errorBlobManagedIdentity);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MachineRunCommandProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MachineRunCommandProperties if the JsonReader was pointing to an instance of it, or null
* if it was pointing to JSON null.
* @throws IOException If an error occurs while reading the MachineRunCommandProperties.
*/
public static MachineRunCommandProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MachineRunCommandProperties deserializedMachineRunCommandProperties = new MachineRunCommandProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("source".equals(fieldName)) {
deserializedMachineRunCommandProperties.source = MachineRunCommandScriptSource.fromJson(reader);
} else if ("parameters".equals(fieldName)) {
List parameters
= reader.readArray(reader1 -> RunCommandInputParameter.fromJson(reader1));
deserializedMachineRunCommandProperties.parameters = parameters;
} else if ("protectedParameters".equals(fieldName)) {
List protectedParameters
= reader.readArray(reader1 -> RunCommandInputParameter.fromJson(reader1));
deserializedMachineRunCommandProperties.protectedParameters = protectedParameters;
} else if ("asyncExecution".equals(fieldName)) {
deserializedMachineRunCommandProperties.asyncExecution = reader.getNullable(JsonReader::getBoolean);
} else if ("runAsUser".equals(fieldName)) {
deserializedMachineRunCommandProperties.runAsUser = reader.getString();
} else if ("runAsPassword".equals(fieldName)) {
deserializedMachineRunCommandProperties.runAsPassword = reader.getString();
} else if ("timeoutInSeconds".equals(fieldName)) {
deserializedMachineRunCommandProperties.timeoutInSeconds = reader.getNullable(JsonReader::getInt);
} else if ("outputBlobUri".equals(fieldName)) {
deserializedMachineRunCommandProperties.outputBlobUri = reader.getString();
} else if ("errorBlobUri".equals(fieldName)) {
deserializedMachineRunCommandProperties.errorBlobUri = reader.getString();
} else if ("outputBlobManagedIdentity".equals(fieldName)) {
deserializedMachineRunCommandProperties.outputBlobManagedIdentity
= RunCommandManagedIdentity.fromJson(reader);
} else if ("errorBlobManagedIdentity".equals(fieldName)) {
deserializedMachineRunCommandProperties.errorBlobManagedIdentity
= RunCommandManagedIdentity.fromJson(reader);
} else if ("provisioningState".equals(fieldName)) {
deserializedMachineRunCommandProperties.provisioningState = reader.getString();
} else if ("instanceView".equals(fieldName)) {
deserializedMachineRunCommandProperties.instanceView
= MachineRunCommandInstanceView.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedMachineRunCommandProperties;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy