com.azure.resourcemanager.avs.fluent.models.TrialInner 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.fluent.models;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.avs.models.TrialStatus;
import java.io.IOException;
/**
* Subscription trial availability.
*/
@Immutable
public final class TrialInner implements JsonSerializable {
/*
* Trial status
*/
private TrialStatus status;
/*
* Number of trial hosts available
*/
private Integer availableHosts;
/**
* Creates an instance of TrialInner class.
*/
public TrialInner() {
}
/**
* Get the status property: Trial status.
*
* @return the status value.
*/
public TrialStatus status() {
return this.status;
}
/**
* Get the availableHosts property: Number of trial hosts available.
*
* @return the availableHosts value.
*/
public Integer availableHosts() {
return this.availableHosts;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of TrialInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of TrialInner 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 TrialInner.
*/
public static TrialInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
TrialInner deserializedTrialInner = new TrialInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("status".equals(fieldName)) {
deserializedTrialInner.status = TrialStatus.fromString(reader.getString());
} else if ("availableHosts".equals(fieldName)) {
deserializedTrialInner.availableHosts = reader.getNullable(JsonReader::getInt);
} else {
reader.skipChildren();
}
}
return deserializedTrialInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy