
com.azure.resourcemanager.billing.models.MoveProductRequest 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.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The properties of the product to initiate a transfer.
*/
@Fluent
public final class MoveProductRequest implements JsonSerializable {
/*
* The destination invoice section id.
*/
private String destinationInvoiceSectionId;
/**
* Creates an instance of MoveProductRequest class.
*/
public MoveProductRequest() {
}
/**
* Get the destinationInvoiceSectionId property: The destination invoice section id.
*
* @return the destinationInvoiceSectionId value.
*/
public String destinationInvoiceSectionId() {
return this.destinationInvoiceSectionId;
}
/**
* Set the destinationInvoiceSectionId property: The destination invoice section id.
*
* @param destinationInvoiceSectionId the destinationInvoiceSectionId value to set.
* @return the MoveProductRequest object itself.
*/
public MoveProductRequest withDestinationInvoiceSectionId(String destinationInvoiceSectionId) {
this.destinationInvoiceSectionId = destinationInvoiceSectionId;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (destinationInvoiceSectionId() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property destinationInvoiceSectionId in model MoveProductRequest"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(MoveProductRequest.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("destinationInvoiceSectionId", this.destinationInvoiceSectionId);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MoveProductRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MoveProductRequest 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 MoveProductRequest.
*/
public static MoveProductRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MoveProductRequest deserializedMoveProductRequest = new MoveProductRequest();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("destinationInvoiceSectionId".equals(fieldName)) {
deserializedMoveProductRequest.destinationInvoiceSectionId = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedMoveProductRequest;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy