
com.azure.resourcemanager.billing.models.ReservationMergeProperties 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;
import java.util.List;
/**
* Properties of reservation merge.
*/
@Fluent
public final class ReservationMergeProperties implements JsonSerializable {
/*
* Reservation resource id Created due to the merge. Format of the resource id is
* /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}
*/
private String mergeDestination;
/*
* Resource ids of the source reservation's merged to form this reservation. Format of the resource id is
* /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}
*/
private List mergeSources;
/**
* Creates an instance of ReservationMergeProperties class.
*/
public ReservationMergeProperties() {
}
/**
* Get the mergeDestination property: Reservation resource id Created due to the merge. Format of the resource id is
* /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}.
*
* @return the mergeDestination value.
*/
public String mergeDestination() {
return this.mergeDestination;
}
/**
* Set the mergeDestination property: Reservation resource id Created due to the merge. Format of the resource id is
* /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}.
*
* @param mergeDestination the mergeDestination value to set.
* @return the ReservationMergeProperties object itself.
*/
public ReservationMergeProperties withMergeDestination(String mergeDestination) {
this.mergeDestination = mergeDestination;
return this;
}
/**
* Get the mergeSources property: Resource ids of the source reservation's merged to form this reservation. Format
* of the resource id is
* /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}.
*
* @return the mergeSources value.
*/
public List mergeSources() {
return this.mergeSources;
}
/**
* Set the mergeSources property: Resource ids of the source reservation's merged to form this reservation. Format
* of the resource id is
* /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}.
*
* @param mergeSources the mergeSources value to set.
* @return the ReservationMergeProperties object itself.
*/
public ReservationMergeProperties withMergeSources(List mergeSources) {
this.mergeSources = mergeSources;
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("mergeDestination", this.mergeDestination);
jsonWriter.writeArrayField("mergeSources", this.mergeSources, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ReservationMergeProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ReservationMergeProperties 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 ReservationMergeProperties.
*/
public static ReservationMergeProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ReservationMergeProperties deserializedReservationMergeProperties = new ReservationMergeProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("mergeDestination".equals(fieldName)) {
deserializedReservationMergeProperties.mergeDestination = reader.getString();
} else if ("mergeSources".equals(fieldName)) {
List mergeSources = reader.readArray(reader1 -> reader1.getString());
deserializedReservationMergeProperties.mergeSources = mergeSources;
} else {
reader.skipChildren();
}
}
return deserializedReservationMergeProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy