
com.azure.resourcemanager.billing.models.SystemOverrides 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;
/**
* System imposed policies that regulate behavior of the subscription.
*/
@Immutable
public final class SystemOverrides implements JsonSerializable {
/*
* The policy override for the subscription indicates whether the self-serve cancellation or seat reduction is
* allowed.
*/
private Cancellation cancellation;
/*
* The end date in UTC time by when the self-serve cancellation ends.
*/
private OffsetDateTime cancellationAllowedEndDate;
/**
* Creates an instance of SystemOverrides class.
*/
public SystemOverrides() {
}
/**
* Get the cancellation property: The policy override for the subscription indicates whether the self-serve
* cancellation or seat reduction is allowed.
*
* @return the cancellation value.
*/
public Cancellation cancellation() {
return this.cancellation;
}
/**
* Get the cancellationAllowedEndDate property: The end date in UTC time by when the self-serve cancellation ends.
*
* @return the cancellationAllowedEndDate value.
*/
public OffsetDateTime cancellationAllowedEndDate() {
return this.cancellationAllowedEndDate;
}
/**
* 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 SystemOverrides from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SystemOverrides 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 SystemOverrides.
*/
public static SystemOverrides fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SystemOverrides deserializedSystemOverrides = new SystemOverrides();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("cancellation".equals(fieldName)) {
deserializedSystemOverrides.cancellation = Cancellation.fromString(reader.getString());
} else if ("cancellationAllowedEndDate".equals(fieldName)) {
deserializedSystemOverrides.cancellationAllowedEndDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else {
reader.skipChildren();
}
}
return deserializedSystemOverrides;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy