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

com.azure.messaging.eventgrid.systemevents.StorageTaskAssignmentQueuedEventData 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 an Microsoft.Storage.StorageTaskAssignmentQueued event.
 */
@Fluent
public final class StorageTaskAssignmentQueuedEventData
    implements JsonSerializable {
    /*
     * The time at which a storage task was queued.
     */
    private OffsetDateTime queuedOn;

    /*
     * The execution id for a storage task.
     */
    private String taskExecutionId;

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

    /**
     * Get the queuedOn property: The time at which a storage task was queued.
     * 
     * @return the queuedOn value.
     */
    public OffsetDateTime getQueuedOn() {
        return this.queuedOn;
    }

    /**
     * Set the queuedOn property: The time at which a storage task was queued.
     * 
     * @param queuedOn the queuedOn value to set.
     * @return the StorageTaskAssignmentQueuedEventData object itself.
     */
    public StorageTaskAssignmentQueuedEventData setQueuedOn(OffsetDateTime queuedOn) {
        this.queuedOn = queuedOn;
        return this;
    }

    /**
     * Get the taskExecutionId property: The execution id for a storage task.
     * 
     * @return the taskExecutionId value.
     */
    public String getTaskExecutionId() {
        return this.taskExecutionId;
    }

    /**
     * Set the taskExecutionId property: The execution id for a storage task.
     * 
     * @param taskExecutionId the taskExecutionId value to set.
     * @return the StorageTaskAssignmentQueuedEventData object itself.
     */
    public StorageTaskAssignmentQueuedEventData setTaskExecutionId(String taskExecutionId) {
        this.taskExecutionId = taskExecutionId;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("queuedDateTime",
            this.queuedOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.queuedOn));
        jsonWriter.writeStringField("taskExecutionId", this.taskExecutionId);
        return jsonWriter.writeEndObject();
    }

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

                if ("queuedDateTime".equals(fieldName)) {
                    deserializedStorageTaskAssignmentQueuedEventData.queuedOn = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("taskExecutionId".equals(fieldName)) {
                    deserializedStorageTaskAssignmentQueuedEventData.taskExecutionId = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedStorageTaskAssignmentQueuedEventData;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy