
com.azure.resourcemanager.billing.models.ExtendedStatusInfo 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.billing.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.billing.fluent.models.ExtendedStatusInfoProperties;
import java.io.IOException;
/**
* Extended status information.
*/
@Fluent
public final class ExtendedStatusInfo implements JsonSerializable {
/*
* Status code providing additional information.
*/
private String statusCode;
/*
* The message giving detailed information about the status code.
*/
private String message;
/*
* Properties specific to credit line check failure
*/
private ExtendedStatusInfoProperties innerProperties;
/**
* Creates an instance of ExtendedStatusInfo class.
*/
public ExtendedStatusInfo() {
}
/**
* Get the statusCode property: Status code providing additional information.
*
* @return the statusCode value.
*/
public String statusCode() {
return this.statusCode;
}
/**
* Set the statusCode property: Status code providing additional information.
*
* @param statusCode the statusCode value to set.
* @return the ExtendedStatusInfo object itself.
*/
public ExtendedStatusInfo withStatusCode(String statusCode) {
this.statusCode = statusCode;
return this;
}
/**
* Get the message property: The message giving detailed information about the status code.
*
* @return the message value.
*/
public String message() {
return this.message;
}
/**
* Set the message property: The message giving detailed information about the status code.
*
* @param message the message value to set.
* @return the ExtendedStatusInfo object itself.
*/
public ExtendedStatusInfo withMessage(String message) {
this.message = message;
return this;
}
/**
* Get the innerProperties property: Properties specific to credit line check failure.
*
* @return the innerProperties value.
*/
private ExtendedStatusInfoProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the subscriptionId property: The subscription that has failed credit line check.
*
* @return the subscriptionId value.
*/
public String subscriptionId() {
return this.innerProperties() == null ? null : this.innerProperties().subscriptionId();
}
/**
* Set the subscriptionId property: The subscription that has failed credit line check.
*
* @param subscriptionId the subscriptionId value to set.
* @return the ExtendedStatusInfo object itself.
*/
public ExtendedStatusInfo withSubscriptionId(String subscriptionId) {
if (this.innerProperties() == null) {
this.innerProperties = new ExtendedStatusInfoProperties();
}
this.innerProperties().withSubscriptionId(subscriptionId);
return this;
}
/**
* 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("statusCode", this.statusCode);
jsonWriter.writeStringField("message", this.message);
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ExtendedStatusInfo from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ExtendedStatusInfo 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 ExtendedStatusInfo.
*/
public static ExtendedStatusInfo fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ExtendedStatusInfo deserializedExtendedStatusInfo = new ExtendedStatusInfo();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("statusCode".equals(fieldName)) {
deserializedExtendedStatusInfo.statusCode = reader.getString();
} else if ("message".equals(fieldName)) {
deserializedExtendedStatusInfo.message = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedExtendedStatusInfo.innerProperties = ExtendedStatusInfoProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedExtendedStatusInfo;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy