com.azure.messaging.eventgrid.systemevents.SignalRServiceClientConnectionDisconnectedEventData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-messaging-eventgrid Show documentation
Show all versions of azure-messaging-eventgrid Show documentation
This package contains Microsoft Azure EventGrid SDK.
// 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.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.SignalRService.ClientConnectionDisconnected event.
*/
@Fluent
public final class SignalRServiceClientConnectionDisconnectedEventData
implements JsonSerializable {
/*
* The time at which the event occurred.
*/
private OffsetDateTime timestamp;
/*
* The hub of connected client connection.
*/
private String hubName;
/*
* The connection Id of connected client connection.
*/
private String connectionId;
/*
* The user Id of connected client connection.
*/
private String userId;
/*
* The message of error that cause the client connection disconnected.
*/
private String errorMessage;
/**
* Creates an instance of SignalRServiceClientConnectionDisconnectedEventData class.
*/
public SignalRServiceClientConnectionDisconnectedEventData() {
}
/**
* Get the timestamp property: The time at which the event occurred.
*
* @return the timestamp value.
*/
public OffsetDateTime getTimestamp() {
return this.timestamp;
}
/**
* Set the timestamp property: The time at which the event occurred.
*
* @param timestamp the timestamp value to set.
* @return the SignalRServiceClientConnectionDisconnectedEventData object itself.
*/
public SignalRServiceClientConnectionDisconnectedEventData setTimestamp(OffsetDateTime timestamp) {
this.timestamp = timestamp;
return this;
}
/**
* Get the hubName property: The hub of connected client connection.
*
* @return the hubName value.
*/
public String getHubName() {
return this.hubName;
}
/**
* Set the hubName property: The hub of connected client connection.
*
* @param hubName the hubName value to set.
* @return the SignalRServiceClientConnectionDisconnectedEventData object itself.
*/
public SignalRServiceClientConnectionDisconnectedEventData setHubName(String hubName) {
this.hubName = hubName;
return this;
}
/**
* Get the connectionId property: The connection Id of connected client connection.
*
* @return the connectionId value.
*/
public String getConnectionId() {
return this.connectionId;
}
/**
* Set the connectionId property: The connection Id of connected client connection.
*
* @param connectionId the connectionId value to set.
* @return the SignalRServiceClientConnectionDisconnectedEventData object itself.
*/
public SignalRServiceClientConnectionDisconnectedEventData setConnectionId(String connectionId) {
this.connectionId = connectionId;
return this;
}
/**
* Get the userId property: The user Id of connected client connection.
*
* @return the userId value.
*/
public String getUserId() {
return this.userId;
}
/**
* Set the userId property: The user Id of connected client connection.
*
* @param userId the userId value to set.
* @return the SignalRServiceClientConnectionDisconnectedEventData object itself.
*/
public SignalRServiceClientConnectionDisconnectedEventData setUserId(String userId) {
this.userId = userId;
return this;
}
/**
* Get the errorMessage property: The message of error that cause the client connection disconnected.
*
* @return the errorMessage value.
*/
public String getErrorMessage() {
return this.errorMessage;
}
/**
* Set the errorMessage property: The message of error that cause the client connection disconnected.
*
* @param errorMessage the errorMessage value to set.
* @return the SignalRServiceClientConnectionDisconnectedEventData object itself.
*/
public SignalRServiceClientConnectionDisconnectedEventData setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
return this;
}
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("timestamp",
this.timestamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timestamp));
jsonWriter.writeStringField("hubName", this.hubName);
jsonWriter.writeStringField("connectionId", this.connectionId);
jsonWriter.writeStringField("userId", this.userId);
jsonWriter.writeStringField("errorMessage", this.errorMessage);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SignalRServiceClientConnectionDisconnectedEventData from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SignalRServiceClientConnectionDisconnectedEventData 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 SignalRServiceClientConnectionDisconnectedEventData.
*/
public static SignalRServiceClientConnectionDisconnectedEventData fromJson(JsonReader jsonReader)
throws IOException {
return jsonReader.readObject(reader -> {
SignalRServiceClientConnectionDisconnectedEventData deserializedSignalRServiceClientConnectionDisconnectedEventData
= new SignalRServiceClientConnectionDisconnectedEventData();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("timestamp".equals(fieldName)) {
deserializedSignalRServiceClientConnectionDisconnectedEventData.timestamp
= reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString()));
} else if ("hubName".equals(fieldName)) {
deserializedSignalRServiceClientConnectionDisconnectedEventData.hubName = reader.getString();
} else if ("connectionId".equals(fieldName)) {
deserializedSignalRServiceClientConnectionDisconnectedEventData.connectionId = reader.getString();
} else if ("userId".equals(fieldName)) {
deserializedSignalRServiceClientConnectionDisconnectedEventData.userId = reader.getString();
} else if ("errorMessage".equals(fieldName)) {
deserializedSignalRServiceClientConnectionDisconnectedEventData.errorMessage = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedSignalRServiceClientConnectionDisconnectedEventData;
});
}
}