
com.azure.resourcemanager.billing.models.MoveBillingSubscriptionErrorDetails 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 java.io.IOException;
/**
* Error details of the transfer eligibility validation.
*/
@Fluent
public final class MoveBillingSubscriptionErrorDetails
implements JsonSerializable {
/*
* Error code of the transfer validation response.
*/
private SubscriptionTransferValidationErrorCode code;
/*
* The error message.
*/
private String message;
/*
* Detailed error message explaining the error.
*/
private String details;
/**
* Creates an instance of MoveBillingSubscriptionErrorDetails class.
*/
public MoveBillingSubscriptionErrorDetails() {
}
/**
* Get the code property: Error code of the transfer validation response.
*
* @return the code value.
*/
public SubscriptionTransferValidationErrorCode code() {
return this.code;
}
/**
* Set the code property: Error code of the transfer validation response.
*
* @param code the code value to set.
* @return the MoveBillingSubscriptionErrorDetails object itself.
*/
public MoveBillingSubscriptionErrorDetails withCode(SubscriptionTransferValidationErrorCode code) {
this.code = code;
return this;
}
/**
* Get the message property: The error message.
*
* @return the message value.
*/
public String message() {
return this.message;
}
/**
* Set the message property: The error message.
*
* @param message the message value to set.
* @return the MoveBillingSubscriptionErrorDetails object itself.
*/
public MoveBillingSubscriptionErrorDetails withMessage(String message) {
this.message = message;
return this;
}
/**
* Get the details property: Detailed error message explaining the error.
*
* @return the details value.
*/
public String details() {
return this.details;
}
/**
* Set the details property: Detailed error message explaining the error.
*
* @param details the details value to set.
* @return the MoveBillingSubscriptionErrorDetails object itself.
*/
public MoveBillingSubscriptionErrorDetails withDetails(String details) {
this.details = details;
return this;
}
/**
* 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();
jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString());
jsonWriter.writeStringField("message", this.message);
jsonWriter.writeStringField("details", this.details);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MoveBillingSubscriptionErrorDetails from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MoveBillingSubscriptionErrorDetails 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 MoveBillingSubscriptionErrorDetails.
*/
public static MoveBillingSubscriptionErrorDetails fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MoveBillingSubscriptionErrorDetails deserializedMoveBillingSubscriptionErrorDetails
= new MoveBillingSubscriptionErrorDetails();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("code".equals(fieldName)) {
deserializedMoveBillingSubscriptionErrorDetails.code
= SubscriptionTransferValidationErrorCode.fromString(reader.getString());
} else if ("message".equals(fieldName)) {
deserializedMoveBillingSubscriptionErrorDetails.message = reader.getString();
} else if ("details".equals(fieldName)) {
deserializedMoveBillingSubscriptionErrorDetails.details = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedMoveBillingSubscriptionErrorDetails;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy