
com.azure.resourcemanager.billing.models.DetailedTransferStatus 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;
/**
* Detailed transfer status.
*/
@Fluent
public final class DetailedTransferStatus implements JsonSerializable {
/*
* Type of product that is transferred.
*/
private ProductType productType;
/*
* The ID of the product that is transferred.
*/
private String productId;
/*
* The name of the product that is transferred.
*/
private String productName;
/*
* The SKU of the product that is transferred.
*/
private String skuDescription;
/*
* Transfer status.
*/
private ProductTransferStatus transferStatus;
/*
* Error details for transfer execution.
*/
private TransferError errorDetails;
/**
* Creates an instance of DetailedTransferStatus class.
*/
public DetailedTransferStatus() {
}
/**
* Get the productType property: Type of product that is transferred.
*
* @return the productType value.
*/
public ProductType productType() {
return this.productType;
}
/**
* Get the productId property: The ID of the product that is transferred.
*
* @return the productId value.
*/
public String productId() {
return this.productId;
}
/**
* Get the productName property: The name of the product that is transferred.
*
* @return the productName value.
*/
public String productName() {
return this.productName;
}
/**
* Get the skuDescription property: The SKU of the product that is transferred.
*
* @return the skuDescription value.
*/
public String skuDescription() {
return this.skuDescription;
}
/**
* Get the transferStatus property: Transfer status.
*
* @return the transferStatus value.
*/
public ProductTransferStatus transferStatus() {
return this.transferStatus;
}
/**
* Get the errorDetails property: Error details for transfer execution.
*
* @return the errorDetails value.
*/
public TransferError errorDetails() {
return this.errorDetails;
}
/**
* Set the errorDetails property: Error details for transfer execution.
*
* @param errorDetails the errorDetails value to set.
* @return the DetailedTransferStatus object itself.
*/
public DetailedTransferStatus withErrorDetails(TransferError errorDetails) {
this.errorDetails = errorDetails;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (errorDetails() != null) {
errorDetails().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("errorDetails", this.errorDetails);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DetailedTransferStatus from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DetailedTransferStatus 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 DetailedTransferStatus.
*/
public static DetailedTransferStatus fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DetailedTransferStatus deserializedDetailedTransferStatus = new DetailedTransferStatus();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("productType".equals(fieldName)) {
deserializedDetailedTransferStatus.productType = ProductType.fromString(reader.getString());
} else if ("productId".equals(fieldName)) {
deserializedDetailedTransferStatus.productId = reader.getString();
} else if ("productName".equals(fieldName)) {
deserializedDetailedTransferStatus.productName = reader.getString();
} else if ("skuDescription".equals(fieldName)) {
deserializedDetailedTransferStatus.skuDescription = reader.getString();
} else if ("transferStatus".equals(fieldName)) {
deserializedDetailedTransferStatus.transferStatus
= ProductTransferStatus.fromString(reader.getString());
} else if ("errorDetails".equals(fieldName)) {
deserializedDetailedTransferStatus.errorDetails = TransferError.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedDetailedTransferStatus;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy