com.azure.resourcemanager.eventhubs.implementation.ConsumerGroupsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-eventhubs Show documentation
Show all versions of azure-resourcemanager-eventhubs Show documentation
This package contains Microsoft Azure EventHubs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.eventhubs.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.eventhubs.fluent.ConsumerGroupsClient;
import com.azure.resourcemanager.eventhubs.fluent.models.ConsumerGroupInner;
import com.azure.resourcemanager.eventhubs.models.ConsumerGroupListResult;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in ConsumerGroupsClient. */
public final class ConsumerGroupsClientImpl implements ConsumerGroupsClient {
private final ClientLogger logger = new ClientLogger(ConsumerGroupsClientImpl.class);
/** The proxy service used to perform REST calls. */
private final ConsumerGroupsService service;
/** The service client containing this operation class. */
private final EventHubManagementClientImpl client;
/**
* Initializes an instance of ConsumerGroupsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ConsumerGroupsClientImpl(EventHubManagementClientImpl client) {
this.service =
RestProxy.create(ConsumerGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for EventHubManagementClientConsumerGroups to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "EventHubManagementCl")
private interface ConsumerGroupsService {
@Headers({"Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces"
+ "/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("namespaceName") String namespaceName,
@PathParam("eventHubName") String eventHubName,
@PathParam("consumerGroupName") String consumerGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") ConsumerGroupInner parameters,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces"
+ "/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}")
@ExpectedResponses({200, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("namespaceName") String namespaceName,
@PathParam("eventHubName") String eventHubName,
@PathParam("consumerGroupName") String consumerGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces"
+ "/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("namespaceName") String namespaceName,
@PathParam("eventHubName") String eventHubName,
@PathParam("consumerGroupName") String consumerGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces"
+ "/{namespaceName}/eventhubs/{eventHubName}/consumergroups")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByEventHub(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("namespaceName") String namespaceName,
@PathParam("eventHubName") String eventHubName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@QueryParam("$skip") Integer skip,
@QueryParam("$top") Integer top,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByEventHubNext(
@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept,
Context context);
}
/**
* Creates or updates an Event Hubs consumer group as a nested resource within a Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param parameters Parameters supplied to create or update a consumer group resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return single item in List or Get Consumer group operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> createOrUpdateWithResponseAsync(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
ConsumerGroupInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (eventHubName == null) {
return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null."));
}
if (consumerGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
namespaceName,
eventHubName,
consumerGroupName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
parameters,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates or updates an Event Hubs consumer group as a nested resource within a Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param parameters Parameters supplied to create or update a consumer group resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return single item in List or Get Consumer group operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
ConsumerGroupInner parameters,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (eventHubName == null) {
return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null."));
}
if (consumerGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
namespaceName,
eventHubName,
consumerGroupName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
parameters,
accept,
context);
}
/**
* Creates or updates an Event Hubs consumer group as a nested resource within a Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param parameters Parameters supplied to create or update a consumer group resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return single item in List or Get Consumer group operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
ConsumerGroupInner parameters) {
return createOrUpdateWithResponseAsync(
resourceGroupName, namespaceName, eventHubName, consumerGroupName, parameters)
.flatMap(
(Response res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Creates or updates an Event Hubs consumer group as a nested resource within a Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param parameters Parameters supplied to create or update a consumer group resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return single item in List or Get Consumer group operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConsumerGroupInner createOrUpdate(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
ConsumerGroupInner parameters) {
return createOrUpdateAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName, parameters)
.block();
}
/**
* Creates or updates an Event Hubs consumer group as a nested resource within a Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param parameters Parameters supplied to create or update a consumer group resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return single item in List or Get Consumer group operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createOrUpdateWithResponse(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
ConsumerGroupInner parameters,
Context context) {
return createOrUpdateWithResponseAsync(
resourceGroupName, namespaceName, eventHubName, consumerGroupName, parameters, context)
.block();
}
/**
* Deletes a consumer group from the specified Event Hub and resource group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> deleteWithResponseAsync(
String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (eventHubName == null) {
return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null."));
}
if (consumerGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
resourceGroupName,
namespaceName,
eventHubName,
consumerGroupName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a consumer group from the specified Event Hub and resource group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> deleteWithResponseAsync(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (eventHubName == null) {
return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null."));
}
if (consumerGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.delete(
this.client.getEndpoint(),
resourceGroupName,
namespaceName,
eventHubName,
consumerGroupName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context);
}
/**
* Deletes a consumer group from the specified Event Hub and resource group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(
String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) {
return deleteWithResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName)
.flatMap((Response res) -> Mono.empty());
}
/**
* Deletes a consumer group from the specified Event Hub and resource group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) {
deleteAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).block();
}
/**
* Deletes a consumer group from the specified Event Hub and resource group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deleteWithResponse(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
Context context) {
return deleteWithResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName, context)
.block();
}
/**
* Gets a description for the specified consumer group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a description for the specified consumer group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(
String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (eventHubName == null) {
return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null."));
}
if (consumerGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getEndpoint(),
resourceGroupName,
namespaceName,
eventHubName,
consumerGroupName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a description for the specified consumer group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a description for the specified consumer group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (eventHubName == null) {
return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null."));
}
if (consumerGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter consumerGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.get(
this.client.getEndpoint(),
resourceGroupName,
namespaceName,
eventHubName,
consumerGroupName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context);
}
/**
* Gets a description for the specified consumer group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a description for the specified consumer group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(
String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) {
return getWithResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName)
.flatMap(
(Response res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a description for the specified consumer group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a description for the specified consumer group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ConsumerGroupInner get(
String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) {
return getAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName).block();
}
/**
* Gets a description for the specified consumer group.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param consumerGroupName The consumer group name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a description for the specified consumer group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(
String resourceGroupName,
String namespaceName,
String eventHubName,
String consumerGroupName,
Context context) {
return getWithResponseAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName, context).block();
}
/**
* Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the
* Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the consumer groups in a Namespace.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByEventHubSinglePageAsync(
String resourceGroupName, String namespaceName, String eventHubName, Integer skip, Integer top) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (eventHubName == null) {
return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.listByEventHub(
this.client.getEndpoint(),
resourceGroupName,
namespaceName,
eventHubName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
skip,
top,
accept,
context))
.>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the
* Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the consumer groups in a Namespace.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByEventHubSinglePageAsync(
String resourceGroupName,
String namespaceName,
String eventHubName,
Integer skip,
Integer top,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (namespaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null."));
}
if (eventHubName == null) {
return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByEventHub(
this.client.getEndpoint(),
resourceGroupName,
namespaceName,
eventHubName,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
skip,
top,
accept,
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the
* Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the consumer groups in a Namespace.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByEventHubAsync(
String resourceGroupName, String namespaceName, String eventHubName, Integer skip, Integer top) {
return new PagedFlux<>(
() -> listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top),
nextLink -> listByEventHubNextSinglePageAsync(nextLink));
}
/**
* Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the
* Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the consumer groups in a Namespace.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByEventHubAsync(
String resourceGroupName, String namespaceName, String eventHubName) {
final Integer skip = null;
final Integer top = null;
return new PagedFlux<>(
() -> listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top),
nextLink -> listByEventHubNextSinglePageAsync(nextLink));
}
/**
* Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the
* Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the consumer groups in a Namespace.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByEventHubAsync(
String resourceGroupName,
String namespaceName,
String eventHubName,
Integer skip,
Integer top,
Context context) {
return new PagedFlux<>(
() -> listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top, context),
nextLink -> listByEventHubNextSinglePageAsync(nextLink, context));
}
/**
* Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the
* Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the consumer groups in a Namespace.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByEventHub(
String resourceGroupName, String namespaceName, String eventHubName) {
final Integer skip = null;
final Integer top = null;
return new PagedIterable<>(listByEventHubAsync(resourceGroupName, namespaceName, eventHubName, skip, top));
}
/**
* Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the
* Namespace.
*
* @param resourceGroupName Name of the resource group within the azure subscription.
* @param namespaceName The Namespace name.
* @param eventHubName The Event Hub name.
* @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains
* a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting
* point to use for subsequent calls.
* @param top May be used to limit the number of results to the most recent N usageDetails.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the consumer groups in a Namespace.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByEventHub(
String resourceGroupName,
String namespaceName,
String eventHubName,
Integer skip,
Integer top,
Context context) {
return new PagedIterable<>(
listByEventHubAsync(resourceGroupName, namespaceName, eventHubName, skip, top, context));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the result to the List Consumer Group operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByEventHubNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listByEventHubNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the result to the List Consumer Group operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByEventHubNextSinglePageAsync(
String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByEventHubNext(nextLink, this.client.getEndpoint(), accept, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
}