| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | | using Azure.ResourceManager.EventHubs.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.EventHubs |
| | 18 | | { |
| | 19 | | internal partial class ConsumerGroupsRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of ConsumerGroupsRestOperations. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="subscriptionId"> Subscription credentials that uniquely identify a Microsoft Azure subscription |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 48 | 32 | | public ConsumerGroupsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript |
| | 33 | | { |
| 48 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 48 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 48 | 40 | | this.subscriptionId = subscriptionId; |
| 48 | 41 | | this.endpoint = endpoint; |
| 48 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 48 | 43 | | _pipeline = pipeline; |
| 48 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string namespaceName, string eventHub |
| | 47 | | { |
| 56 | 48 | | var message = _pipeline.CreateMessage(); |
| 56 | 49 | | var request = message.Request; |
| 56 | 50 | | request.Method = RequestMethod.Put; |
| 56 | 51 | | var uri = new RawRequestUriBuilder(); |
| 56 | 52 | | uri.Reset(endpoint); |
| 56 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 56 | 54 | | uri.AppendPath(subscriptionId, true); |
| 56 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 56 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 56 | 57 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 56 | 58 | | uri.AppendPath(namespaceName, true); |
| 56 | 59 | | uri.AppendPath("/eventhubs/", false); |
| 56 | 60 | | uri.AppendPath(eventHubName, true); |
| 56 | 61 | | uri.AppendPath("/consumergroups/", false); |
| 56 | 62 | | uri.AppendPath(consumerGroupName, true); |
| 56 | 63 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 56 | 64 | | request.Uri = uri; |
| 56 | 65 | | request.Headers.Add("Content-Type", "application/json"); |
| 56 | 66 | | var content = new Utf8JsonRequestContent(); |
| 56 | 67 | | content.JsonWriter.WriteObjectValue(parameters); |
| 56 | 68 | | request.Content = content; |
| 56 | 69 | | return message; |
| | 70 | | } |
| | 71 | |
|
| | 72 | | /// <summary> Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. </summary |
| | 73 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 74 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 75 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 76 | | /// <param name="consumerGroupName"> The consumer group name. </param> |
| | 77 | | /// <param name="parameters"> Parameters supplied to create or update a consumer group resource. </param> |
| | 78 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 79 | | public async Task<Response<ConsumerGroup>> CreateOrUpdateAsync(string resourceGroupName, string namespaceName, s |
| | 80 | | { |
| 28 | 81 | | if (resourceGroupName == null) |
| | 82 | | { |
| 0 | 83 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 84 | | } |
| 28 | 85 | | if (namespaceName == null) |
| | 86 | | { |
| 0 | 87 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 88 | | } |
| 28 | 89 | | if (eventHubName == null) |
| | 90 | | { |
| 0 | 91 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 92 | | } |
| 28 | 93 | | if (consumerGroupName == null) |
| | 94 | | { |
| 0 | 95 | | throw new ArgumentNullException(nameof(consumerGroupName)); |
| | 96 | | } |
| 28 | 97 | | if (parameters == null) |
| | 98 | | { |
| 0 | 99 | | throw new ArgumentNullException(nameof(parameters)); |
| | 100 | | } |
| | 101 | |
|
| 28 | 102 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, namespaceName, eventHubName, consumerGrou |
| 28 | 103 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 28 | 104 | | switch (message.Response.Status) |
| | 105 | | { |
| | 106 | | case 200: |
| | 107 | | { |
| 28 | 108 | | ConsumerGroup value = default; |
| 28 | 109 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 28 | 110 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 111 | | { |
| 0 | 112 | | value = null; |
| | 113 | | } |
| | 114 | | else |
| | 115 | | { |
| 28 | 116 | | value = ConsumerGroup.DeserializeConsumerGroup(document.RootElement); |
| | 117 | | } |
| 28 | 118 | | return Response.FromValue(value, message.Response); |
| | 119 | | } |
| | 120 | | default: |
| 0 | 121 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 122 | | } |
| 28 | 123 | | } |
| | 124 | |
|
| | 125 | | /// <summary> Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. </summary |
| | 126 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 127 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 128 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 129 | | /// <param name="consumerGroupName"> The consumer group name. </param> |
| | 130 | | /// <param name="parameters"> Parameters supplied to create or update a consumer group resource. </param> |
| | 131 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 132 | | public Response<ConsumerGroup> CreateOrUpdate(string resourceGroupName, string namespaceName, string eventHubNam |
| | 133 | | { |
| 28 | 134 | | if (resourceGroupName == null) |
| | 135 | | { |
| 0 | 136 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 137 | | } |
| 28 | 138 | | if (namespaceName == null) |
| | 139 | | { |
| 0 | 140 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 141 | | } |
| 28 | 142 | | if (eventHubName == null) |
| | 143 | | { |
| 0 | 144 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 145 | | } |
| 28 | 146 | | if (consumerGroupName == null) |
| | 147 | | { |
| 0 | 148 | | throw new ArgumentNullException(nameof(consumerGroupName)); |
| | 149 | | } |
| 28 | 150 | | if (parameters == null) |
| | 151 | | { |
| 0 | 152 | | throw new ArgumentNullException(nameof(parameters)); |
| | 153 | | } |
| | 154 | |
|
| 28 | 155 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, namespaceName, eventHubName, consumerGrou |
| 28 | 156 | | _pipeline.Send(message, cancellationToken); |
| 28 | 157 | | switch (message.Response.Status) |
| | 158 | | { |
| | 159 | | case 200: |
| | 160 | | { |
| 28 | 161 | | ConsumerGroup value = default; |
| 28 | 162 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 28 | 163 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 164 | | { |
| 0 | 165 | | value = null; |
| | 166 | | } |
| | 167 | | else |
| | 168 | | { |
| 28 | 169 | | value = ConsumerGroup.DeserializeConsumerGroup(document.RootElement); |
| | 170 | | } |
| 28 | 171 | | return Response.FromValue(value, message.Response); |
| | 172 | | } |
| | 173 | | default: |
| 0 | 174 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 175 | | } |
| 28 | 176 | | } |
| | 177 | |
|
| | 178 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string namespaceName, string eventHubName, st |
| | 179 | | { |
| 8 | 180 | | var message = _pipeline.CreateMessage(); |
| 8 | 181 | | var request = message.Request; |
| 8 | 182 | | request.Method = RequestMethod.Delete; |
| 8 | 183 | | var uri = new RawRequestUriBuilder(); |
| 8 | 184 | | uri.Reset(endpoint); |
| 8 | 185 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 186 | | uri.AppendPath(subscriptionId, true); |
| 8 | 187 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 188 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 189 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 8 | 190 | | uri.AppendPath(namespaceName, true); |
| 8 | 191 | | uri.AppendPath("/eventhubs/", false); |
| 8 | 192 | | uri.AppendPath(eventHubName, true); |
| 8 | 193 | | uri.AppendPath("/consumergroups/", false); |
| 8 | 194 | | uri.AppendPath(consumerGroupName, true); |
| 8 | 195 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 8 | 196 | | request.Uri = uri; |
| 8 | 197 | | return message; |
| | 198 | | } |
| | 199 | |
|
| | 200 | | /// <summary> Deletes a consumer group from the specified Event Hub and resource group. </summary> |
| | 201 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 202 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 203 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 204 | | /// <param name="consumerGroupName"> The consumer group name. </param> |
| | 205 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 206 | | public async Task<Response> DeleteAsync(string resourceGroupName, string namespaceName, string eventHubName, str |
| | 207 | | { |
| 4 | 208 | | if (resourceGroupName == null) |
| | 209 | | { |
| 0 | 210 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 211 | | } |
| 4 | 212 | | if (namespaceName == null) |
| | 213 | | { |
| 0 | 214 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 215 | | } |
| 4 | 216 | | if (eventHubName == null) |
| | 217 | | { |
| 0 | 218 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 219 | | } |
| 4 | 220 | | if (consumerGroupName == null) |
| | 221 | | { |
| 0 | 222 | | throw new ArgumentNullException(nameof(consumerGroupName)); |
| | 223 | | } |
| | 224 | |
|
| 4 | 225 | | using var message = CreateDeleteRequest(resourceGroupName, namespaceName, eventHubName, consumerGroupName); |
| 4 | 226 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 227 | | switch (message.Response.Status) |
| | 228 | | { |
| | 229 | | case 200: |
| | 230 | | case 204: |
| 4 | 231 | | return message.Response; |
| | 232 | | default: |
| 0 | 233 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 234 | | } |
| 4 | 235 | | } |
| | 236 | |
|
| | 237 | | /// <summary> Deletes a consumer group from the specified Event Hub and resource group. </summary> |
| | 238 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 239 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 240 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 241 | | /// <param name="consumerGroupName"> The consumer group name. </param> |
| | 242 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 243 | | public Response Delete(string resourceGroupName, string namespaceName, string eventHubName, string consumerGroup |
| | 244 | | { |
| 4 | 245 | | if (resourceGroupName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 248 | | } |
| 4 | 249 | | if (namespaceName == null) |
| | 250 | | { |
| 0 | 251 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 252 | | } |
| 4 | 253 | | if (eventHubName == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 256 | | } |
| 4 | 257 | | if (consumerGroupName == null) |
| | 258 | | { |
| 0 | 259 | | throw new ArgumentNullException(nameof(consumerGroupName)); |
| | 260 | | } |
| | 261 | |
|
| 4 | 262 | | using var message = CreateDeleteRequest(resourceGroupName, namespaceName, eventHubName, consumerGroupName); |
| 4 | 263 | | _pipeline.Send(message, cancellationToken); |
| 4 | 264 | | switch (message.Response.Status) |
| | 265 | | { |
| | 266 | | case 200: |
| | 267 | | case 204: |
| 4 | 268 | | return message.Response; |
| | 269 | | default: |
| 0 | 270 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 271 | | } |
| 4 | 272 | | } |
| | 273 | |
|
| | 274 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string namespaceName, string eventHubName, strin |
| | 275 | | { |
| 16 | 276 | | var message = _pipeline.CreateMessage(); |
| 16 | 277 | | var request = message.Request; |
| 16 | 278 | | request.Method = RequestMethod.Get; |
| 16 | 279 | | var uri = new RawRequestUriBuilder(); |
| 16 | 280 | | uri.Reset(endpoint); |
| 16 | 281 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 282 | | uri.AppendPath(subscriptionId, true); |
| 16 | 283 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 284 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 285 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 16 | 286 | | uri.AppendPath(namespaceName, true); |
| 16 | 287 | | uri.AppendPath("/eventhubs/", false); |
| 16 | 288 | | uri.AppendPath(eventHubName, true); |
| 16 | 289 | | uri.AppendPath("/consumergroups/", false); |
| 16 | 290 | | uri.AppendPath(consumerGroupName, true); |
| 16 | 291 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 16 | 292 | | request.Uri = uri; |
| 16 | 293 | | return message; |
| | 294 | | } |
| | 295 | |
|
| | 296 | | /// <summary> Gets a description for the specified consumer group. </summary> |
| | 297 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 298 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 299 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 300 | | /// <param name="consumerGroupName"> The consumer group name. </param> |
| | 301 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 302 | | public async Task<Response<ConsumerGroup>> GetAsync(string resourceGroupName, string namespaceName, string event |
| | 303 | | { |
| 8 | 304 | | if (resourceGroupName == null) |
| | 305 | | { |
| 0 | 306 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 307 | | } |
| 8 | 308 | | if (namespaceName == null) |
| | 309 | | { |
| 0 | 310 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 311 | | } |
| 8 | 312 | | if (eventHubName == null) |
| | 313 | | { |
| 0 | 314 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 315 | | } |
| 8 | 316 | | if (consumerGroupName == null) |
| | 317 | | { |
| 0 | 318 | | throw new ArgumentNullException(nameof(consumerGroupName)); |
| | 319 | | } |
| | 320 | |
|
| 8 | 321 | | using var message = CreateGetRequest(resourceGroupName, namespaceName, eventHubName, consumerGroupName); |
| 8 | 322 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 8 | 323 | | switch (message.Response.Status) |
| | 324 | | { |
| | 325 | | case 200: |
| | 326 | | { |
| 8 | 327 | | ConsumerGroup value = default; |
| 8 | 328 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 8 | 329 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 330 | | { |
| 0 | 331 | | value = null; |
| | 332 | | } |
| | 333 | | else |
| | 334 | | { |
| 8 | 335 | | value = ConsumerGroup.DeserializeConsumerGroup(document.RootElement); |
| | 336 | | } |
| 8 | 337 | | return Response.FromValue(value, message.Response); |
| | 338 | | } |
| | 339 | | default: |
| 0 | 340 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 341 | | } |
| 8 | 342 | | } |
| | 343 | |
|
| | 344 | | /// <summary> Gets a description for the specified consumer group. </summary> |
| | 345 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 346 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 347 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 348 | | /// <param name="consumerGroupName"> The consumer group name. </param> |
| | 349 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 350 | | public Response<ConsumerGroup> Get(string resourceGroupName, string namespaceName, string eventHubName, string c |
| | 351 | | { |
| 8 | 352 | | if (resourceGroupName == null) |
| | 353 | | { |
| 0 | 354 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 355 | | } |
| 8 | 356 | | if (namespaceName == null) |
| | 357 | | { |
| 0 | 358 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 359 | | } |
| 8 | 360 | | if (eventHubName == null) |
| | 361 | | { |
| 0 | 362 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 363 | | } |
| 8 | 364 | | if (consumerGroupName == null) |
| | 365 | | { |
| 0 | 366 | | throw new ArgumentNullException(nameof(consumerGroupName)); |
| | 367 | | } |
| | 368 | |
|
| 8 | 369 | | using var message = CreateGetRequest(resourceGroupName, namespaceName, eventHubName, consumerGroupName); |
| 8 | 370 | | _pipeline.Send(message, cancellationToken); |
| 8 | 371 | | switch (message.Response.Status) |
| | 372 | | { |
| | 373 | | case 200: |
| | 374 | | { |
| 8 | 375 | | ConsumerGroup value = default; |
| 8 | 376 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 8 | 377 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 378 | | { |
| 0 | 379 | | value = null; |
| | 380 | | } |
| | 381 | | else |
| | 382 | | { |
| 8 | 383 | | value = ConsumerGroup.DeserializeConsumerGroup(document.RootElement); |
| | 384 | | } |
| 8 | 385 | | return Response.FromValue(value, message.Response); |
| | 386 | | } |
| | 387 | | default: |
| 0 | 388 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 389 | | } |
| 8 | 390 | | } |
| | 391 | |
|
| | 392 | | internal HttpMessage CreateListByEventHubRequest(string resourceGroupName, string namespaceName, string eventHub |
| | 393 | | { |
| 16 | 394 | | var message = _pipeline.CreateMessage(); |
| 16 | 395 | | var request = message.Request; |
| 16 | 396 | | request.Method = RequestMethod.Get; |
| 16 | 397 | | var uri = new RawRequestUriBuilder(); |
| 16 | 398 | | uri.Reset(endpoint); |
| 16 | 399 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 400 | | uri.AppendPath(subscriptionId, true); |
| 16 | 401 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 402 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 403 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 16 | 404 | | uri.AppendPath(namespaceName, true); |
| 16 | 405 | | uri.AppendPath("/eventhubs/", false); |
| 16 | 406 | | uri.AppendPath(eventHubName, true); |
| 16 | 407 | | uri.AppendPath("/consumergroups", false); |
| 16 | 408 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 16 | 409 | | if (skip != null) |
| | 410 | | { |
| 4 | 411 | | uri.AppendQuery("$skip", skip.Value, true); |
| | 412 | | } |
| 16 | 413 | | if (top != null) |
| | 414 | | { |
| 4 | 415 | | uri.AppendQuery("$top", top.Value, true); |
| | 416 | | } |
| 16 | 417 | | request.Uri = uri; |
| 16 | 418 | | return message; |
| | 419 | | } |
| | 420 | |
|
| | 421 | | /// <summary> Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists |
| | 422 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 423 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 424 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 425 | | /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo |
| | 426 | | /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param> |
| | 427 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 428 | | public async Task<Response<ConsumerGroupListResult>> ListByEventHubAsync(string resourceGroupName, string namesp |
| | 429 | | { |
| 8 | 430 | | if (resourceGroupName == null) |
| | 431 | | { |
| 0 | 432 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 433 | | } |
| 8 | 434 | | if (namespaceName == null) |
| | 435 | | { |
| 0 | 436 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 437 | | } |
| 8 | 438 | | if (eventHubName == null) |
| | 439 | | { |
| 0 | 440 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 441 | | } |
| | 442 | |
|
| 8 | 443 | | using var message = CreateListByEventHubRequest(resourceGroupName, namespaceName, eventHubName, skip, top); |
| 8 | 444 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 8 | 445 | | switch (message.Response.Status) |
| | 446 | | { |
| | 447 | | case 200: |
| | 448 | | { |
| 8 | 449 | | ConsumerGroupListResult value = default; |
| 8 | 450 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 8 | 451 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 452 | | { |
| 0 | 453 | | value = null; |
| | 454 | | } |
| | 455 | | else |
| | 456 | | { |
| 8 | 457 | | value = ConsumerGroupListResult.DeserializeConsumerGroupListResult(document.RootElement); |
| | 458 | | } |
| 8 | 459 | | return Response.FromValue(value, message.Response); |
| | 460 | | } |
| | 461 | | default: |
| 0 | 462 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 463 | | } |
| 8 | 464 | | } |
| | 465 | |
|
| | 466 | | /// <summary> Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists |
| | 467 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 468 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 469 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 470 | | /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo |
| | 471 | | /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param> |
| | 472 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 473 | | public Response<ConsumerGroupListResult> ListByEventHub(string resourceGroupName, string namespaceName, string e |
| | 474 | | { |
| 8 | 475 | | if (resourceGroupName == null) |
| | 476 | | { |
| 0 | 477 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 478 | | } |
| 8 | 479 | | if (namespaceName == null) |
| | 480 | | { |
| 0 | 481 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 482 | | } |
| 8 | 483 | | if (eventHubName == null) |
| | 484 | | { |
| 0 | 485 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 486 | | } |
| | 487 | |
|
| 8 | 488 | | using var message = CreateListByEventHubRequest(resourceGroupName, namespaceName, eventHubName, skip, top); |
| 8 | 489 | | _pipeline.Send(message, cancellationToken); |
| 8 | 490 | | switch (message.Response.Status) |
| | 491 | | { |
| | 492 | | case 200: |
| | 493 | | { |
| 8 | 494 | | ConsumerGroupListResult value = default; |
| 8 | 495 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 8 | 496 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 497 | | { |
| 0 | 498 | | value = null; |
| | 499 | | } |
| | 500 | | else |
| | 501 | | { |
| 8 | 502 | | value = ConsumerGroupListResult.DeserializeConsumerGroupListResult(document.RootElement); |
| | 503 | | } |
| 8 | 504 | | return Response.FromValue(value, message.Response); |
| | 505 | | } |
| | 506 | | default: |
| 0 | 507 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 508 | | } |
| 8 | 509 | | } |
| | 510 | |
|
| | 511 | | internal HttpMessage CreateListByEventHubNextPageRequest(string nextLink, string resourceGroupName, string names |
| | 512 | | { |
| 4 | 513 | | var message = _pipeline.CreateMessage(); |
| 4 | 514 | | var request = message.Request; |
| 4 | 515 | | request.Method = RequestMethod.Get; |
| 4 | 516 | | var uri = new RawRequestUriBuilder(); |
| 4 | 517 | | uri.Reset(endpoint); |
| 4 | 518 | | uri.AppendRawNextLink(nextLink, false); |
| 4 | 519 | | request.Uri = uri; |
| 4 | 520 | | return message; |
| | 521 | | } |
| | 522 | |
|
| | 523 | | /// <summary> Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists |
| | 524 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 525 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 526 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 527 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 528 | | /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo |
| | 529 | | /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param> |
| | 530 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 531 | | public async Task<Response<ConsumerGroupListResult>> ListByEventHubNextPageAsync(string nextLink, string resourc |
| | 532 | | { |
| 2 | 533 | | if (nextLink == null) |
| | 534 | | { |
| 0 | 535 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 536 | | } |
| 2 | 537 | | if (resourceGroupName == null) |
| | 538 | | { |
| 0 | 539 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 540 | | } |
| 2 | 541 | | if (namespaceName == null) |
| | 542 | | { |
| 0 | 543 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 544 | | } |
| 2 | 545 | | if (eventHubName == null) |
| | 546 | | { |
| 0 | 547 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 548 | | } |
| | 549 | |
|
| 2 | 550 | | using var message = CreateListByEventHubNextPageRequest(nextLink, resourceGroupName, namespaceName, eventHub |
| 2 | 551 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 552 | | switch (message.Response.Status) |
| | 553 | | { |
| | 554 | | case 200: |
| | 555 | | { |
| 2 | 556 | | ConsumerGroupListResult value = default; |
| 2 | 557 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 558 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 559 | | { |
| 0 | 560 | | value = null; |
| | 561 | | } |
| | 562 | | else |
| | 563 | | { |
| 2 | 564 | | value = ConsumerGroupListResult.DeserializeConsumerGroupListResult(document.RootElement); |
| | 565 | | } |
| 2 | 566 | | return Response.FromValue(value, message.Response); |
| | 567 | | } |
| | 568 | | default: |
| 0 | 569 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 570 | | } |
| 2 | 571 | | } |
| | 572 | |
|
| | 573 | | /// <summary> Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists |
| | 574 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 575 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 576 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 577 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 578 | | /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo |
| | 579 | | /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param> |
| | 580 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 581 | | public Response<ConsumerGroupListResult> ListByEventHubNextPage(string nextLink, string resourceGroupName, strin |
| | 582 | | { |
| 2 | 583 | | if (nextLink == null) |
| | 584 | | { |
| 0 | 585 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 586 | | } |
| 2 | 587 | | if (resourceGroupName == null) |
| | 588 | | { |
| 0 | 589 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 590 | | } |
| 2 | 591 | | if (namespaceName == null) |
| | 592 | | { |
| 0 | 593 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 594 | | } |
| 2 | 595 | | if (eventHubName == null) |
| | 596 | | { |
| 0 | 597 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 598 | | } |
| | 599 | |
|
| 2 | 600 | | using var message = CreateListByEventHubNextPageRequest(nextLink, resourceGroupName, namespaceName, eventHub |
| 2 | 601 | | _pipeline.Send(message, cancellationToken); |
| 2 | 602 | | switch (message.Response.Status) |
| | 603 | | { |
| | 604 | | case 200: |
| | 605 | | { |
| 2 | 606 | | ConsumerGroupListResult value = default; |
| 2 | 607 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 608 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 609 | | { |
| 0 | 610 | | value = null; |
| | 611 | | } |
| | 612 | | else |
| | 613 | | { |
| 2 | 614 | | value = ConsumerGroupListResult.DeserializeConsumerGroupListResult(document.RootElement); |
| | 615 | | } |
| 2 | 616 | | return Response.FromValue(value, message.Response); |
| | 617 | | } |
| | 618 | | default: |
| 0 | 619 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 620 | | } |
| 2 | 621 | | } |
| | 622 | | } |
| | 623 | | } |