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

com.azure.resourcemanager.redis.fluent.models.UpgradeNotificationInner Maven / Gradle / Ivy

There is a newer version: 2.44.0
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.redis.fluent.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;
import java.util.Map;

/**
 * Properties of upgrade notification.
 */
@Immutable
public final class UpgradeNotificationInner implements JsonSerializable {
    /*
     * Name of upgrade notification.
     */
    private String name;

    /*
     * Timestamp when upgrade notification occurred.
     */
    private OffsetDateTime timestamp;

    /*
     * Details about this upgrade notification
     */
    private Map upsellNotification;

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

    /**
     * Get the name property: Name of upgrade notification.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the timestamp property: Timestamp when upgrade notification occurred.
     * 
     * @return the timestamp value.
     */
    public OffsetDateTime timestamp() {
        return this.timestamp;
    }

    /**
     * Get the upsellNotification property: Details about this upgrade notification.
     * 
     * @return the upsellNotification value.
     */
    public Map upsellNotification() {
        return this.upsellNotification;
    }

    /**
     * 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 UpgradeNotificationInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of UpgradeNotificationInner 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 UpgradeNotificationInner.
     */
    public static UpgradeNotificationInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            UpgradeNotificationInner deserializedUpgradeNotificationInner = new UpgradeNotificationInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("name".equals(fieldName)) {
                    deserializedUpgradeNotificationInner.name = reader.getString();
                } else if ("timestamp".equals(fieldName)) {
                    deserializedUpgradeNotificationInner.timestamp = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("upsellNotification".equals(fieldName)) {
                    Map upsellNotification = reader.readMap(reader1 -> reader1.getString());
                    deserializedUpgradeNotificationInner.upsellNotification = upsellNotification;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedUpgradeNotificationInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy