com.azure.resourcemanager.webpubsub.models.EventHubEndpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-webpubsub Show documentation
Show all versions of azure-resourcemanager-webpubsub Show documentation
This package contains Microsoft Azure SDK for WebPubSub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure WebPubSub Service. Package tag package-2024-03-01.
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.webpubsub.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* An Event Hub endpoint.
* The managed identity of Web PubSub service must be enabled, and the identity should have the "Azure Event Hubs Data
* sender" role to access Event Hub.
*/
@Fluent
public final class EventHubEndpoint extends EventListenerEndpoint {
/*
* The type property.
*/
private EventListenerEndpointDiscriminator type = EventListenerEndpointDiscriminator.EVENT_HUB;
/*
* The fully qualified namespace name of the Event Hub resource. For example, "example.servicebus.windows.net".
*/
private String fullyQualifiedNamespace;
/*
* The name of the Event Hub.
*/
private String eventHubName;
/**
* Creates an instance of EventHubEndpoint class.
*/
public EventHubEndpoint() {
}
/**
* Get the type property: The type property.
*
* @return the type value.
*/
@Override
public EventListenerEndpointDiscriminator type() {
return this.type;
}
/**
* Get the fullyQualifiedNamespace property: The fully qualified namespace name of the Event Hub resource. For
* example, "example.servicebus.windows.net".
*
* @return the fullyQualifiedNamespace value.
*/
public String fullyQualifiedNamespace() {
return this.fullyQualifiedNamespace;
}
/**
* Set the fullyQualifiedNamespace property: The fully qualified namespace name of the Event Hub resource. For
* example, "example.servicebus.windows.net".
*
* @param fullyQualifiedNamespace the fullyQualifiedNamespace value to set.
* @return the EventHubEndpoint object itself.
*/
public EventHubEndpoint withFullyQualifiedNamespace(String fullyQualifiedNamespace) {
this.fullyQualifiedNamespace = fullyQualifiedNamespace;
return this;
}
/**
* Get the eventHubName property: The name of the Event Hub.
*
* @return the eventHubName value.
*/
public String eventHubName() {
return this.eventHubName;
}
/**
* Set the eventHubName property: The name of the Event Hub.
*
* @param eventHubName the eventHubName value to set.
* @return the EventHubEndpoint object itself.
*/
public EventHubEndpoint withEventHubName(String eventHubName) {
this.eventHubName = eventHubName;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (fullyQualifiedNamespace() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property fullyQualifiedNamespace in model EventHubEndpoint"));
}
if (eventHubName() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property eventHubName in model EventHubEndpoint"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(EventHubEndpoint.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("fullyQualifiedNamespace", this.fullyQualifiedNamespace);
jsonWriter.writeStringField("eventHubName", this.eventHubName);
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of EventHubEndpoint from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of EventHubEndpoint if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the EventHubEndpoint.
*/
public static EventHubEndpoint fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
EventHubEndpoint deserializedEventHubEndpoint = new EventHubEndpoint();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("fullyQualifiedNamespace".equals(fieldName)) {
deserializedEventHubEndpoint.fullyQualifiedNamespace = reader.getString();
} else if ("eventHubName".equals(fieldName)) {
deserializedEventHubEndpoint.eventHubName = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedEventHubEndpoint.type
= EventListenerEndpointDiscriminator.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedEventHubEndpoint;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy