All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.billing.fluent.models.MoveBillingSubscriptionEligibilityResultInner 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.fluent.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.models.MoveBillingSubscriptionErrorDetails;
import java.io.IOException;

/**
 * Result of the transfer eligibility validation.
 */
@Fluent
public final class MoveBillingSubscriptionEligibilityResultInner
    implements JsonSerializable {
    /*
     * Specifies whether the subscription is eligible to be transferred.
     */
    private Boolean isMoveEligible;

    /*
     * Error details of the transfer eligibility validation.
     */
    private MoveBillingSubscriptionErrorDetails errorDetails;

    /**
     * Creates an instance of MoveBillingSubscriptionEligibilityResultInner class.
     */
    public MoveBillingSubscriptionEligibilityResultInner() {
    }

    /**
     * Get the isMoveEligible property: Specifies whether the subscription is eligible to be transferred.
     * 
     * @return the isMoveEligible value.
     */
    public Boolean isMoveEligible() {
        return this.isMoveEligible;
    }

    /**
     * Get the errorDetails property: Error details of the transfer eligibility validation.
     * 
     * @return the errorDetails value.
     */
    public MoveBillingSubscriptionErrorDetails errorDetails() {
        return this.errorDetails;
    }

    /**
     * Set the errorDetails property: Error details of the transfer eligibility validation.
     * 
     * @param errorDetails the errorDetails value to set.
     * @return the MoveBillingSubscriptionEligibilityResultInner object itself.
     */
    public MoveBillingSubscriptionEligibilityResultInner
        withErrorDetails(MoveBillingSubscriptionErrorDetails 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 MoveBillingSubscriptionEligibilityResultInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of MoveBillingSubscriptionEligibilityResultInner 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 MoveBillingSubscriptionEligibilityResultInner.
     */
    public static MoveBillingSubscriptionEligibilityResultInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            MoveBillingSubscriptionEligibilityResultInner deserializedMoveBillingSubscriptionEligibilityResultInner
                = new MoveBillingSubscriptionEligibilityResultInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("isMoveEligible".equals(fieldName)) {
                    deserializedMoveBillingSubscriptionEligibilityResultInner.isMoveEligible
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("errorDetails".equals(fieldName)) {
                    deserializedMoveBillingSubscriptionEligibilityResultInner.errorDetails
                        = MoveBillingSubscriptionErrorDetails.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMoveBillingSubscriptionEligibilityResultInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy