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

com.azure.resourcemanager.recoveryservices.models.UpgradeDetails 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.recoveryservices.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;

/**
 * Details for upgrading vault.
 */
@Immutable
public final class UpgradeDetails implements JsonSerializable {
    /*
     * ID of the vault upgrade operation.
     */
    private String operationId;

    /*
     * UTC time at which the upgrade operation has started.
     */
    private OffsetDateTime startTimeUtc;

    /*
     * UTC time at which the upgrade operation status was last updated.
     */
    private OffsetDateTime lastUpdatedTimeUtc;

    /*
     * UTC time at which the upgrade operation has ended.
     */
    private OffsetDateTime endTimeUtc;

    /*
     * Status of the vault upgrade operation.
     */
    private VaultUpgradeState status;

    /*
     * Message to the user containing information about the upgrade operation.
     */
    private String message;

    /*
     * The way the vault upgrade was triggered.
     */
    private TriggerType triggerType;

    /*
     * Resource ID of the upgraded vault.
     */
    private String upgradedResourceId;

    /*
     * Resource ID of the vault before the upgrade.
     */
    private String previousResourceId;

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

    /**
     * Get the operationId property: ID of the vault upgrade operation.
     * 
     * @return the operationId value.
     */
    public String operationId() {
        return this.operationId;
    }

    /**
     * Get the startTimeUtc property: UTC time at which the upgrade operation has started.
     * 
     * @return the startTimeUtc value.
     */
    public OffsetDateTime startTimeUtc() {
        return this.startTimeUtc;
    }

    /**
     * Get the lastUpdatedTimeUtc property: UTC time at which the upgrade operation status was last updated.
     * 
     * @return the lastUpdatedTimeUtc value.
     */
    public OffsetDateTime lastUpdatedTimeUtc() {
        return this.lastUpdatedTimeUtc;
    }

    /**
     * Get the endTimeUtc property: UTC time at which the upgrade operation has ended.
     * 
     * @return the endTimeUtc value.
     */
    public OffsetDateTime endTimeUtc() {
        return this.endTimeUtc;
    }

    /**
     * Get the status property: Status of the vault upgrade operation.
     * 
     * @return the status value.
     */
    public VaultUpgradeState status() {
        return this.status;
    }

    /**
     * Get the message property: Message to the user containing information about the upgrade operation.
     * 
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Get the triggerType property: The way the vault upgrade was triggered.
     * 
     * @return the triggerType value.
     */
    public TriggerType triggerType() {
        return this.triggerType;
    }

    /**
     * Get the upgradedResourceId property: Resource ID of the upgraded vault.
     * 
     * @return the upgradedResourceId value.
     */
    public String upgradedResourceId() {
        return this.upgradedResourceId;
    }

    /**
     * Get the previousResourceId property: Resource ID of the vault before the upgrade.
     * 
     * @return the previousResourceId value.
     */
    public String previousResourceId() {
        return this.previousResourceId;
    }

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

                if ("operationId".equals(fieldName)) {
                    deserializedUpgradeDetails.operationId = reader.getString();
                } else if ("startTimeUtc".equals(fieldName)) {
                    deserializedUpgradeDetails.startTimeUtc = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("lastUpdatedTimeUtc".equals(fieldName)) {
                    deserializedUpgradeDetails.lastUpdatedTimeUtc = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("endTimeUtc".equals(fieldName)) {
                    deserializedUpgradeDetails.endTimeUtc = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("status".equals(fieldName)) {
                    deserializedUpgradeDetails.status = VaultUpgradeState.fromString(reader.getString());
                } else if ("message".equals(fieldName)) {
                    deserializedUpgradeDetails.message = reader.getString();
                } else if ("triggerType".equals(fieldName)) {
                    deserializedUpgradeDetails.triggerType = TriggerType.fromString(reader.getString());
                } else if ("upgradedResourceId".equals(fieldName)) {
                    deserializedUpgradeDetails.upgradedResourceId = reader.getString();
                } else if ("previousResourceId".equals(fieldName)) {
                    deserializedUpgradeDetails.previousResourceId = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedUpgradeDetails;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy