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

com.azure.resourcemanager.azurestackhci.models.LogCollectionSession Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. Package tag package-2024-04.

The 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.azurestackhci.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;

/**
 * Log Collection Session details of the cluster.
 */
@Immutable
public final class LogCollectionSession implements JsonSerializable {
    /*
     * Start Time of the logs when it was collected
     */
    private OffsetDateTime logStartTime;

    /*
     * End Time of the logs when it was collected
     */
    private OffsetDateTime logEndTime;

    /*
     * Duration of logs collected
     */
    private OffsetDateTime timeCollected;

    /*
     * Size of the logs collected
     */
    private Long logSize;

    /*
     * LogCollection status
     */
    private LogCollectionStatus logCollectionStatus;

    /*
     * LogCollection job type
     */
    private LogCollectionJobType logCollectionJobType;

    /*
     * CorrelationId of the log collection
     */
    private String correlationId;

    /*
     * End Time of the logs when it was collected
     */
    private OffsetDateTime endTimeCollected;

    /*
     * Log Collection Error details of the cluster.
     */
    private LogCollectionError logCollectionError;

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

    /**
     * Get the logStartTime property: Start Time of the logs when it was collected.
     * 
     * @return the logStartTime value.
     */
    public OffsetDateTime logStartTime() {
        return this.logStartTime;
    }

    /**
     * Get the logEndTime property: End Time of the logs when it was collected.
     * 
     * @return the logEndTime value.
     */
    public OffsetDateTime logEndTime() {
        return this.logEndTime;
    }

    /**
     * Get the timeCollected property: Duration of logs collected.
     * 
     * @return the timeCollected value.
     */
    public OffsetDateTime timeCollected() {
        return this.timeCollected;
    }

    /**
     * Get the logSize property: Size of the logs collected.
     * 
     * @return the logSize value.
     */
    public Long logSize() {
        return this.logSize;
    }

    /**
     * Get the logCollectionStatus property: LogCollection status.
     * 
     * @return the logCollectionStatus value.
     */
    public LogCollectionStatus logCollectionStatus() {
        return this.logCollectionStatus;
    }

    /**
     * Get the logCollectionJobType property: LogCollection job type.
     * 
     * @return the logCollectionJobType value.
     */
    public LogCollectionJobType logCollectionJobType() {
        return this.logCollectionJobType;
    }

    /**
     * Get the correlationId property: CorrelationId of the log collection.
     * 
     * @return the correlationId value.
     */
    public String correlationId() {
        return this.correlationId;
    }

    /**
     * Get the endTimeCollected property: End Time of the logs when it was collected.
     * 
     * @return the endTimeCollected value.
     */
    public OffsetDateTime endTimeCollected() {
        return this.endTimeCollected;
    }

    /**
     * Get the logCollectionError property: Log Collection Error details of the cluster.
     * 
     * @return the logCollectionError value.
     */
    public LogCollectionError logCollectionError() {
        return this.logCollectionError;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (logCollectionError() != null) {
            logCollectionError().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

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

                if ("logStartTime".equals(fieldName)) {
                    deserializedLogCollectionSession.logStartTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("logEndTime".equals(fieldName)) {
                    deserializedLogCollectionSession.logEndTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("timeCollected".equals(fieldName)) {
                    deserializedLogCollectionSession.timeCollected = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("logSize".equals(fieldName)) {
                    deserializedLogCollectionSession.logSize = reader.getNullable(JsonReader::getLong);
                } else if ("logCollectionStatus".equals(fieldName)) {
                    deserializedLogCollectionSession.logCollectionStatus
                        = LogCollectionStatus.fromString(reader.getString());
                } else if ("logCollectionJobType".equals(fieldName)) {
                    deserializedLogCollectionSession.logCollectionJobType
                        = LogCollectionJobType.fromString(reader.getString());
                } else if ("correlationId".equals(fieldName)) {
                    deserializedLogCollectionSession.correlationId = reader.getString();
                } else if ("endTimeCollected".equals(fieldName)) {
                    deserializedLogCollectionSession.endTimeCollected = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("logCollectionError".equals(fieldName)) {
                    deserializedLogCollectionSession.logCollectionError = LogCollectionError.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedLogCollectionSession;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy