
com.azure.resourcemanager.datafactory.models.AzPowerShellSetup 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.datafactory.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.datafactory.fluent.models.AzPowerShellSetupTypeProperties;
import java.io.IOException;
/**
* The express custom setup of installing Azure PowerShell.
*/
@Fluent
public final class AzPowerShellSetup extends CustomSetupBase {
/*
* The type of custom setup.
*/
private String type = "AzPowerShellSetup";
/*
* Install Azure PowerShell type properties.
*/
private AzPowerShellSetupTypeProperties innerTypeProperties = new AzPowerShellSetupTypeProperties();
/**
* Creates an instance of AzPowerShellSetup class.
*/
public AzPowerShellSetup() {
}
/**
* Get the type property: The type of custom setup.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the innerTypeProperties property: Install Azure PowerShell type properties.
*
* @return the innerTypeProperties value.
*/
private AzPowerShellSetupTypeProperties innerTypeProperties() {
return this.innerTypeProperties;
}
/**
* Get the version property: The required version of Azure PowerShell to install.
*
* @return the version value.
*/
public String version() {
return this.innerTypeProperties() == null ? null : this.innerTypeProperties().version();
}
/**
* Set the version property: The required version of Azure PowerShell to install.
*
* @param version the version value to set.
* @return the AzPowerShellSetup object itself.
*/
public AzPowerShellSetup withVersion(String version) {
if (this.innerTypeProperties() == null) {
this.innerTypeProperties = new AzPowerShellSetupTypeProperties();
}
this.innerTypeProperties().withVersion(version);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (innerTypeProperties() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property innerTypeProperties in model AzPowerShellSetup"));
} else {
innerTypeProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(AzPowerShellSetup.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("typeProperties", this.innerTypeProperties);
jsonWriter.writeStringField("type", this.type);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AzPowerShellSetup from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AzPowerShellSetup 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 AzPowerShellSetup.
*/
public static AzPowerShellSetup fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AzPowerShellSetup deserializedAzPowerShellSetup = new AzPowerShellSetup();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("typeProperties".equals(fieldName)) {
deserializedAzPowerShellSetup.innerTypeProperties
= AzPowerShellSetupTypeProperties.fromJson(reader);
} else if ("type".equals(fieldName)) {
deserializedAzPowerShellSetup.type = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedAzPowerShellSetup;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy