| | 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 EventHubsRestOperations |
| | 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 EventHubsRestOperations. </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 EventHubsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId |
| | 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 CreateListAuthorizationRulesRequest(string resourceGroupName, string namespaceName, string |
| | 47 | | { |
| 8 | 48 | | var message = _pipeline.CreateMessage(); |
| 8 | 49 | | var request = message.Request; |
| 8 | 50 | | request.Method = RequestMethod.Get; |
| 8 | 51 | | var uri = new RawRequestUriBuilder(); |
| 8 | 52 | | uri.Reset(endpoint); |
| 8 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 54 | | uri.AppendPath(subscriptionId, true); |
| 8 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 57 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 8 | 58 | | uri.AppendPath(namespaceName, true); |
| 8 | 59 | | uri.AppendPath("/eventhubs/", false); |
| 8 | 60 | | uri.AppendPath(eventHubName, true); |
| 8 | 61 | | uri.AppendPath("/authorizationRules", false); |
| 8 | 62 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 8 | 63 | | request.Uri = uri; |
| 8 | 64 | | return message; |
| | 65 | | } |
| | 66 | |
|
| | 67 | | /// <summary> Gets the authorization rules for an Event Hub. </summary> |
| | 68 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 69 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 70 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 71 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 72 | | public async Task<Response<AuthorizationRuleListResult>> ListAuthorizationRulesAsync(string resourceGroupName, s |
| | 73 | | { |
| 4 | 74 | | if (resourceGroupName == null) |
| | 75 | | { |
| 0 | 76 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 77 | | } |
| 4 | 78 | | if (namespaceName == null) |
| | 79 | | { |
| 0 | 80 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 81 | | } |
| 4 | 82 | | if (eventHubName == null) |
| | 83 | | { |
| 0 | 84 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 85 | | } |
| | 86 | |
|
| 4 | 87 | | using var message = CreateListAuthorizationRulesRequest(resourceGroupName, namespaceName, eventHubName); |
| 4 | 88 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 89 | | switch (message.Response.Status) |
| | 90 | | { |
| | 91 | | case 200: |
| | 92 | | { |
| 4 | 93 | | AuthorizationRuleListResult value = default; |
| 4 | 94 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 95 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| 0 | 97 | | value = null; |
| | 98 | | } |
| | 99 | | else |
| | 100 | | { |
| 4 | 101 | | value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem |
| | 102 | | } |
| 4 | 103 | | return Response.FromValue(value, message.Response); |
| | 104 | | } |
| | 105 | | default: |
| 0 | 106 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 107 | | } |
| 4 | 108 | | } |
| | 109 | |
|
| | 110 | | /// <summary> Gets the authorization rules for an Event Hub. </summary> |
| | 111 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 112 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 113 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 114 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 115 | | public Response<AuthorizationRuleListResult> ListAuthorizationRules(string resourceGroupName, string namespaceNa |
| | 116 | | { |
| 4 | 117 | | if (resourceGroupName == null) |
| | 118 | | { |
| 0 | 119 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 120 | | } |
| 4 | 121 | | if (namespaceName == null) |
| | 122 | | { |
| 0 | 123 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 124 | | } |
| 4 | 125 | | if (eventHubName == null) |
| | 126 | | { |
| 0 | 127 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 128 | | } |
| | 129 | |
|
| 4 | 130 | | using var message = CreateListAuthorizationRulesRequest(resourceGroupName, namespaceName, eventHubName); |
| 4 | 131 | | _pipeline.Send(message, cancellationToken); |
| 4 | 132 | | switch (message.Response.Status) |
| | 133 | | { |
| | 134 | | case 200: |
| | 135 | | { |
| 4 | 136 | | AuthorizationRuleListResult value = default; |
| 4 | 137 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 138 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| 0 | 140 | | value = null; |
| | 141 | | } |
| | 142 | | else |
| | 143 | | { |
| 4 | 144 | | value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem |
| | 145 | | } |
| 4 | 146 | | return Response.FromValue(value, message.Response); |
| | 147 | | } |
| | 148 | | default: |
| 0 | 149 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 150 | | } |
| 4 | 151 | | } |
| | 152 | |
|
| | 153 | | internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string resourceGroupName, string namespaceName |
| | 154 | | { |
| 16 | 155 | | var message = _pipeline.CreateMessage(); |
| 16 | 156 | | var request = message.Request; |
| 16 | 157 | | request.Method = RequestMethod.Put; |
| 16 | 158 | | var uri = new RawRequestUriBuilder(); |
| 16 | 159 | | uri.Reset(endpoint); |
| 16 | 160 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 161 | | uri.AppendPath(subscriptionId, true); |
| 16 | 162 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 163 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 164 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 16 | 165 | | uri.AppendPath(namespaceName, true); |
| 16 | 166 | | uri.AppendPath("/eventhubs/", false); |
| 16 | 167 | | uri.AppendPath(eventHubName, true); |
| 16 | 168 | | uri.AppendPath("/authorizationRules/", false); |
| 16 | 169 | | uri.AppendPath(authorizationRuleName, true); |
| 16 | 170 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 16 | 171 | | request.Uri = uri; |
| 16 | 172 | | request.Headers.Add("Content-Type", "application/json"); |
| 16 | 173 | | var content = new Utf8JsonRequestContent(); |
| 16 | 174 | | content.JsonWriter.WriteObjectValue(parameters); |
| 16 | 175 | | request.Content = content; |
| 16 | 176 | | return message; |
| | 177 | | } |
| | 178 | |
|
| | 179 | | /// <summary> Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the Author |
| | 180 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 181 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 182 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 183 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 184 | | /// <param name="parameters"> The shared access AuthorizationRule. </param> |
| | 185 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 186 | | public async Task<Response<AuthorizationRule>> CreateOrUpdateAuthorizationRuleAsync(string resourceGroupName, st |
| | 187 | | { |
| 8 | 188 | | if (resourceGroupName == null) |
| | 189 | | { |
| 0 | 190 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 191 | | } |
| 8 | 192 | | if (namespaceName == null) |
| | 193 | | { |
| 0 | 194 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 195 | | } |
| 8 | 196 | | if (eventHubName == null) |
| | 197 | | { |
| 0 | 198 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 199 | | } |
| 8 | 200 | | if (authorizationRuleName == null) |
| | 201 | | { |
| 0 | 202 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 203 | | } |
| 8 | 204 | | if (parameters == null) |
| | 205 | | { |
| 0 | 206 | | throw new ArgumentNullException(nameof(parameters)); |
| | 207 | | } |
| | 208 | |
|
| 8 | 209 | | using var message = CreateCreateOrUpdateAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubN |
| 8 | 210 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 8 | 211 | | switch (message.Response.Status) |
| | 212 | | { |
| | 213 | | case 200: |
| | 214 | | { |
| 8 | 215 | | AuthorizationRule value = default; |
| 8 | 216 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 8 | 217 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 218 | | { |
| 0 | 219 | | value = null; |
| | 220 | | } |
| | 221 | | else |
| | 222 | | { |
| 8 | 223 | | value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement); |
| | 224 | | } |
| 8 | 225 | | return Response.FromValue(value, message.Response); |
| | 226 | | } |
| | 227 | | default: |
| 0 | 228 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 229 | | } |
| 8 | 230 | | } |
| | 231 | |
|
| | 232 | | /// <summary> Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the Author |
| | 233 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 234 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 235 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 236 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 237 | | /// <param name="parameters"> The shared access AuthorizationRule. </param> |
| | 238 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 239 | | public Response<AuthorizationRule> CreateOrUpdateAuthorizationRule(string resourceGroupName, string namespaceNam |
| | 240 | | { |
| 8 | 241 | | if (resourceGroupName == null) |
| | 242 | | { |
| 0 | 243 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 244 | | } |
| 8 | 245 | | if (namespaceName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 248 | | } |
| 8 | 249 | | if (eventHubName == null) |
| | 250 | | { |
| 0 | 251 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 252 | | } |
| 8 | 253 | | if (authorizationRuleName == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 256 | | } |
| 8 | 257 | | if (parameters == null) |
| | 258 | | { |
| 0 | 259 | | throw new ArgumentNullException(nameof(parameters)); |
| | 260 | | } |
| | 261 | |
|
| 8 | 262 | | using var message = CreateCreateOrUpdateAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubN |
| 8 | 263 | | _pipeline.Send(message, cancellationToken); |
| 8 | 264 | | switch (message.Response.Status) |
| | 265 | | { |
| | 266 | | case 200: |
| | 267 | | { |
| 8 | 268 | | AuthorizationRule value = default; |
| 8 | 269 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 8 | 270 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 271 | | { |
| 0 | 272 | | value = null; |
| | 273 | | } |
| | 274 | | else |
| | 275 | | { |
| 8 | 276 | | value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement); |
| | 277 | | } |
| 8 | 278 | | return Response.FromValue(value, message.Response); |
| | 279 | | } |
| | 280 | | default: |
| 0 | 281 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 282 | | } |
| 8 | 283 | | } |
| | 284 | |
|
| | 285 | | internal HttpMessage CreateGetAuthorizationRuleRequest(string resourceGroupName, string namespaceName, string ev |
| | 286 | | { |
| 16 | 287 | | var message = _pipeline.CreateMessage(); |
| 16 | 288 | | var request = message.Request; |
| 16 | 289 | | request.Method = RequestMethod.Get; |
| 16 | 290 | | var uri = new RawRequestUriBuilder(); |
| 16 | 291 | | uri.Reset(endpoint); |
| 16 | 292 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 293 | | uri.AppendPath(subscriptionId, true); |
| 16 | 294 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 295 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 296 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 16 | 297 | | uri.AppendPath(namespaceName, true); |
| 16 | 298 | | uri.AppendPath("/eventhubs/", false); |
| 16 | 299 | | uri.AppendPath(eventHubName, true); |
| 16 | 300 | | uri.AppendPath("/authorizationRules/", false); |
| 16 | 301 | | uri.AppendPath(authorizationRuleName, true); |
| 16 | 302 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 16 | 303 | | request.Uri = uri; |
| 16 | 304 | | return message; |
| | 305 | | } |
| | 306 | |
|
| | 307 | | /// <summary> Gets an AuthorizationRule for an Event Hub by rule name. </summary> |
| | 308 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 309 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 310 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 311 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 312 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 313 | | public async Task<Response<AuthorizationRule>> GetAuthorizationRuleAsync(string resourceGroupName, string namesp |
| | 314 | | { |
| 8 | 315 | | if (resourceGroupName == null) |
| | 316 | | { |
| 0 | 317 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 318 | | } |
| 8 | 319 | | if (namespaceName == null) |
| | 320 | | { |
| 0 | 321 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 322 | | } |
| 8 | 323 | | if (eventHubName == null) |
| | 324 | | { |
| 0 | 325 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 326 | | } |
| 8 | 327 | | if (authorizationRuleName == null) |
| | 328 | | { |
| 0 | 329 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 330 | | } |
| | 331 | |
|
| 8 | 332 | | using var message = CreateGetAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubName, author |
| 8 | 333 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 8 | 334 | | switch (message.Response.Status) |
| | 335 | | { |
| | 336 | | case 200: |
| | 337 | | { |
| 8 | 338 | | AuthorizationRule value = default; |
| 8 | 339 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 8 | 340 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 341 | | { |
| 0 | 342 | | value = null; |
| | 343 | | } |
| | 344 | | else |
| | 345 | | { |
| 8 | 346 | | value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement); |
| | 347 | | } |
| 8 | 348 | | return Response.FromValue(value, message.Response); |
| | 349 | | } |
| | 350 | | default: |
| 0 | 351 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 352 | | } |
| 8 | 353 | | } |
| | 354 | |
|
| | 355 | | /// <summary> Gets an AuthorizationRule for an Event Hub by rule name. </summary> |
| | 356 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 357 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 358 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 359 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 360 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 361 | | public Response<AuthorizationRule> GetAuthorizationRule(string resourceGroupName, string namespaceName, string e |
| | 362 | | { |
| 8 | 363 | | if (resourceGroupName == null) |
| | 364 | | { |
| 0 | 365 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 366 | | } |
| 8 | 367 | | if (namespaceName == null) |
| | 368 | | { |
| 0 | 369 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 370 | | } |
| 8 | 371 | | if (eventHubName == null) |
| | 372 | | { |
| 0 | 373 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 374 | | } |
| 8 | 375 | | if (authorizationRuleName == null) |
| | 376 | | { |
| 0 | 377 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 378 | | } |
| | 379 | |
|
| 8 | 380 | | using var message = CreateGetAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubName, author |
| 8 | 381 | | _pipeline.Send(message, cancellationToken); |
| 8 | 382 | | switch (message.Response.Status) |
| | 383 | | { |
| | 384 | | case 200: |
| | 385 | | { |
| 8 | 386 | | AuthorizationRule value = default; |
| 8 | 387 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 8 | 388 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 389 | | { |
| 0 | 390 | | value = null; |
| | 391 | | } |
| | 392 | | else |
| | 393 | | { |
| 8 | 394 | | value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement); |
| | 395 | | } |
| 8 | 396 | | return Response.FromValue(value, message.Response); |
| | 397 | | } |
| | 398 | | default: |
| 0 | 399 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 400 | | } |
| 8 | 401 | | } |
| | 402 | |
|
| | 403 | | internal HttpMessage CreateDeleteAuthorizationRuleRequest(string resourceGroupName, string namespaceName, string |
| | 404 | | { |
| 8 | 405 | | var message = _pipeline.CreateMessage(); |
| 8 | 406 | | var request = message.Request; |
| 8 | 407 | | request.Method = RequestMethod.Delete; |
| 8 | 408 | | var uri = new RawRequestUriBuilder(); |
| 8 | 409 | | uri.Reset(endpoint); |
| 8 | 410 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 411 | | uri.AppendPath(subscriptionId, true); |
| 8 | 412 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 413 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 414 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 8 | 415 | | uri.AppendPath(namespaceName, true); |
| 8 | 416 | | uri.AppendPath("/eventhubs/", false); |
| 8 | 417 | | uri.AppendPath(eventHubName, true); |
| 8 | 418 | | uri.AppendPath("/authorizationRules/", false); |
| 8 | 419 | | uri.AppendPath(authorizationRuleName, true); |
| 8 | 420 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 8 | 421 | | request.Uri = uri; |
| 8 | 422 | | return message; |
| | 423 | | } |
| | 424 | |
|
| | 425 | | /// <summary> Deletes an Event Hub AuthorizationRule. </summary> |
| | 426 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 427 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 428 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 429 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 430 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 431 | | public async Task<Response> DeleteAuthorizationRuleAsync(string resourceGroupName, string namespaceName, string |
| | 432 | | { |
| 4 | 433 | | if (resourceGroupName == null) |
| | 434 | | { |
| 0 | 435 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 436 | | } |
| 4 | 437 | | if (namespaceName == null) |
| | 438 | | { |
| 0 | 439 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 440 | | } |
| 4 | 441 | | if (eventHubName == null) |
| | 442 | | { |
| 0 | 443 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 444 | | } |
| 4 | 445 | | if (authorizationRuleName == null) |
| | 446 | | { |
| 0 | 447 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 448 | | } |
| | 449 | |
|
| 4 | 450 | | using var message = CreateDeleteAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubName, aut |
| 4 | 451 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 452 | | switch (message.Response.Status) |
| | 453 | | { |
| | 454 | | case 200: |
| | 455 | | case 204: |
| 4 | 456 | | return message.Response; |
| | 457 | | default: |
| 0 | 458 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 459 | | } |
| 4 | 460 | | } |
| | 461 | |
|
| | 462 | | /// <summary> Deletes an Event Hub AuthorizationRule. </summary> |
| | 463 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 464 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 465 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 466 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 467 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 468 | | public Response DeleteAuthorizationRule(string resourceGroupName, string namespaceName, string eventHubName, str |
| | 469 | | { |
| 4 | 470 | | if (resourceGroupName == null) |
| | 471 | | { |
| 0 | 472 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 473 | | } |
| 4 | 474 | | if (namespaceName == null) |
| | 475 | | { |
| 0 | 476 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 477 | | } |
| 4 | 478 | | if (eventHubName == null) |
| | 479 | | { |
| 0 | 480 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 481 | | } |
| 4 | 482 | | if (authorizationRuleName == null) |
| | 483 | | { |
| 0 | 484 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 485 | | } |
| | 486 | |
|
| 4 | 487 | | using var message = CreateDeleteAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubName, aut |
| 4 | 488 | | _pipeline.Send(message, cancellationToken); |
| 4 | 489 | | switch (message.Response.Status) |
| | 490 | | { |
| | 491 | | case 200: |
| | 492 | | case 204: |
| 4 | 493 | | return message.Response; |
| | 494 | | default: |
| 0 | 495 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 496 | | } |
| 4 | 497 | | } |
| | 498 | |
|
| | 499 | | internal HttpMessage CreateListKeysRequest(string resourceGroupName, string namespaceName, string eventHubName, |
| | 500 | | { |
| 8 | 501 | | var message = _pipeline.CreateMessage(); |
| 8 | 502 | | var request = message.Request; |
| 8 | 503 | | request.Method = RequestMethod.Post; |
| 8 | 504 | | var uri = new RawRequestUriBuilder(); |
| 8 | 505 | | uri.Reset(endpoint); |
| 8 | 506 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 507 | | uri.AppendPath(subscriptionId, true); |
| 8 | 508 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 509 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 510 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 8 | 511 | | uri.AppendPath(namespaceName, true); |
| 8 | 512 | | uri.AppendPath("/eventhubs/", false); |
| 8 | 513 | | uri.AppendPath(eventHubName, true); |
| 8 | 514 | | uri.AppendPath("/authorizationRules/", false); |
| 8 | 515 | | uri.AppendPath(authorizationRuleName, true); |
| 8 | 516 | | uri.AppendPath("/listKeys", false); |
| 8 | 517 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 8 | 518 | | request.Uri = uri; |
| 8 | 519 | | return message; |
| | 520 | | } |
| | 521 | |
|
| | 522 | | /// <summary> Gets the ACS and SAS connection strings for the Event Hub. </summary> |
| | 523 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 524 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 525 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 526 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 527 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 528 | | public async Task<Response<AccessKeys>> ListKeysAsync(string resourceGroupName, string namespaceName, string eve |
| | 529 | | { |
| 4 | 530 | | if (resourceGroupName == null) |
| | 531 | | { |
| 0 | 532 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 533 | | } |
| 4 | 534 | | if (namespaceName == null) |
| | 535 | | { |
| 0 | 536 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 537 | | } |
| 4 | 538 | | if (eventHubName == null) |
| | 539 | | { |
| 0 | 540 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 541 | | } |
| 4 | 542 | | if (authorizationRuleName == null) |
| | 543 | | { |
| 0 | 544 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 545 | | } |
| | 546 | |
|
| 4 | 547 | | using var message = CreateListKeysRequest(resourceGroupName, namespaceName, eventHubName, authorizationRuleN |
| 4 | 548 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 549 | | switch (message.Response.Status) |
| | 550 | | { |
| | 551 | | case 200: |
| | 552 | | { |
| 4 | 553 | | AccessKeys value = default; |
| 4 | 554 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 555 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 556 | | { |
| 0 | 557 | | value = null; |
| | 558 | | } |
| | 559 | | else |
| | 560 | | { |
| 4 | 561 | | value = AccessKeys.DeserializeAccessKeys(document.RootElement); |
| | 562 | | } |
| 4 | 563 | | return Response.FromValue(value, message.Response); |
| | 564 | | } |
| | 565 | | default: |
| 0 | 566 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 567 | | } |
| 4 | 568 | | } |
| | 569 | |
|
| | 570 | | /// <summary> Gets the ACS and SAS connection strings for the Event Hub. </summary> |
| | 571 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 572 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 573 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 574 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 575 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 576 | | public Response<AccessKeys> ListKeys(string resourceGroupName, string namespaceName, string eventHubName, string |
| | 577 | | { |
| 4 | 578 | | if (resourceGroupName == null) |
| | 579 | | { |
| 0 | 580 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 581 | | } |
| 4 | 582 | | if (namespaceName == null) |
| | 583 | | { |
| 0 | 584 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 585 | | } |
| 4 | 586 | | if (eventHubName == null) |
| | 587 | | { |
| 0 | 588 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 589 | | } |
| 4 | 590 | | if (authorizationRuleName == null) |
| | 591 | | { |
| 0 | 592 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 593 | | } |
| | 594 | |
|
| 4 | 595 | | using var message = CreateListKeysRequest(resourceGroupName, namespaceName, eventHubName, authorizationRuleN |
| 4 | 596 | | _pipeline.Send(message, cancellationToken); |
| 4 | 597 | | switch (message.Response.Status) |
| | 598 | | { |
| | 599 | | case 200: |
| | 600 | | { |
| 4 | 601 | | AccessKeys value = default; |
| 4 | 602 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 603 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 604 | | { |
| 0 | 605 | | value = null; |
| | 606 | | } |
| | 607 | | else |
| | 608 | | { |
| 4 | 609 | | value = AccessKeys.DeserializeAccessKeys(document.RootElement); |
| | 610 | | } |
| 4 | 611 | | return Response.FromValue(value, message.Response); |
| | 612 | | } |
| | 613 | | default: |
| 0 | 614 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 615 | | } |
| 4 | 616 | | } |
| | 617 | |
|
| | 618 | | internal HttpMessage CreateRegenerateKeysRequest(string resourceGroupName, string namespaceName, string eventHub |
| | 619 | | { |
| 16 | 620 | | var message = _pipeline.CreateMessage(); |
| 16 | 621 | | var request = message.Request; |
| 16 | 622 | | request.Method = RequestMethod.Post; |
| 16 | 623 | | var uri = new RawRequestUriBuilder(); |
| 16 | 624 | | uri.Reset(endpoint); |
| 16 | 625 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 626 | | uri.AppendPath(subscriptionId, true); |
| 16 | 627 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 628 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 629 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 16 | 630 | | uri.AppendPath(namespaceName, true); |
| 16 | 631 | | uri.AppendPath("/eventhubs/", false); |
| 16 | 632 | | uri.AppendPath(eventHubName, true); |
| 16 | 633 | | uri.AppendPath("/authorizationRules/", false); |
| 16 | 634 | | uri.AppendPath(authorizationRuleName, true); |
| 16 | 635 | | uri.AppendPath("/regenerateKeys", false); |
| 16 | 636 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 16 | 637 | | request.Uri = uri; |
| 16 | 638 | | request.Headers.Add("Content-Type", "application/json"); |
| 16 | 639 | | var content = new Utf8JsonRequestContent(); |
| 16 | 640 | | content.JsonWriter.WriteObjectValue(parameters); |
| 16 | 641 | | request.Content = content; |
| 16 | 642 | | return message; |
| | 643 | | } |
| | 644 | |
|
| | 645 | | /// <summary> Regenerates the ACS and SAS connection strings for the Event Hub. </summary> |
| | 646 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 647 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 648 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 649 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 650 | | /// <param name="parameters"> Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/Secondary |
| | 651 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 652 | | public async Task<Response<AccessKeys>> RegenerateKeysAsync(string resourceGroupName, string namespaceName, stri |
| | 653 | | { |
| 8 | 654 | | if (resourceGroupName == null) |
| | 655 | | { |
| 0 | 656 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 657 | | } |
| 8 | 658 | | if (namespaceName == null) |
| | 659 | | { |
| 0 | 660 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 661 | | } |
| 8 | 662 | | if (eventHubName == null) |
| | 663 | | { |
| 0 | 664 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 665 | | } |
| 8 | 666 | | if (authorizationRuleName == null) |
| | 667 | | { |
| 0 | 668 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 669 | | } |
| 8 | 670 | | if (parameters == null) |
| | 671 | | { |
| 0 | 672 | | throw new ArgumentNullException(nameof(parameters)); |
| | 673 | | } |
| | 674 | |
|
| 8 | 675 | | using var message = CreateRegenerateKeysRequest(resourceGroupName, namespaceName, eventHubName, authorizatio |
| 8 | 676 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 8 | 677 | | switch (message.Response.Status) |
| | 678 | | { |
| | 679 | | case 200: |
| | 680 | | { |
| 8 | 681 | | AccessKeys value = default; |
| 8 | 682 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 8 | 683 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 684 | | { |
| 0 | 685 | | value = null; |
| | 686 | | } |
| | 687 | | else |
| | 688 | | { |
| 8 | 689 | | value = AccessKeys.DeserializeAccessKeys(document.RootElement); |
| | 690 | | } |
| 8 | 691 | | return Response.FromValue(value, message.Response); |
| | 692 | | } |
| | 693 | | default: |
| 0 | 694 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 695 | | } |
| 8 | 696 | | } |
| | 697 | |
|
| | 698 | | /// <summary> Regenerates the ACS and SAS connection strings for the Event Hub. </summary> |
| | 699 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 700 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 701 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 702 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 703 | | /// <param name="parameters"> Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/Secondary |
| | 704 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 705 | | public Response<AccessKeys> RegenerateKeys(string resourceGroupName, string namespaceName, string eventHubName, |
| | 706 | | { |
| 8 | 707 | | if (resourceGroupName == null) |
| | 708 | | { |
| 0 | 709 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 710 | | } |
| 8 | 711 | | if (namespaceName == null) |
| | 712 | | { |
| 0 | 713 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 714 | | } |
| 8 | 715 | | if (eventHubName == null) |
| | 716 | | { |
| 0 | 717 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 718 | | } |
| 8 | 719 | | if (authorizationRuleName == null) |
| | 720 | | { |
| 0 | 721 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 722 | | } |
| 8 | 723 | | if (parameters == null) |
| | 724 | | { |
| 0 | 725 | | throw new ArgumentNullException(nameof(parameters)); |
| | 726 | | } |
| | 727 | |
|
| 8 | 728 | | using var message = CreateRegenerateKeysRequest(resourceGroupName, namespaceName, eventHubName, authorizatio |
| 8 | 729 | | _pipeline.Send(message, cancellationToken); |
| 8 | 730 | | switch (message.Response.Status) |
| | 731 | | { |
| | 732 | | case 200: |
| | 733 | | { |
| 8 | 734 | | AccessKeys value = default; |
| 8 | 735 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 8 | 736 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 737 | | { |
| 0 | 738 | | value = null; |
| | 739 | | } |
| | 740 | | else |
| | 741 | | { |
| 8 | 742 | | value = AccessKeys.DeserializeAccessKeys(document.RootElement); |
| | 743 | | } |
| 8 | 744 | | return Response.FromValue(value, message.Response); |
| | 745 | | } |
| | 746 | | default: |
| 0 | 747 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 748 | | } |
| 8 | 749 | | } |
| | 750 | |
|
| | 751 | | internal HttpMessage CreateListByNamespaceRequest(string resourceGroupName, string namespaceName, int? skip, int |
| | 752 | | { |
| 12 | 753 | | var message = _pipeline.CreateMessage(); |
| 12 | 754 | | var request = message.Request; |
| 12 | 755 | | request.Method = RequestMethod.Get; |
| 12 | 756 | | var uri = new RawRequestUriBuilder(); |
| 12 | 757 | | uri.Reset(endpoint); |
| 12 | 758 | | uri.AppendPath("/subscriptions/", false); |
| 12 | 759 | | uri.AppendPath(subscriptionId, true); |
| 12 | 760 | | uri.AppendPath("/resourceGroups/", false); |
| 12 | 761 | | uri.AppendPath(resourceGroupName, true); |
| 12 | 762 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 12 | 763 | | uri.AppendPath(namespaceName, true); |
| 12 | 764 | | uri.AppendPath("/eventhubs", false); |
| 12 | 765 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 12 | 766 | | if (skip != null) |
| | 767 | | { |
| 4 | 768 | | uri.AppendQuery("$skip", skip.Value, true); |
| | 769 | | } |
| 12 | 770 | | if (top != null) |
| | 771 | | { |
| 4 | 772 | | uri.AppendQuery("$top", top.Value, true); |
| | 773 | | } |
| 12 | 774 | | request.Uri = uri; |
| 12 | 775 | | return message; |
| | 776 | | } |
| | 777 | |
|
| | 778 | | /// <summary> Gets all the Event Hubs in a Namespace. </summary> |
| | 779 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 780 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 781 | | /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo |
| | 782 | | /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param> |
| | 783 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 784 | | public async Task<Response<EventHubListResult>> ListByNamespaceAsync(string resourceGroupName, string namespaceN |
| | 785 | | { |
| 6 | 786 | | if (resourceGroupName == null) |
| | 787 | | { |
| 0 | 788 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 789 | | } |
| 6 | 790 | | if (namespaceName == null) |
| | 791 | | { |
| 0 | 792 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 793 | | } |
| | 794 | |
|
| 6 | 795 | | using var message = CreateListByNamespaceRequest(resourceGroupName, namespaceName, skip, top); |
| 6 | 796 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 6 | 797 | | switch (message.Response.Status) |
| | 798 | | { |
| | 799 | | case 200: |
| | 800 | | { |
| 6 | 801 | | EventHubListResult value = default; |
| 6 | 802 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 6 | 803 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 804 | | { |
| 0 | 805 | | value = null; |
| | 806 | | } |
| | 807 | | else |
| | 808 | | { |
| 6 | 809 | | value = EventHubListResult.DeserializeEventHubListResult(document.RootElement); |
| | 810 | | } |
| 6 | 811 | | return Response.FromValue(value, message.Response); |
| | 812 | | } |
| | 813 | | default: |
| 0 | 814 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 815 | | } |
| 6 | 816 | | } |
| | 817 | |
|
| | 818 | | /// <summary> Gets all the Event Hubs in a Namespace. </summary> |
| | 819 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 820 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 821 | | /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo |
| | 822 | | /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param> |
| | 823 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 824 | | public Response<EventHubListResult> ListByNamespace(string resourceGroupName, string namespaceName, int? skip = |
| | 825 | | { |
| 6 | 826 | | if (resourceGroupName == null) |
| | 827 | | { |
| 0 | 828 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 829 | | } |
| 6 | 830 | | if (namespaceName == null) |
| | 831 | | { |
| 0 | 832 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 833 | | } |
| | 834 | |
|
| 6 | 835 | | using var message = CreateListByNamespaceRequest(resourceGroupName, namespaceName, skip, top); |
| 6 | 836 | | _pipeline.Send(message, cancellationToken); |
| 6 | 837 | | switch (message.Response.Status) |
| | 838 | | { |
| | 839 | | case 200: |
| | 840 | | { |
| 6 | 841 | | EventHubListResult value = default; |
| 6 | 842 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 843 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 844 | | { |
| 0 | 845 | | value = null; |
| | 846 | | } |
| | 847 | | else |
| | 848 | | { |
| 6 | 849 | | value = EventHubListResult.DeserializeEventHubListResult(document.RootElement); |
| | 850 | | } |
| 6 | 851 | | return Response.FromValue(value, message.Response); |
| | 852 | | } |
| | 853 | | default: |
| 0 | 854 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 855 | | } |
| 6 | 856 | | } |
| | 857 | |
|
| | 858 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string namespaceName, string eventHub |
| | 859 | | { |
| 64 | 860 | | var message = _pipeline.CreateMessage(); |
| 64 | 861 | | var request = message.Request; |
| 64 | 862 | | request.Method = RequestMethod.Put; |
| 64 | 863 | | var uri = new RawRequestUriBuilder(); |
| 64 | 864 | | uri.Reset(endpoint); |
| 64 | 865 | | uri.AppendPath("/subscriptions/", false); |
| 64 | 866 | | uri.AppendPath(subscriptionId, true); |
| 64 | 867 | | uri.AppendPath("/resourceGroups/", false); |
| 64 | 868 | | uri.AppendPath(resourceGroupName, true); |
| 64 | 869 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 64 | 870 | | uri.AppendPath(namespaceName, true); |
| 64 | 871 | | uri.AppendPath("/eventhubs/", false); |
| 64 | 872 | | uri.AppendPath(eventHubName, true); |
| 64 | 873 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 64 | 874 | | request.Uri = uri; |
| 64 | 875 | | request.Headers.Add("Content-Type", "application/json"); |
| 64 | 876 | | var content = new Utf8JsonRequestContent(); |
| 64 | 877 | | content.JsonWriter.WriteObjectValue(parameters); |
| 64 | 878 | | request.Content = content; |
| 64 | 879 | | return message; |
| | 880 | | } |
| | 881 | |
|
| | 882 | | /// <summary> Creates or updates a new Event Hub as a nested resource within a Namespace. </summary> |
| | 883 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 884 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 885 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 886 | | /// <param name="parameters"> Parameters supplied to create an Event Hub resource. </param> |
| | 887 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 888 | | public async Task<Response<Eventhub>> CreateOrUpdateAsync(string resourceGroupName, string namespaceName, string |
| | 889 | | { |
| 32 | 890 | | if (resourceGroupName == null) |
| | 891 | | { |
| 0 | 892 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 893 | | } |
| 32 | 894 | | if (namespaceName == null) |
| | 895 | | { |
| 0 | 896 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 897 | | } |
| 32 | 898 | | if (eventHubName == null) |
| | 899 | | { |
| 0 | 900 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 901 | | } |
| 32 | 902 | | if (parameters == null) |
| | 903 | | { |
| 0 | 904 | | throw new ArgumentNullException(nameof(parameters)); |
| | 905 | | } |
| | 906 | |
|
| 32 | 907 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, namespaceName, eventHubName, parameters); |
| 32 | 908 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 32 | 909 | | switch (message.Response.Status) |
| | 910 | | { |
| | 911 | | case 200: |
| | 912 | | { |
| 32 | 913 | | Eventhub value = default; |
| 32 | 914 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 32 | 915 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 916 | | { |
| 0 | 917 | | value = null; |
| | 918 | | } |
| | 919 | | else |
| | 920 | | { |
| 32 | 921 | | value = Eventhub.DeserializeEventhub(document.RootElement); |
| | 922 | | } |
| 32 | 923 | | return Response.FromValue(value, message.Response); |
| | 924 | | } |
| | 925 | | default: |
| 0 | 926 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 927 | | } |
| 32 | 928 | | } |
| | 929 | |
|
| | 930 | | /// <summary> Creates or updates a new Event Hub as a nested resource within a Namespace. </summary> |
| | 931 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 932 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 933 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 934 | | /// <param name="parameters"> Parameters supplied to create an Event Hub resource. </param> |
| | 935 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 936 | | public Response<Eventhub> CreateOrUpdate(string resourceGroupName, string namespaceName, string eventHubName, Ev |
| | 937 | | { |
| 32 | 938 | | if (resourceGroupName == null) |
| | 939 | | { |
| 0 | 940 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 941 | | } |
| 32 | 942 | | if (namespaceName == null) |
| | 943 | | { |
| 0 | 944 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 945 | | } |
| 32 | 946 | | if (eventHubName == null) |
| | 947 | | { |
| 0 | 948 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 949 | | } |
| 32 | 950 | | if (parameters == null) |
| | 951 | | { |
| 0 | 952 | | throw new ArgumentNullException(nameof(parameters)); |
| | 953 | | } |
| | 954 | |
|
| 32 | 955 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, namespaceName, eventHubName, parameters); |
| 32 | 956 | | _pipeline.Send(message, cancellationToken); |
| 32 | 957 | | switch (message.Response.Status) |
| | 958 | | { |
| | 959 | | case 200: |
| | 960 | | { |
| 32 | 961 | | Eventhub value = default; |
| 32 | 962 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 32 | 963 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 964 | | { |
| 0 | 965 | | value = null; |
| | 966 | | } |
| | 967 | | else |
| | 968 | | { |
| 32 | 969 | | value = Eventhub.DeserializeEventhub(document.RootElement); |
| | 970 | | } |
| 32 | 971 | | return Response.FromValue(value, message.Response); |
| | 972 | | } |
| | 973 | | default: |
| 0 | 974 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 975 | | } |
| 32 | 976 | | } |
| | 977 | |
|
| | 978 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string namespaceName, string eventHubName) |
| | 979 | | { |
| 20 | 980 | | var message = _pipeline.CreateMessage(); |
| 20 | 981 | | var request = message.Request; |
| 20 | 982 | | request.Method = RequestMethod.Delete; |
| 20 | 983 | | var uri = new RawRequestUriBuilder(); |
| 20 | 984 | | uri.Reset(endpoint); |
| 20 | 985 | | uri.AppendPath("/subscriptions/", false); |
| 20 | 986 | | uri.AppendPath(subscriptionId, true); |
| 20 | 987 | | uri.AppendPath("/resourceGroups/", false); |
| 20 | 988 | | uri.AppendPath(resourceGroupName, true); |
| 20 | 989 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 20 | 990 | | uri.AppendPath(namespaceName, true); |
| 20 | 991 | | uri.AppendPath("/eventhubs/", false); |
| 20 | 992 | | uri.AppendPath(eventHubName, true); |
| 20 | 993 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 20 | 994 | | request.Uri = uri; |
| 20 | 995 | | return message; |
| | 996 | | } |
| | 997 | |
|
| | 998 | | /// <summary> Deletes an Event Hub from the specified Namespace and resource group. </summary> |
| | 999 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1000 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1001 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 1002 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1003 | | public async Task<Response> DeleteAsync(string resourceGroupName, string namespaceName, string eventHubName, Can |
| | 1004 | | { |
| 10 | 1005 | | if (resourceGroupName == null) |
| | 1006 | | { |
| 0 | 1007 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1008 | | } |
| 10 | 1009 | | if (namespaceName == null) |
| | 1010 | | { |
| 0 | 1011 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1012 | | } |
| 10 | 1013 | | if (eventHubName == null) |
| | 1014 | | { |
| 0 | 1015 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 1016 | | } |
| | 1017 | |
|
| 10 | 1018 | | using var message = CreateDeleteRequest(resourceGroupName, namespaceName, eventHubName); |
| 10 | 1019 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 10 | 1020 | | switch (message.Response.Status) |
| | 1021 | | { |
| | 1022 | | case 200: |
| | 1023 | | case 204: |
| 10 | 1024 | | return message.Response; |
| | 1025 | | default: |
| 0 | 1026 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1027 | | } |
| 10 | 1028 | | } |
| | 1029 | |
|
| | 1030 | | /// <summary> Deletes an Event Hub from the specified Namespace and resource group. </summary> |
| | 1031 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1032 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1033 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 1034 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1035 | | public Response Delete(string resourceGroupName, string namespaceName, string eventHubName, CancellationToken ca |
| | 1036 | | { |
| 10 | 1037 | | if (resourceGroupName == null) |
| | 1038 | | { |
| 0 | 1039 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1040 | | } |
| 10 | 1041 | | if (namespaceName == null) |
| | 1042 | | { |
| 0 | 1043 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1044 | | } |
| 10 | 1045 | | if (eventHubName == null) |
| | 1046 | | { |
| 0 | 1047 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 1048 | | } |
| | 1049 | |
|
| 10 | 1050 | | using var message = CreateDeleteRequest(resourceGroupName, namespaceName, eventHubName); |
| 10 | 1051 | | _pipeline.Send(message, cancellationToken); |
| 10 | 1052 | | switch (message.Response.Status) |
| | 1053 | | { |
| | 1054 | | case 200: |
| | 1055 | | case 204: |
| 10 | 1056 | | return message.Response; |
| | 1057 | | default: |
| 0 | 1058 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1059 | | } |
| 10 | 1060 | | } |
| | 1061 | |
|
| | 1062 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string namespaceName, string eventHubName) |
| | 1063 | | { |
| 24 | 1064 | | var message = _pipeline.CreateMessage(); |
| 24 | 1065 | | var request = message.Request; |
| 24 | 1066 | | request.Method = RequestMethod.Get; |
| 24 | 1067 | | var uri = new RawRequestUriBuilder(); |
| 24 | 1068 | | uri.Reset(endpoint); |
| 24 | 1069 | | uri.AppendPath("/subscriptions/", false); |
| 24 | 1070 | | uri.AppendPath(subscriptionId, true); |
| 24 | 1071 | | uri.AppendPath("/resourceGroups/", false); |
| 24 | 1072 | | uri.AppendPath(resourceGroupName, true); |
| 24 | 1073 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 24 | 1074 | | uri.AppendPath(namespaceName, true); |
| 24 | 1075 | | uri.AppendPath("/eventhubs/", false); |
| 24 | 1076 | | uri.AppendPath(eventHubName, true); |
| 24 | 1077 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 24 | 1078 | | request.Uri = uri; |
| 24 | 1079 | | return message; |
| | 1080 | | } |
| | 1081 | |
|
| | 1082 | | /// <summary> Gets an Event Hubs description for the specified Event Hub. </summary> |
| | 1083 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1084 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1085 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 1086 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1087 | | public async Task<Response<Eventhub>> GetAsync(string resourceGroupName, string namespaceName, string eventHubNa |
| | 1088 | | { |
| 12 | 1089 | | if (resourceGroupName == null) |
| | 1090 | | { |
| 0 | 1091 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1092 | | } |
| 12 | 1093 | | if (namespaceName == null) |
| | 1094 | | { |
| 0 | 1095 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1096 | | } |
| 12 | 1097 | | if (eventHubName == null) |
| | 1098 | | { |
| 0 | 1099 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 1100 | | } |
| | 1101 | |
|
| 12 | 1102 | | using var message = CreateGetRequest(resourceGroupName, namespaceName, eventHubName); |
| 12 | 1103 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 12 | 1104 | | switch (message.Response.Status) |
| | 1105 | | { |
| | 1106 | | case 200: |
| | 1107 | | { |
| 12 | 1108 | | Eventhub value = default; |
| 12 | 1109 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 12 | 1110 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1111 | | { |
| 0 | 1112 | | value = null; |
| | 1113 | | } |
| | 1114 | | else |
| | 1115 | | { |
| 12 | 1116 | | value = Eventhub.DeserializeEventhub(document.RootElement); |
| | 1117 | | } |
| 12 | 1118 | | return Response.FromValue(value, message.Response); |
| | 1119 | | } |
| | 1120 | | default: |
| 0 | 1121 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1122 | | } |
| 12 | 1123 | | } |
| | 1124 | |
|
| | 1125 | | /// <summary> Gets an Event Hubs description for the specified Event Hub. </summary> |
| | 1126 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1127 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1128 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 1129 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1130 | | public Response<Eventhub> Get(string resourceGroupName, string namespaceName, string eventHubName, CancellationT |
| | 1131 | | { |
| 12 | 1132 | | if (resourceGroupName == null) |
| | 1133 | | { |
| 0 | 1134 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1135 | | } |
| 12 | 1136 | | if (namespaceName == null) |
| | 1137 | | { |
| 0 | 1138 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1139 | | } |
| 12 | 1140 | | if (eventHubName == null) |
| | 1141 | | { |
| 0 | 1142 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 1143 | | } |
| | 1144 | |
|
| 12 | 1145 | | using var message = CreateGetRequest(resourceGroupName, namespaceName, eventHubName); |
| 12 | 1146 | | _pipeline.Send(message, cancellationToken); |
| 12 | 1147 | | switch (message.Response.Status) |
| | 1148 | | { |
| | 1149 | | case 200: |
| | 1150 | | { |
| 12 | 1151 | | Eventhub value = default; |
| 12 | 1152 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 12 | 1153 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1154 | | { |
| 0 | 1155 | | value = null; |
| | 1156 | | } |
| | 1157 | | else |
| | 1158 | | { |
| 12 | 1159 | | value = Eventhub.DeserializeEventhub(document.RootElement); |
| | 1160 | | } |
| 12 | 1161 | | return Response.FromValue(value, message.Response); |
| | 1162 | | } |
| | 1163 | | default: |
| 0 | 1164 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1165 | | } |
| 12 | 1166 | | } |
| | 1167 | |
|
| | 1168 | | internal HttpMessage CreateListAuthorizationRulesNextPageRequest(string nextLink, string resourceGroupName, stri |
| | 1169 | | { |
| 0 | 1170 | | var message = _pipeline.CreateMessage(); |
| 0 | 1171 | | var request = message.Request; |
| 0 | 1172 | | request.Method = RequestMethod.Get; |
| 0 | 1173 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1174 | | uri.Reset(endpoint); |
| 0 | 1175 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1176 | | request.Uri = uri; |
| 0 | 1177 | | return message; |
| | 1178 | | } |
| | 1179 | |
|
| | 1180 | | /// <summary> Gets the authorization rules for an Event Hub. </summary> |
| | 1181 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1182 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1183 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1184 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 1185 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1186 | | public async Task<Response<AuthorizationRuleListResult>> ListAuthorizationRulesNextPageAsync(string nextLink, st |
| | 1187 | | { |
| 0 | 1188 | | if (nextLink == null) |
| | 1189 | | { |
| 0 | 1190 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1191 | | } |
| 0 | 1192 | | if (resourceGroupName == null) |
| | 1193 | | { |
| 0 | 1194 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1195 | | } |
| 0 | 1196 | | if (namespaceName == null) |
| | 1197 | | { |
| 0 | 1198 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1199 | | } |
| 0 | 1200 | | if (eventHubName == null) |
| | 1201 | | { |
| 0 | 1202 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 1203 | | } |
| | 1204 | |
|
| 0 | 1205 | | using var message = CreateListAuthorizationRulesNextPageRequest(nextLink, resourceGroupName, namespaceName, |
| 0 | 1206 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1207 | | switch (message.Response.Status) |
| | 1208 | | { |
| | 1209 | | case 200: |
| | 1210 | | { |
| 0 | 1211 | | AuthorizationRuleListResult value = default; |
| 0 | 1212 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1213 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1214 | | { |
| 0 | 1215 | | value = null; |
| | 1216 | | } |
| | 1217 | | else |
| | 1218 | | { |
| 0 | 1219 | | value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem |
| | 1220 | | } |
| 0 | 1221 | | return Response.FromValue(value, message.Response); |
| | 1222 | | } |
| | 1223 | | default: |
| 0 | 1224 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1225 | | } |
| 0 | 1226 | | } |
| | 1227 | |
|
| | 1228 | | /// <summary> Gets the authorization rules for an Event Hub. </summary> |
| | 1229 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1230 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1231 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1232 | | /// <param name="eventHubName"> The Event Hub name. </param> |
| | 1233 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1234 | | public Response<AuthorizationRuleListResult> ListAuthorizationRulesNextPage(string nextLink, string resourceGrou |
| | 1235 | | { |
| 0 | 1236 | | if (nextLink == null) |
| | 1237 | | { |
| 0 | 1238 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1239 | | } |
| 0 | 1240 | | if (resourceGroupName == null) |
| | 1241 | | { |
| 0 | 1242 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1243 | | } |
| 0 | 1244 | | if (namespaceName == null) |
| | 1245 | | { |
| 0 | 1246 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1247 | | } |
| 0 | 1248 | | if (eventHubName == null) |
| | 1249 | | { |
| 0 | 1250 | | throw new ArgumentNullException(nameof(eventHubName)); |
| | 1251 | | } |
| | 1252 | |
|
| 0 | 1253 | | using var message = CreateListAuthorizationRulesNextPageRequest(nextLink, resourceGroupName, namespaceName, |
| 0 | 1254 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1255 | | switch (message.Response.Status) |
| | 1256 | | { |
| | 1257 | | case 200: |
| | 1258 | | { |
| 0 | 1259 | | AuthorizationRuleListResult value = default; |
| 0 | 1260 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1261 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1262 | | { |
| 0 | 1263 | | value = null; |
| | 1264 | | } |
| | 1265 | | else |
| | 1266 | | { |
| 0 | 1267 | | value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem |
| | 1268 | | } |
| 0 | 1269 | | return Response.FromValue(value, message.Response); |
| | 1270 | | } |
| | 1271 | | default: |
| 0 | 1272 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1273 | | } |
| 0 | 1274 | | } |
| | 1275 | |
|
| | 1276 | | internal HttpMessage CreateListByNamespaceNextPageRequest(string nextLink, string resourceGroupName, string name |
| | 1277 | | { |
| 0 | 1278 | | var message = _pipeline.CreateMessage(); |
| 0 | 1279 | | var request = message.Request; |
| 0 | 1280 | | request.Method = RequestMethod.Get; |
| 0 | 1281 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1282 | | uri.Reset(endpoint); |
| 0 | 1283 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1284 | | request.Uri = uri; |
| 0 | 1285 | | return message; |
| | 1286 | | } |
| | 1287 | |
|
| | 1288 | | /// <summary> Gets all the Event Hubs in a Namespace. </summary> |
| | 1289 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1290 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1291 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1292 | | /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo |
| | 1293 | | /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param> |
| | 1294 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1295 | | public async Task<Response<EventHubListResult>> ListByNamespaceNextPageAsync(string nextLink, string resourceGro |
| | 1296 | | { |
| 0 | 1297 | | if (nextLink == null) |
| | 1298 | | { |
| 0 | 1299 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1300 | | } |
| 0 | 1301 | | if (resourceGroupName == null) |
| | 1302 | | { |
| 0 | 1303 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1304 | | } |
| 0 | 1305 | | if (namespaceName == null) |
| | 1306 | | { |
| 0 | 1307 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1308 | | } |
| | 1309 | |
|
| 0 | 1310 | | using var message = CreateListByNamespaceNextPageRequest(nextLink, resourceGroupName, namespaceName, skip, t |
| 0 | 1311 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1312 | | switch (message.Response.Status) |
| | 1313 | | { |
| | 1314 | | case 200: |
| | 1315 | | { |
| 0 | 1316 | | EventHubListResult value = default; |
| 0 | 1317 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1318 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1319 | | { |
| 0 | 1320 | | value = null; |
| | 1321 | | } |
| | 1322 | | else |
| | 1323 | | { |
| 0 | 1324 | | value = EventHubListResult.DeserializeEventHubListResult(document.RootElement); |
| | 1325 | | } |
| 0 | 1326 | | return Response.FromValue(value, message.Response); |
| | 1327 | | } |
| | 1328 | | default: |
| 0 | 1329 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1330 | | } |
| 0 | 1331 | | } |
| | 1332 | |
|
| | 1333 | | /// <summary> Gets all the Event Hubs in a Namespace. </summary> |
| | 1334 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1335 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1336 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1337 | | /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo |
| | 1338 | | /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param> |
| | 1339 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1340 | | public Response<EventHubListResult> ListByNamespaceNextPage(string nextLink, string resourceGroupName, string na |
| | 1341 | | { |
| 0 | 1342 | | if (nextLink == null) |
| | 1343 | | { |
| 0 | 1344 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1345 | | } |
| 0 | 1346 | | if (resourceGroupName == null) |
| | 1347 | | { |
| 0 | 1348 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1349 | | } |
| 0 | 1350 | | if (namespaceName == null) |
| | 1351 | | { |
| 0 | 1352 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1353 | | } |
| | 1354 | |
|
| 0 | 1355 | | using var message = CreateListByNamespaceNextPageRequest(nextLink, resourceGroupName, namespaceName, skip, t |
| 0 | 1356 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1357 | | switch (message.Response.Status) |
| | 1358 | | { |
| | 1359 | | case 200: |
| | 1360 | | { |
| 0 | 1361 | | EventHubListResult value = default; |
| 0 | 1362 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1363 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1364 | | { |
| 0 | 1365 | | value = null; |
| | 1366 | | } |
| | 1367 | | else |
| | 1368 | | { |
| 0 | 1369 | | value = EventHubListResult.DeserializeEventHubListResult(document.RootElement); |
| | 1370 | | } |
| 0 | 1371 | | return Response.FromValue(value, message.Response); |
| | 1372 | | } |
| | 1373 | | default: |
| 0 | 1374 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1375 | | } |
| 0 | 1376 | | } |
| | 1377 | | } |
| | 1378 | | } |