
com.azure.resourcemanager.billing.models.BillingSubscriptionStatusDetails 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.Immutable;
import com.azure.core.util.CoreUtils;
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.time.OffsetDateTime;
/**
* The suspension details for a subscription. This field is not available for Enterprise Agreement billing accounts.
*/
@Immutable
public final class BillingSubscriptionStatusDetails implements JsonSerializable {
/*
* The suspension effective date for a subscription. This field is not available for Enterprise Agreement billing
* accounts.
*/
private OffsetDateTime effectiveDate;
/*
* The suspension reason for a subscription. This field is not available for Enterprise Agreement billing accounts.
*/
private SubscriptionStatusReason reason;
/**
* Creates an instance of BillingSubscriptionStatusDetails class.
*/
public BillingSubscriptionStatusDetails() {
}
/**
* Get the effectiveDate property: The suspension effective date for a subscription. This field is not available for
* Enterprise Agreement billing accounts.
*
* @return the effectiveDate value.
*/
public OffsetDateTime effectiveDate() {
return this.effectiveDate;
}
/**
* Get the reason property: The suspension reason for a subscription. This field is not available for Enterprise
* Agreement billing accounts.
*
* @return the reason value.
*/
public SubscriptionStatusReason reason() {
return this.reason;
}
/**
* 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();
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of BillingSubscriptionStatusDetails from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of BillingSubscriptionStatusDetails 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 BillingSubscriptionStatusDetails.
*/
public static BillingSubscriptionStatusDetails fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
BillingSubscriptionStatusDetails deserializedBillingSubscriptionStatusDetails
= new BillingSubscriptionStatusDetails();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("effectiveDate".equals(fieldName)) {
deserializedBillingSubscriptionStatusDetails.effectiveDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("reason".equals(fieldName)) {
deserializedBillingSubscriptionStatusDetails.reason
= SubscriptionStatusReason.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedBillingSubscriptionStatusDetails;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy