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

com.azure.messaging.eventgrid.systemevents.EventHubCaptureFileCreatedEventData Maven / Gradle / Ivy

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.messaging.eventgrid.systemevents;

import com.azure.core.annotation.Fluent;
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.time.format.DateTimeFormatter;

/**
 * Schema of the Data property of an EventGridEvent for a Microsoft.EventHub.CaptureFileCreated event.
 */
@Fluent
public final class EventHubCaptureFileCreatedEventData
    implements JsonSerializable {
    /*
     * The path to the capture file.
     */
    private String fileurl;

    /*
     * The file type of the capture file.
     */
    private String fileType;

    /*
     * The shard ID.
     */
    private String partitionId;

    /*
     * The file size.
     */
    private Integer sizeInBytes;

    /*
     * The number of events in the file.
     */
    private Integer eventCount;

    /*
     * The smallest sequence number from the queue.
     */
    private Integer firstSequenceNumber;

    /*
     * The last sequence number from the queue.
     */
    private Integer lastSequenceNumber;

    /*
     * The first time from the queue.
     */
    private OffsetDateTime firstEnqueueTime;

    /*
     * The last time from the queue.
     */
    private OffsetDateTime lastEnqueueTime;

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

    /**
     * Get the fileurl property: The path to the capture file.
     * 
     * @return the fileurl value.
     */
    public String getFileurl() {
        return this.fileurl;
    }

    /**
     * Set the fileurl property: The path to the capture file.
     * 
     * @param fileurl the fileurl value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setFileurl(String fileurl) {
        this.fileurl = fileurl;
        return this;
    }

    /**
     * Get the fileType property: The file type of the capture file.
     * 
     * @return the fileType value.
     */
    public String getFileType() {
        return this.fileType;
    }

    /**
     * Set the fileType property: The file type of the capture file.
     * 
     * @param fileType the fileType value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setFileType(String fileType) {
        this.fileType = fileType;
        return this;
    }

    /**
     * Get the partitionId property: The shard ID.
     * 
     * @return the partitionId value.
     */
    public String getPartitionId() {
        return this.partitionId;
    }

    /**
     * Set the partitionId property: The shard ID.
     * 
     * @param partitionId the partitionId value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setPartitionId(String partitionId) {
        this.partitionId = partitionId;
        return this;
    }

    /**
     * Get the sizeInBytes property: The file size.
     * 
     * @return the sizeInBytes value.
     */
    public Integer getSizeInBytes() {
        return this.sizeInBytes;
    }

    /**
     * Set the sizeInBytes property: The file size.
     * 
     * @param sizeInBytes the sizeInBytes value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setSizeInBytes(Integer sizeInBytes) {
        this.sizeInBytes = sizeInBytes;
        return this;
    }

    /**
     * Get the eventCount property: The number of events in the file.
     * 
     * @return the eventCount value.
     */
    public Integer getEventCount() {
        return this.eventCount;
    }

    /**
     * Set the eventCount property: The number of events in the file.
     * 
     * @param eventCount the eventCount value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setEventCount(Integer eventCount) {
        this.eventCount = eventCount;
        return this;
    }

    /**
     * Get the firstSequenceNumber property: The smallest sequence number from the queue.
     * 
     * @return the firstSequenceNumber value.
     */
    public Integer getFirstSequenceNumber() {
        return this.firstSequenceNumber;
    }

    /**
     * Set the firstSequenceNumber property: The smallest sequence number from the queue.
     * 
     * @param firstSequenceNumber the firstSequenceNumber value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setFirstSequenceNumber(Integer firstSequenceNumber) {
        this.firstSequenceNumber = firstSequenceNumber;
        return this;
    }

    /**
     * Get the lastSequenceNumber property: The last sequence number from the queue.
     * 
     * @return the lastSequenceNumber value.
     */
    public Integer getLastSequenceNumber() {
        return this.lastSequenceNumber;
    }

    /**
     * Set the lastSequenceNumber property: The last sequence number from the queue.
     * 
     * @param lastSequenceNumber the lastSequenceNumber value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setLastSequenceNumber(Integer lastSequenceNumber) {
        this.lastSequenceNumber = lastSequenceNumber;
        return this;
    }

    /**
     * Get the firstEnqueueTime property: The first time from the queue.
     * 
     * @return the firstEnqueueTime value.
     */
    public OffsetDateTime getFirstEnqueueTime() {
        return this.firstEnqueueTime;
    }

    /**
     * Set the firstEnqueueTime property: The first time from the queue.
     * 
     * @param firstEnqueueTime the firstEnqueueTime value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setFirstEnqueueTime(OffsetDateTime firstEnqueueTime) {
        this.firstEnqueueTime = firstEnqueueTime;
        return this;
    }

    /**
     * Get the lastEnqueueTime property: The last time from the queue.
     * 
     * @return the lastEnqueueTime value.
     */
    public OffsetDateTime getLastEnqueueTime() {
        return this.lastEnqueueTime;
    }

    /**
     * Set the lastEnqueueTime property: The last time from the queue.
     * 
     * @param lastEnqueueTime the lastEnqueueTime value to set.
     * @return the EventHubCaptureFileCreatedEventData object itself.
     */
    public EventHubCaptureFileCreatedEventData setLastEnqueueTime(OffsetDateTime lastEnqueueTime) {
        this.lastEnqueueTime = lastEnqueueTime;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("fileUrl", this.fileurl);
        jsonWriter.writeStringField("fileType", this.fileType);
        jsonWriter.writeStringField("partitionId", this.partitionId);
        jsonWriter.writeNumberField("sizeInBytes", this.sizeInBytes);
        jsonWriter.writeNumberField("eventCount", this.eventCount);
        jsonWriter.writeNumberField("firstSequenceNumber", this.firstSequenceNumber);
        jsonWriter.writeNumberField("lastSequenceNumber", this.lastSequenceNumber);
        jsonWriter.writeStringField("firstEnqueueTime",
            this.firstEnqueueTime == null
                ? null
                : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.firstEnqueueTime));
        jsonWriter.writeStringField("lastEnqueueTime",
            this.lastEnqueueTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastEnqueueTime));
        return jsonWriter.writeEndObject();
    }

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

                if ("fileUrl".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.fileurl = reader.getString();
                } else if ("fileType".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.fileType = reader.getString();
                } else if ("partitionId".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.partitionId = reader.getString();
                } else if ("sizeInBytes".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.sizeInBytes
                        = reader.getNullable(JsonReader::getInt);
                } else if ("eventCount".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.eventCount = reader.getNullable(JsonReader::getInt);
                } else if ("firstSequenceNumber".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.firstSequenceNumber
                        = reader.getNullable(JsonReader::getInt);
                } else if ("lastSequenceNumber".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.lastSequenceNumber
                        = reader.getNullable(JsonReader::getInt);
                } else if ("firstEnqueueTime".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.firstEnqueueTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("lastEnqueueTime".equals(fieldName)) {
                    deserializedEventHubCaptureFileCreatedEventData.lastEnqueueTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEventHubCaptureFileCreatedEventData;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy