| | 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 NamespacesRestOperations |
| | 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 NamespacesRestOperations. </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 NamespacesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionI |
| | 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 CreateListIPFilterRulesRequest(string resourceGroupName, string namespaceName) |
| | 47 | | { |
| 0 | 48 | | var message = _pipeline.CreateMessage(); |
| 0 | 49 | | var request = message.Request; |
| 0 | 50 | | request.Method = RequestMethod.Get; |
| 0 | 51 | | var uri = new RawRequestUriBuilder(); |
| 0 | 52 | | uri.Reset(endpoint); |
| 0 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 54 | | uri.AppendPath(subscriptionId, true); |
| 0 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 57 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 0 | 58 | | uri.AppendPath(namespaceName, true); |
| 0 | 59 | | uri.AppendPath("/ipfilterrules", false); |
| 0 | 60 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 0 | 61 | | request.Uri = uri; |
| 0 | 62 | | return message; |
| | 63 | | } |
| | 64 | |
|
| | 65 | | /// <summary> Gets a list of IP Filter rules for a Namespace. </summary> |
| | 66 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 67 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 68 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 69 | | public async Task<Response<IpFilterRuleListResult>> ListIPFilterRulesAsync(string resourceGroupName, string name |
| | 70 | | { |
| 0 | 71 | | if (resourceGroupName == null) |
| | 72 | | { |
| 0 | 73 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 74 | | } |
| 0 | 75 | | if (namespaceName == null) |
| | 76 | | { |
| 0 | 77 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 78 | | } |
| | 79 | |
|
| 0 | 80 | | using var message = CreateListIPFilterRulesRequest(resourceGroupName, namespaceName); |
| 0 | 81 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 82 | | switch (message.Response.Status) |
| | 83 | | { |
| | 84 | | case 200: |
| | 85 | | { |
| 0 | 86 | | IpFilterRuleListResult value = default; |
| 0 | 87 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 88 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| 0 | 90 | | value = null; |
| | 91 | | } |
| | 92 | | else |
| | 93 | | { |
| 0 | 94 | | value = IpFilterRuleListResult.DeserializeIpFilterRuleListResult(document.RootElement); |
| | 95 | | } |
| 0 | 96 | | return Response.FromValue(value, message.Response); |
| | 97 | | } |
| | 98 | | default: |
| 0 | 99 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 100 | | } |
| 0 | 101 | | } |
| | 102 | |
|
| | 103 | | /// <summary> Gets a list of IP Filter rules for a Namespace. </summary> |
| | 104 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 105 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 106 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 107 | | public Response<IpFilterRuleListResult> ListIPFilterRules(string resourceGroupName, string namespaceName, Cancel |
| | 108 | | { |
| 0 | 109 | | if (resourceGroupName == null) |
| | 110 | | { |
| 0 | 111 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 112 | | } |
| 0 | 113 | | if (namespaceName == null) |
| | 114 | | { |
| 0 | 115 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 116 | | } |
| | 117 | |
|
| 0 | 118 | | using var message = CreateListIPFilterRulesRequest(resourceGroupName, namespaceName); |
| 0 | 119 | | _pipeline.Send(message, cancellationToken); |
| 0 | 120 | | switch (message.Response.Status) |
| | 121 | | { |
| | 122 | | case 200: |
| | 123 | | { |
| 0 | 124 | | IpFilterRuleListResult value = default; |
| 0 | 125 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 126 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 127 | | { |
| 0 | 128 | | value = null; |
| | 129 | | } |
| | 130 | | else |
| | 131 | | { |
| 0 | 132 | | value = IpFilterRuleListResult.DeserializeIpFilterRuleListResult(document.RootElement); |
| | 133 | | } |
| 0 | 134 | | return Response.FromValue(value, message.Response); |
| | 135 | | } |
| | 136 | | default: |
| 0 | 137 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 138 | | } |
| 0 | 139 | | } |
| | 140 | |
|
| | 141 | | internal HttpMessage CreateCreateOrUpdateIpFilterRuleRequest(string resourceGroupName, string namespaceName, str |
| | 142 | | { |
| 0 | 143 | | var message = _pipeline.CreateMessage(); |
| 0 | 144 | | var request = message.Request; |
| 0 | 145 | | request.Method = RequestMethod.Put; |
| 0 | 146 | | var uri = new RawRequestUriBuilder(); |
| 0 | 147 | | uri.Reset(endpoint); |
| 0 | 148 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 149 | | uri.AppendPath(subscriptionId, true); |
| 0 | 150 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 151 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 152 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 0 | 153 | | uri.AppendPath(namespaceName, true); |
| 0 | 154 | | uri.AppendPath("/ipfilterrules/", false); |
| 0 | 155 | | uri.AppendPath(ipFilterRuleName, true); |
| 0 | 156 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 0 | 157 | | request.Uri = uri; |
| 0 | 158 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 159 | | var content = new Utf8JsonRequestContent(); |
| 0 | 160 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 161 | | request.Content = content; |
| 0 | 162 | | return message; |
| | 163 | | } |
| | 164 | |
|
| | 165 | | /// <summary> Creates or updates an IpFilterRule for a Namespace. </summary> |
| | 166 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 167 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 168 | | /// <param name="ipFilterRuleName"> The IP Filter Rule name. </param> |
| | 169 | | /// <param name="parameters"> The Namespace IpFilterRule. </param> |
| | 170 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 171 | | public async Task<Response<IpFilterRule>> CreateOrUpdateIpFilterRuleAsync(string resourceGroupName, string names |
| | 172 | | { |
| 0 | 173 | | if (resourceGroupName == null) |
| | 174 | | { |
| 0 | 175 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 176 | | } |
| 0 | 177 | | if (namespaceName == null) |
| | 178 | | { |
| 0 | 179 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 180 | | } |
| 0 | 181 | | if (ipFilterRuleName == null) |
| | 182 | | { |
| 0 | 183 | | throw new ArgumentNullException(nameof(ipFilterRuleName)); |
| | 184 | | } |
| 0 | 185 | | if (parameters == null) |
| | 186 | | { |
| 0 | 187 | | throw new ArgumentNullException(nameof(parameters)); |
| | 188 | | } |
| | 189 | |
|
| 0 | 190 | | using var message = CreateCreateOrUpdateIpFilterRuleRequest(resourceGroupName, namespaceName, ipFilterRuleNa |
| 0 | 191 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 192 | | switch (message.Response.Status) |
| | 193 | | { |
| | 194 | | case 200: |
| | 195 | | { |
| 0 | 196 | | IpFilterRule value = default; |
| 0 | 197 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 198 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 199 | | { |
| 0 | 200 | | value = null; |
| | 201 | | } |
| | 202 | | else |
| | 203 | | { |
| 0 | 204 | | value = IpFilterRule.DeserializeIpFilterRule(document.RootElement); |
| | 205 | | } |
| 0 | 206 | | return Response.FromValue(value, message.Response); |
| | 207 | | } |
| | 208 | | default: |
| 0 | 209 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 210 | | } |
| 0 | 211 | | } |
| | 212 | |
|
| | 213 | | /// <summary> Creates or updates an IpFilterRule for a Namespace. </summary> |
| | 214 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 215 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 216 | | /// <param name="ipFilterRuleName"> The IP Filter Rule name. </param> |
| | 217 | | /// <param name="parameters"> The Namespace IpFilterRule. </param> |
| | 218 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 219 | | public Response<IpFilterRule> CreateOrUpdateIpFilterRule(string resourceGroupName, string namespaceName, string |
| | 220 | | { |
| 0 | 221 | | if (resourceGroupName == null) |
| | 222 | | { |
| 0 | 223 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 224 | | } |
| 0 | 225 | | if (namespaceName == null) |
| | 226 | | { |
| 0 | 227 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 228 | | } |
| 0 | 229 | | if (ipFilterRuleName == null) |
| | 230 | | { |
| 0 | 231 | | throw new ArgumentNullException(nameof(ipFilterRuleName)); |
| | 232 | | } |
| 0 | 233 | | if (parameters == null) |
| | 234 | | { |
| 0 | 235 | | throw new ArgumentNullException(nameof(parameters)); |
| | 236 | | } |
| | 237 | |
|
| 0 | 238 | | using var message = CreateCreateOrUpdateIpFilterRuleRequest(resourceGroupName, namespaceName, ipFilterRuleNa |
| 0 | 239 | | _pipeline.Send(message, cancellationToken); |
| 0 | 240 | | switch (message.Response.Status) |
| | 241 | | { |
| | 242 | | case 200: |
| | 243 | | { |
| 0 | 244 | | IpFilterRule value = default; |
| 0 | 245 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 246 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 247 | | { |
| 0 | 248 | | value = null; |
| | 249 | | } |
| | 250 | | else |
| | 251 | | { |
| 0 | 252 | | value = IpFilterRule.DeserializeIpFilterRule(document.RootElement); |
| | 253 | | } |
| 0 | 254 | | return Response.FromValue(value, message.Response); |
| | 255 | | } |
| | 256 | | default: |
| 0 | 257 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 258 | | } |
| 0 | 259 | | } |
| | 260 | |
|
| | 261 | | internal HttpMessage CreateDeleteIpFilterRuleRequest(string resourceGroupName, string namespaceName, string ipFi |
| | 262 | | { |
| 0 | 263 | | var message = _pipeline.CreateMessage(); |
| 0 | 264 | | var request = message.Request; |
| 0 | 265 | | request.Method = RequestMethod.Delete; |
| 0 | 266 | | var uri = new RawRequestUriBuilder(); |
| 0 | 267 | | uri.Reset(endpoint); |
| 0 | 268 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 269 | | uri.AppendPath(subscriptionId, true); |
| 0 | 270 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 271 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 272 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 0 | 273 | | uri.AppendPath(namespaceName, true); |
| 0 | 274 | | uri.AppendPath("/ipfilterrules/", false); |
| 0 | 275 | | uri.AppendPath(ipFilterRuleName, true); |
| 0 | 276 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 0 | 277 | | request.Uri = uri; |
| 0 | 278 | | return message; |
| | 279 | | } |
| | 280 | |
|
| | 281 | | /// <summary> Deletes an IpFilterRule for a Namespace. </summary> |
| | 282 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 283 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 284 | | /// <param name="ipFilterRuleName"> The IP Filter Rule name. </param> |
| | 285 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 286 | | public async Task<Response> DeleteIpFilterRuleAsync(string resourceGroupName, string namespaceName, string ipFil |
| | 287 | | { |
| 0 | 288 | | if (resourceGroupName == null) |
| | 289 | | { |
| 0 | 290 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 291 | | } |
| 0 | 292 | | if (namespaceName == null) |
| | 293 | | { |
| 0 | 294 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 295 | | } |
| 0 | 296 | | if (ipFilterRuleName == null) |
| | 297 | | { |
| 0 | 298 | | throw new ArgumentNullException(nameof(ipFilterRuleName)); |
| | 299 | | } |
| | 300 | |
|
| 0 | 301 | | using var message = CreateDeleteIpFilterRuleRequest(resourceGroupName, namespaceName, ipFilterRuleName); |
| 0 | 302 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 303 | | switch (message.Response.Status) |
| | 304 | | { |
| | 305 | | case 200: |
| | 306 | | case 204: |
| 0 | 307 | | return message.Response; |
| | 308 | | default: |
| 0 | 309 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 310 | | } |
| 0 | 311 | | } |
| | 312 | |
|
| | 313 | | /// <summary> Deletes an IpFilterRule for a Namespace. </summary> |
| | 314 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 315 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 316 | | /// <param name="ipFilterRuleName"> The IP Filter Rule name. </param> |
| | 317 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 318 | | public Response DeleteIpFilterRule(string resourceGroupName, string namespaceName, string ipFilterRuleName, Canc |
| | 319 | | { |
| 0 | 320 | | if (resourceGroupName == null) |
| | 321 | | { |
| 0 | 322 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 323 | | } |
| 0 | 324 | | if (namespaceName == null) |
| | 325 | | { |
| 0 | 326 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 327 | | } |
| 0 | 328 | | if (ipFilterRuleName == null) |
| | 329 | | { |
| 0 | 330 | | throw new ArgumentNullException(nameof(ipFilterRuleName)); |
| | 331 | | } |
| | 332 | |
|
| 0 | 333 | | using var message = CreateDeleteIpFilterRuleRequest(resourceGroupName, namespaceName, ipFilterRuleName); |
| 0 | 334 | | _pipeline.Send(message, cancellationToken); |
| 0 | 335 | | switch (message.Response.Status) |
| | 336 | | { |
| | 337 | | case 200: |
| | 338 | | case 204: |
| 0 | 339 | | return message.Response; |
| | 340 | | default: |
| 0 | 341 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 342 | | } |
| 0 | 343 | | } |
| | 344 | |
|
| | 345 | | internal HttpMessage CreateGetIpFilterRuleRequest(string resourceGroupName, string namespaceName, string ipFilte |
| | 346 | | { |
| 0 | 347 | | var message = _pipeline.CreateMessage(); |
| 0 | 348 | | var request = message.Request; |
| 0 | 349 | | request.Method = RequestMethod.Get; |
| 0 | 350 | | var uri = new RawRequestUriBuilder(); |
| 0 | 351 | | uri.Reset(endpoint); |
| 0 | 352 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 353 | | uri.AppendPath(subscriptionId, true); |
| 0 | 354 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 355 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 356 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 0 | 357 | | uri.AppendPath(namespaceName, true); |
| 0 | 358 | | uri.AppendPath("/ipfilterrules/", false); |
| 0 | 359 | | uri.AppendPath(ipFilterRuleName, true); |
| 0 | 360 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 0 | 361 | | request.Uri = uri; |
| 0 | 362 | | return message; |
| | 363 | | } |
| | 364 | |
|
| | 365 | | /// <summary> Gets an IpFilterRule for a Namespace by rule name. </summary> |
| | 366 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 367 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 368 | | /// <param name="ipFilterRuleName"> The IP Filter Rule name. </param> |
| | 369 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 370 | | public async Task<Response<IpFilterRule>> GetIpFilterRuleAsync(string resourceGroupName, string namespaceName, s |
| | 371 | | { |
| 0 | 372 | | if (resourceGroupName == null) |
| | 373 | | { |
| 0 | 374 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 375 | | } |
| 0 | 376 | | if (namespaceName == null) |
| | 377 | | { |
| 0 | 378 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 379 | | } |
| 0 | 380 | | if (ipFilterRuleName == null) |
| | 381 | | { |
| 0 | 382 | | throw new ArgumentNullException(nameof(ipFilterRuleName)); |
| | 383 | | } |
| | 384 | |
|
| 0 | 385 | | using var message = CreateGetIpFilterRuleRequest(resourceGroupName, namespaceName, ipFilterRuleName); |
| 0 | 386 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 387 | | switch (message.Response.Status) |
| | 388 | | { |
| | 389 | | case 200: |
| | 390 | | { |
| 0 | 391 | | IpFilterRule value = default; |
| 0 | 392 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 393 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 394 | | { |
| 0 | 395 | | value = null; |
| | 396 | | } |
| | 397 | | else |
| | 398 | | { |
| 0 | 399 | | value = IpFilterRule.DeserializeIpFilterRule(document.RootElement); |
| | 400 | | } |
| 0 | 401 | | return Response.FromValue(value, message.Response); |
| | 402 | | } |
| | 403 | | default: |
| 0 | 404 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 405 | | } |
| 0 | 406 | | } |
| | 407 | |
|
| | 408 | | /// <summary> Gets an IpFilterRule for a Namespace by rule name. </summary> |
| | 409 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 410 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 411 | | /// <param name="ipFilterRuleName"> The IP Filter Rule name. </param> |
| | 412 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 413 | | public Response<IpFilterRule> GetIpFilterRule(string resourceGroupName, string namespaceName, string ipFilterRul |
| | 414 | | { |
| 0 | 415 | | if (resourceGroupName == null) |
| | 416 | | { |
| 0 | 417 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 418 | | } |
| 0 | 419 | | if (namespaceName == null) |
| | 420 | | { |
| 0 | 421 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 422 | | } |
| 0 | 423 | | if (ipFilterRuleName == null) |
| | 424 | | { |
| 0 | 425 | | throw new ArgumentNullException(nameof(ipFilterRuleName)); |
| | 426 | | } |
| | 427 | |
|
| 0 | 428 | | using var message = CreateGetIpFilterRuleRequest(resourceGroupName, namespaceName, ipFilterRuleName); |
| 0 | 429 | | _pipeline.Send(message, cancellationToken); |
| 0 | 430 | | switch (message.Response.Status) |
| | 431 | | { |
| | 432 | | case 200: |
| | 433 | | { |
| 0 | 434 | | IpFilterRule value = default; |
| 0 | 435 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 436 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 437 | | { |
| 0 | 438 | | value = null; |
| | 439 | | } |
| | 440 | | else |
| | 441 | | { |
| 0 | 442 | | value = IpFilterRule.DeserializeIpFilterRule(document.RootElement); |
| | 443 | | } |
| 0 | 444 | | return Response.FromValue(value, message.Response); |
| | 445 | | } |
| | 446 | | default: |
| 0 | 447 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 448 | | } |
| 0 | 449 | | } |
| | 450 | |
|
| | 451 | | internal HttpMessage CreateListRequest() |
| | 452 | | { |
| 4 | 453 | | var message = _pipeline.CreateMessage(); |
| 4 | 454 | | var request = message.Request; |
| 4 | 455 | | request.Method = RequestMethod.Get; |
| 4 | 456 | | var uri = new RawRequestUriBuilder(); |
| 4 | 457 | | uri.Reset(endpoint); |
| 4 | 458 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 459 | | uri.AppendPath(subscriptionId, true); |
| 4 | 460 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces", false); |
| 4 | 461 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 4 | 462 | | request.Uri = uri; |
| 4 | 463 | | return message; |
| | 464 | | } |
| | 465 | |
|
| | 466 | | /// <summary> Lists all the available Namespaces within a subscription, irrespective of the resource groups. </s |
| | 467 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 468 | | public async Task<Response<EHNamespaceListResult>> ListAsync(CancellationToken cancellationToken = default) |
| | 469 | | { |
| 2 | 470 | | using var message = CreateListRequest(); |
| 2 | 471 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 472 | | switch (message.Response.Status) |
| | 473 | | { |
| | 474 | | case 200: |
| | 475 | | { |
| 2 | 476 | | EHNamespaceListResult value = default; |
| 2 | 477 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 478 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 479 | | { |
| 0 | 480 | | value = null; |
| | 481 | | } |
| | 482 | | else |
| | 483 | | { |
| 2 | 484 | | value = EHNamespaceListResult.DeserializeEHNamespaceListResult(document.RootElement); |
| | 485 | | } |
| 2 | 486 | | return Response.FromValue(value, message.Response); |
| | 487 | | } |
| | 488 | | default: |
| 0 | 489 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 490 | | } |
| 2 | 491 | | } |
| | 492 | |
|
| | 493 | | /// <summary> Lists all the available Namespaces within a subscription, irrespective of the resource groups. </s |
| | 494 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 495 | | public Response<EHNamespaceListResult> List(CancellationToken cancellationToken = default) |
| | 496 | | { |
| 2 | 497 | | using var message = CreateListRequest(); |
| 2 | 498 | | _pipeline.Send(message, cancellationToken); |
| 2 | 499 | | switch (message.Response.Status) |
| | 500 | | { |
| | 501 | | case 200: |
| | 502 | | { |
| 2 | 503 | | EHNamespaceListResult value = default; |
| 2 | 504 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 505 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 506 | | { |
| 0 | 507 | | value = null; |
| | 508 | | } |
| | 509 | | else |
| | 510 | | { |
| 2 | 511 | | value = EHNamespaceListResult.DeserializeEHNamespaceListResult(document.RootElement); |
| | 512 | | } |
| 2 | 513 | | return Response.FromValue(value, message.Response); |
| | 514 | | } |
| | 515 | | default: |
| 0 | 516 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 517 | | } |
| 2 | 518 | | } |
| | 519 | |
|
| | 520 | | internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) |
| | 521 | | { |
| 8 | 522 | | var message = _pipeline.CreateMessage(); |
| 8 | 523 | | var request = message.Request; |
| 8 | 524 | | request.Method = RequestMethod.Get; |
| 8 | 525 | | var uri = new RawRequestUriBuilder(); |
| 8 | 526 | | uri.Reset(endpoint); |
| 8 | 527 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 528 | | uri.AppendPath(subscriptionId, true); |
| 8 | 529 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 530 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 531 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces", false); |
| 8 | 532 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 8 | 533 | | request.Uri = uri; |
| 8 | 534 | | return message; |
| | 535 | | } |
| | 536 | |
|
| | 537 | | /// <summary> Lists the available Namespaces within a resource group. </summary> |
| | 538 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 539 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 540 | | public async Task<Response<EHNamespaceListResult>> ListByResourceGroupAsync(string resourceGroupName, Cancellati |
| | 541 | | { |
| 4 | 542 | | if (resourceGroupName == null) |
| | 543 | | { |
| 0 | 544 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 545 | | } |
| | 546 | |
|
| 4 | 547 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 4 | 548 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 549 | | switch (message.Response.Status) |
| | 550 | | { |
| | 551 | | case 200: |
| | 552 | | { |
| 4 | 553 | | EHNamespaceListResult 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 = EHNamespaceListResult.DeserializeEHNamespaceListResult(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> Lists the available Namespaces within a resource group. </summary> |
| | 571 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 572 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 573 | | public Response<EHNamespaceListResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancellat |
| | 574 | | { |
| 4 | 575 | | if (resourceGroupName == null) |
| | 576 | | { |
| 0 | 577 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 578 | | } |
| | 579 | |
|
| 4 | 580 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 4 | 581 | | _pipeline.Send(message, cancellationToken); |
| 4 | 582 | | switch (message.Response.Status) |
| | 583 | | { |
| | 584 | | case 200: |
| | 585 | | { |
| 4 | 586 | | EHNamespaceListResult value = default; |
| 4 | 587 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 588 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 589 | | { |
| 0 | 590 | | value = null; |
| | 591 | | } |
| | 592 | | else |
| | 593 | | { |
| 4 | 594 | | value = EHNamespaceListResult.DeserializeEHNamespaceListResult(document.RootElement); |
| | 595 | | } |
| 4 | 596 | | return Response.FromValue(value, message.Response); |
| | 597 | | } |
| | 598 | | default: |
| 0 | 599 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 600 | | } |
| 4 | 601 | | } |
| | 602 | |
|
| | 603 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string namespaceName, EHNamespace par |
| | 604 | | { |
| 112 | 605 | | var message = _pipeline.CreateMessage(); |
| 112 | 606 | | var request = message.Request; |
| 112 | 607 | | request.Method = RequestMethod.Put; |
| 112 | 608 | | var uri = new RawRequestUriBuilder(); |
| 112 | 609 | | uri.Reset(endpoint); |
| 112 | 610 | | uri.AppendPath("/subscriptions/", false); |
| 112 | 611 | | uri.AppendPath(subscriptionId, true); |
| 112 | 612 | | uri.AppendPath("/resourceGroups/", false); |
| 112 | 613 | | uri.AppendPath(resourceGroupName, true); |
| 112 | 614 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 112 | 615 | | uri.AppendPath(namespaceName, true); |
| 112 | 616 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 112 | 617 | | request.Uri = uri; |
| 112 | 618 | | request.Headers.Add("Content-Type", "application/json"); |
| 112 | 619 | | var content = new Utf8JsonRequestContent(); |
| 112 | 620 | | content.JsonWriter.WriteObjectValue(parameters); |
| 112 | 621 | | request.Content = content; |
| 112 | 622 | | return message; |
| | 623 | | } |
| | 624 | |
|
| | 625 | | /// <summary> Creates or updates a namespace. Once created, this namespace's resource manifest is immutable |
| | 626 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 627 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 628 | | /// <param name="parameters"> Parameters for creating a namespace resource. </param> |
| | 629 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 630 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string namespaceName, EHNamespace para |
| | 631 | | { |
| 28 | 632 | | if (resourceGroupName == null) |
| | 633 | | { |
| 0 | 634 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 635 | | } |
| 28 | 636 | | if (namespaceName == null) |
| | 637 | | { |
| 0 | 638 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 639 | | } |
| 28 | 640 | | if (parameters == null) |
| | 641 | | { |
| 0 | 642 | | throw new ArgumentNullException(nameof(parameters)); |
| | 643 | | } |
| | 644 | |
|
| 28 | 645 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, namespaceName, parameters); |
| 28 | 646 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 28 | 647 | | switch (message.Response.Status) |
| | 648 | | { |
| | 649 | | case 200: |
| | 650 | | case 201: |
| | 651 | | case 202: |
| 28 | 652 | | return message.Response; |
| | 653 | | default: |
| 0 | 654 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 655 | | } |
| 28 | 656 | | } |
| | 657 | |
|
| | 658 | | /// <summary> Creates or updates a namespace. Once created, this namespace's resource manifest is immutable |
| | 659 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 660 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 661 | | /// <param name="parameters"> Parameters for creating a namespace resource. </param> |
| | 662 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 663 | | public Response CreateOrUpdate(string resourceGroupName, string namespaceName, EHNamespace parameters, Cancellat |
| | 664 | | { |
| 28 | 665 | | if (resourceGroupName == null) |
| | 666 | | { |
| 0 | 667 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 668 | | } |
| 28 | 669 | | if (namespaceName == null) |
| | 670 | | { |
| 0 | 671 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 672 | | } |
| 28 | 673 | | if (parameters == null) |
| | 674 | | { |
| 0 | 675 | | throw new ArgumentNullException(nameof(parameters)); |
| | 676 | | } |
| | 677 | |
|
| 28 | 678 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, namespaceName, parameters); |
| 28 | 679 | | _pipeline.Send(message, cancellationToken); |
| 28 | 680 | | switch (message.Response.Status) |
| | 681 | | { |
| | 682 | | case 200: |
| | 683 | | case 201: |
| | 684 | | case 202: |
| 28 | 685 | | return message.Response; |
| | 686 | | default: |
| 0 | 687 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 688 | | } |
| 28 | 689 | | } |
| | 690 | |
|
| | 691 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string namespaceName) |
| | 692 | | { |
| 96 | 693 | | var message = _pipeline.CreateMessage(); |
| 96 | 694 | | var request = message.Request; |
| 96 | 695 | | request.Method = RequestMethod.Delete; |
| 96 | 696 | | var uri = new RawRequestUriBuilder(); |
| 96 | 697 | | uri.Reset(endpoint); |
| 96 | 698 | | uri.AppendPath("/subscriptions/", false); |
| 96 | 699 | | uri.AppendPath(subscriptionId, true); |
| 96 | 700 | | uri.AppendPath("/resourceGroups/", false); |
| 96 | 701 | | uri.AppendPath(resourceGroupName, true); |
| 96 | 702 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 96 | 703 | | uri.AppendPath(namespaceName, true); |
| 96 | 704 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 96 | 705 | | request.Uri = uri; |
| 96 | 706 | | return message; |
| | 707 | | } |
| | 708 | |
|
| | 709 | | /// <summary> Deletes an existing namespace. This operation also removes all associated resources under the name |
| | 710 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 711 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 712 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 713 | | public async Task<Response> DeleteAsync(string resourceGroupName, string namespaceName, CancellationToken cancel |
| | 714 | | { |
| 24 | 715 | | if (resourceGroupName == null) |
| | 716 | | { |
| 0 | 717 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 718 | | } |
| 24 | 719 | | if (namespaceName == null) |
| | 720 | | { |
| 0 | 721 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 722 | | } |
| | 723 | |
|
| 24 | 724 | | using var message = CreateDeleteRequest(resourceGroupName, namespaceName); |
| 24 | 725 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 24 | 726 | | switch (message.Response.Status) |
| | 727 | | { |
| | 728 | | case 200: |
| | 729 | | case 202: |
| | 730 | | case 204: |
| 24 | 731 | | return message.Response; |
| | 732 | | default: |
| 0 | 733 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 734 | | } |
| 24 | 735 | | } |
| | 736 | |
|
| | 737 | | /// <summary> Deletes an existing namespace. This operation also removes all associated resources under the name |
| | 738 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 739 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 740 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 741 | | public Response Delete(string resourceGroupName, string namespaceName, CancellationToken cancellationToken = def |
| | 742 | | { |
| 24 | 743 | | if (resourceGroupName == null) |
| | 744 | | { |
| 0 | 745 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 746 | | } |
| 24 | 747 | | if (namespaceName == null) |
| | 748 | | { |
| 0 | 749 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 750 | | } |
| | 751 | |
|
| 24 | 752 | | using var message = CreateDeleteRequest(resourceGroupName, namespaceName); |
| 24 | 753 | | _pipeline.Send(message, cancellationToken); |
| 24 | 754 | | switch (message.Response.Status) |
| | 755 | | { |
| | 756 | | case 200: |
| | 757 | | case 202: |
| | 758 | | case 204: |
| 24 | 759 | | return message.Response; |
| | 760 | | default: |
| 0 | 761 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 762 | | } |
| 24 | 763 | | } |
| | 764 | |
|
| | 765 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string namespaceName) |
| | 766 | | { |
| 56 | 767 | | var message = _pipeline.CreateMessage(); |
| 56 | 768 | | var request = message.Request; |
| 56 | 769 | | request.Method = RequestMethod.Get; |
| 56 | 770 | | var uri = new RawRequestUriBuilder(); |
| 56 | 771 | | uri.Reset(endpoint); |
| 56 | 772 | | uri.AppendPath("/subscriptions/", false); |
| 56 | 773 | | uri.AppendPath(subscriptionId, true); |
| 56 | 774 | | uri.AppendPath("/resourceGroups/", false); |
| 56 | 775 | | uri.AppendPath(resourceGroupName, true); |
| 56 | 776 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 56 | 777 | | uri.AppendPath(namespaceName, true); |
| 56 | 778 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 56 | 779 | | request.Uri = uri; |
| 56 | 780 | | return message; |
| | 781 | | } |
| | 782 | |
|
| | 783 | | /// <summary> Gets the description of the specified namespace. </summary> |
| | 784 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 785 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 786 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 787 | | public async Task<Response<EHNamespace>> GetAsync(string resourceGroupName, string namespaceName, CancellationTo |
| | 788 | | { |
| 28 | 789 | | if (resourceGroupName == null) |
| | 790 | | { |
| 0 | 791 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 792 | | } |
| 28 | 793 | | if (namespaceName == null) |
| | 794 | | { |
| 0 | 795 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 796 | | } |
| | 797 | |
|
| 28 | 798 | | using var message = CreateGetRequest(resourceGroupName, namespaceName); |
| 28 | 799 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 28 | 800 | | switch (message.Response.Status) |
| | 801 | | { |
| | 802 | | case 200: |
| | 803 | | case 201: |
| | 804 | | { |
| 28 | 805 | | EHNamespace value = default; |
| 28 | 806 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 28 | 807 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 808 | | { |
| 0 | 809 | | value = null; |
| | 810 | | } |
| | 811 | | else |
| | 812 | | { |
| 28 | 813 | | value = EHNamespace.DeserializeEHNamespace(document.RootElement); |
| | 814 | | } |
| 28 | 815 | | return Response.FromValue(value, message.Response); |
| | 816 | | } |
| | 817 | | default: |
| 0 | 818 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 819 | | } |
| 28 | 820 | | } |
| | 821 | |
|
| | 822 | | /// <summary> Gets the description of the specified namespace. </summary> |
| | 823 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 824 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 825 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 826 | | public Response<EHNamespace> Get(string resourceGroupName, string namespaceName, CancellationToken cancellationT |
| | 827 | | { |
| 28 | 828 | | if (resourceGroupName == null) |
| | 829 | | { |
| 0 | 830 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 831 | | } |
| 28 | 832 | | if (namespaceName == null) |
| | 833 | | { |
| 0 | 834 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 835 | | } |
| | 836 | |
|
| 28 | 837 | | using var message = CreateGetRequest(resourceGroupName, namespaceName); |
| 28 | 838 | | _pipeline.Send(message, cancellationToken); |
| 28 | 839 | | switch (message.Response.Status) |
| | 840 | | { |
| | 841 | | case 200: |
| | 842 | | case 201: |
| | 843 | | { |
| 28 | 844 | | EHNamespace value = default; |
| 28 | 845 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 28 | 846 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 847 | | { |
| 0 | 848 | | value = null; |
| | 849 | | } |
| | 850 | | else |
| | 851 | | { |
| 28 | 852 | | value = EHNamespace.DeserializeEHNamespace(document.RootElement); |
| | 853 | | } |
| 28 | 854 | | return Response.FromValue(value, message.Response); |
| | 855 | | } |
| | 856 | | default: |
| 0 | 857 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 858 | | } |
| 28 | 859 | | } |
| | 860 | |
|
| | 861 | | internal HttpMessage CreateUpdateRequest(string resourceGroupName, string namespaceName, EHNamespace parameters) |
| | 862 | | { |
| 8 | 863 | | var message = _pipeline.CreateMessage(); |
| 8 | 864 | | var request = message.Request; |
| 8 | 865 | | request.Method = RequestMethod.Patch; |
| 8 | 866 | | var uri = new RawRequestUriBuilder(); |
| 8 | 867 | | uri.Reset(endpoint); |
| 8 | 868 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 869 | | uri.AppendPath(subscriptionId, true); |
| 8 | 870 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 871 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 872 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 8 | 873 | | uri.AppendPath(namespaceName, true); |
| 8 | 874 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 8 | 875 | | request.Uri = uri; |
| 8 | 876 | | request.Headers.Add("Content-Type", "application/json"); |
| 8 | 877 | | var content = new Utf8JsonRequestContent(); |
| 8 | 878 | | content.JsonWriter.WriteObjectValue(parameters); |
| 8 | 879 | | request.Content = content; |
| 8 | 880 | | return message; |
| | 881 | | } |
| | 882 | |
|
| | 883 | | /// <summary> Creates or updates a namespace. Once created, this namespace's resource manifest is immutable |
| | 884 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 885 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 886 | | /// <param name="parameters"> Parameters for updating a namespace resource. </param> |
| | 887 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 888 | | public async Task<Response<EHNamespace>> UpdateAsync(string resourceGroupName, string namespaceName, EHNamespace |
| | 889 | | { |
| 4 | 890 | | if (resourceGroupName == null) |
| | 891 | | { |
| 0 | 892 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 893 | | } |
| 4 | 894 | | if (namespaceName == null) |
| | 895 | | { |
| 0 | 896 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 897 | | } |
| 4 | 898 | | if (parameters == null) |
| | 899 | | { |
| 0 | 900 | | throw new ArgumentNullException(nameof(parameters)); |
| | 901 | | } |
| | 902 | |
|
| 4 | 903 | | using var message = CreateUpdateRequest(resourceGroupName, namespaceName, parameters); |
| 4 | 904 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 905 | | switch (message.Response.Status) |
| | 906 | | { |
| | 907 | | case 200: |
| | 908 | | case 201: |
| | 909 | | { |
| 4 | 910 | | EHNamespace value = default; |
| 4 | 911 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 912 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 913 | | { |
| 0 | 914 | | value = null; |
| | 915 | | } |
| | 916 | | else |
| | 917 | | { |
| 4 | 918 | | value = EHNamespace.DeserializeEHNamespace(document.RootElement); |
| | 919 | | } |
| 4 | 920 | | return Response.FromValue(value, message.Response); |
| | 921 | | } |
| | 922 | | case 202: |
| 0 | 923 | | return Response.FromValue<EHNamespace>(null, message.Response); |
| | 924 | | default: |
| 0 | 925 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 926 | | } |
| 4 | 927 | | } |
| | 928 | |
|
| | 929 | | /// <summary> Creates or updates a namespace. Once created, this namespace's resource manifest is immutable |
| | 930 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 931 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 932 | | /// <param name="parameters"> Parameters for updating a namespace resource. </param> |
| | 933 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 934 | | public Response<EHNamespace> Update(string resourceGroupName, string namespaceName, EHNamespace parameters, Canc |
| | 935 | | { |
| 4 | 936 | | if (resourceGroupName == null) |
| | 937 | | { |
| 0 | 938 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 939 | | } |
| 4 | 940 | | if (namespaceName == null) |
| | 941 | | { |
| 0 | 942 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 943 | | } |
| 4 | 944 | | if (parameters == null) |
| | 945 | | { |
| 0 | 946 | | throw new ArgumentNullException(nameof(parameters)); |
| | 947 | | } |
| | 948 | |
|
| 4 | 949 | | using var message = CreateUpdateRequest(resourceGroupName, namespaceName, parameters); |
| 4 | 950 | | _pipeline.Send(message, cancellationToken); |
| 4 | 951 | | switch (message.Response.Status) |
| | 952 | | { |
| | 953 | | case 200: |
| | 954 | | case 201: |
| | 955 | | { |
| 4 | 956 | | EHNamespace value = default; |
| 4 | 957 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 958 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 959 | | { |
| 0 | 960 | | value = null; |
| | 961 | | } |
| | 962 | | else |
| | 963 | | { |
| 4 | 964 | | value = EHNamespace.DeserializeEHNamespace(document.RootElement); |
| | 965 | | } |
| 4 | 966 | | return Response.FromValue(value, message.Response); |
| | 967 | | } |
| | 968 | | case 202: |
| 0 | 969 | | return Response.FromValue<EHNamespace>(null, message.Response); |
| | 970 | | default: |
| 0 | 971 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 972 | | } |
| 4 | 973 | | } |
| | 974 | |
|
| | 975 | | internal HttpMessage CreateListVirtualNetworkRulesRequest(string resourceGroupName, string namespaceName) |
| | 976 | | { |
| 0 | 977 | | var message = _pipeline.CreateMessage(); |
| 0 | 978 | | var request = message.Request; |
| 0 | 979 | | request.Method = RequestMethod.Get; |
| 0 | 980 | | var uri = new RawRequestUriBuilder(); |
| 0 | 981 | | uri.Reset(endpoint); |
| 0 | 982 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 983 | | uri.AppendPath(subscriptionId, true); |
| 0 | 984 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 985 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 986 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 0 | 987 | | uri.AppendPath(namespaceName, true); |
| 0 | 988 | | uri.AppendPath("/virtualnetworkrules", false); |
| 0 | 989 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 0 | 990 | | request.Uri = uri; |
| 0 | 991 | | return message; |
| | 992 | | } |
| | 993 | |
|
| | 994 | | /// <summary> Gets a list of VirtualNetwork rules for a Namespace. </summary> |
| | 995 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 996 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 997 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 998 | | public async Task<Response<VirtualNetworkRuleListResult>> ListVirtualNetworkRulesAsync(string resourceGroupName, |
| | 999 | | { |
| 0 | 1000 | | if (resourceGroupName == null) |
| | 1001 | | { |
| 0 | 1002 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1003 | | } |
| 0 | 1004 | | if (namespaceName == null) |
| | 1005 | | { |
| 0 | 1006 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1007 | | } |
| | 1008 | |
|
| 0 | 1009 | | using var message = CreateListVirtualNetworkRulesRequest(resourceGroupName, namespaceName); |
| 0 | 1010 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1011 | | switch (message.Response.Status) |
| | 1012 | | { |
| | 1013 | | case 200: |
| | 1014 | | { |
| 0 | 1015 | | VirtualNetworkRuleListResult value = default; |
| 0 | 1016 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1017 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1018 | | { |
| 0 | 1019 | | value = null; |
| | 1020 | | } |
| | 1021 | | else |
| | 1022 | | { |
| 0 | 1023 | | value = VirtualNetworkRuleListResult.DeserializeVirtualNetworkRuleListResult(document.RootEl |
| | 1024 | | } |
| 0 | 1025 | | return Response.FromValue(value, message.Response); |
| | 1026 | | } |
| | 1027 | | default: |
| 0 | 1028 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1029 | | } |
| 0 | 1030 | | } |
| | 1031 | |
|
| | 1032 | | /// <summary> Gets a list of VirtualNetwork rules for a Namespace. </summary> |
| | 1033 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1034 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1035 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1036 | | public Response<VirtualNetworkRuleListResult> ListVirtualNetworkRules(string resourceGroupName, string namespace |
| | 1037 | | { |
| 0 | 1038 | | if (resourceGroupName == null) |
| | 1039 | | { |
| 0 | 1040 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1041 | | } |
| 0 | 1042 | | if (namespaceName == null) |
| | 1043 | | { |
| 0 | 1044 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1045 | | } |
| | 1046 | |
|
| 0 | 1047 | | using var message = CreateListVirtualNetworkRulesRequest(resourceGroupName, namespaceName); |
| 0 | 1048 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1049 | | switch (message.Response.Status) |
| | 1050 | | { |
| | 1051 | | case 200: |
| | 1052 | | { |
| 0 | 1053 | | VirtualNetworkRuleListResult value = default; |
| 0 | 1054 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1055 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1056 | | { |
| 0 | 1057 | | value = null; |
| | 1058 | | } |
| | 1059 | | else |
| | 1060 | | { |
| 0 | 1061 | | value = VirtualNetworkRuleListResult.DeserializeVirtualNetworkRuleListResult(document.RootEl |
| | 1062 | | } |
| 0 | 1063 | | return Response.FromValue(value, message.Response); |
| | 1064 | | } |
| | 1065 | | default: |
| 0 | 1066 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1067 | | } |
| 0 | 1068 | | } |
| | 1069 | |
|
| | 1070 | | internal HttpMessage CreateCreateOrUpdateVirtualNetworkRuleRequest(string resourceGroupName, string namespaceNam |
| | 1071 | | { |
| 0 | 1072 | | var message = _pipeline.CreateMessage(); |
| 0 | 1073 | | var request = message.Request; |
| 0 | 1074 | | request.Method = RequestMethod.Put; |
| 0 | 1075 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1076 | | uri.Reset(endpoint); |
| 0 | 1077 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1078 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1079 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1080 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1081 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 0 | 1082 | | uri.AppendPath(namespaceName, true); |
| 0 | 1083 | | uri.AppendPath("/virtualnetworkrules/", false); |
| 0 | 1084 | | uri.AppendPath(virtualNetworkRuleName, true); |
| 0 | 1085 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 0 | 1086 | | request.Uri = uri; |
| 0 | 1087 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 1088 | | var content = new Utf8JsonRequestContent(); |
| 0 | 1089 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 1090 | | request.Content = content; |
| 0 | 1091 | | return message; |
| | 1092 | | } |
| | 1093 | |
|
| | 1094 | | /// <summary> Creates or updates an VirtualNetworkRule for a Namespace. </summary> |
| | 1095 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1096 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1097 | | /// <param name="virtualNetworkRuleName"> The Virtual Network Rule name. </param> |
| | 1098 | | /// <param name="parameters"> The Namespace VirtualNetworkRule. </param> |
| | 1099 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1100 | | public async Task<Response<VirtualNetworkRule>> CreateOrUpdateVirtualNetworkRuleAsync(string resourceGroupName, |
| | 1101 | | { |
| 0 | 1102 | | if (resourceGroupName == null) |
| | 1103 | | { |
| 0 | 1104 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1105 | | } |
| 0 | 1106 | | if (namespaceName == null) |
| | 1107 | | { |
| 0 | 1108 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1109 | | } |
| 0 | 1110 | | if (virtualNetworkRuleName == null) |
| | 1111 | | { |
| 0 | 1112 | | throw new ArgumentNullException(nameof(virtualNetworkRuleName)); |
| | 1113 | | } |
| 0 | 1114 | | if (parameters == null) |
| | 1115 | | { |
| 0 | 1116 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1117 | | } |
| | 1118 | |
|
| 0 | 1119 | | using var message = CreateCreateOrUpdateVirtualNetworkRuleRequest(resourceGroupName, namespaceName, virtualN |
| 0 | 1120 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1121 | | switch (message.Response.Status) |
| | 1122 | | { |
| | 1123 | | case 200: |
| | 1124 | | { |
| 0 | 1125 | | VirtualNetworkRule value = default; |
| 0 | 1126 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1127 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1128 | | { |
| 0 | 1129 | | value = null; |
| | 1130 | | } |
| | 1131 | | else |
| | 1132 | | { |
| 0 | 1133 | | value = VirtualNetworkRule.DeserializeVirtualNetworkRule(document.RootElement); |
| | 1134 | | } |
| 0 | 1135 | | return Response.FromValue(value, message.Response); |
| | 1136 | | } |
| | 1137 | | default: |
| 0 | 1138 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1139 | | } |
| 0 | 1140 | | } |
| | 1141 | |
|
| | 1142 | | /// <summary> Creates or updates an VirtualNetworkRule for a Namespace. </summary> |
| | 1143 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1144 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1145 | | /// <param name="virtualNetworkRuleName"> The Virtual Network Rule name. </param> |
| | 1146 | | /// <param name="parameters"> The Namespace VirtualNetworkRule. </param> |
| | 1147 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1148 | | public Response<VirtualNetworkRule> CreateOrUpdateVirtualNetworkRule(string resourceGroupName, string namespaceN |
| | 1149 | | { |
| 0 | 1150 | | if (resourceGroupName == null) |
| | 1151 | | { |
| 0 | 1152 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1153 | | } |
| 0 | 1154 | | if (namespaceName == null) |
| | 1155 | | { |
| 0 | 1156 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1157 | | } |
| 0 | 1158 | | if (virtualNetworkRuleName == null) |
| | 1159 | | { |
| 0 | 1160 | | throw new ArgumentNullException(nameof(virtualNetworkRuleName)); |
| | 1161 | | } |
| 0 | 1162 | | if (parameters == null) |
| | 1163 | | { |
| 0 | 1164 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1165 | | } |
| | 1166 | |
|
| 0 | 1167 | | using var message = CreateCreateOrUpdateVirtualNetworkRuleRequest(resourceGroupName, namespaceName, virtualN |
| 0 | 1168 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1169 | | switch (message.Response.Status) |
| | 1170 | | { |
| | 1171 | | case 200: |
| | 1172 | | { |
| 0 | 1173 | | VirtualNetworkRule value = default; |
| 0 | 1174 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1175 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1176 | | { |
| 0 | 1177 | | value = null; |
| | 1178 | | } |
| | 1179 | | else |
| | 1180 | | { |
| 0 | 1181 | | value = VirtualNetworkRule.DeserializeVirtualNetworkRule(document.RootElement); |
| | 1182 | | } |
| 0 | 1183 | | return Response.FromValue(value, message.Response); |
| | 1184 | | } |
| | 1185 | | default: |
| 0 | 1186 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1187 | | } |
| 0 | 1188 | | } |
| | 1189 | |
|
| | 1190 | | internal HttpMessage CreateDeleteVirtualNetworkRuleRequest(string resourceGroupName, string namespaceName, strin |
| | 1191 | | { |
| 0 | 1192 | | var message = _pipeline.CreateMessage(); |
| 0 | 1193 | | var request = message.Request; |
| 0 | 1194 | | request.Method = RequestMethod.Delete; |
| 0 | 1195 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1196 | | uri.Reset(endpoint); |
| 0 | 1197 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1198 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1199 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1200 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1201 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 0 | 1202 | | uri.AppendPath(namespaceName, true); |
| 0 | 1203 | | uri.AppendPath("/virtualnetworkrules/", false); |
| 0 | 1204 | | uri.AppendPath(virtualNetworkRuleName, true); |
| 0 | 1205 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 0 | 1206 | | request.Uri = uri; |
| 0 | 1207 | | return message; |
| | 1208 | | } |
| | 1209 | |
|
| | 1210 | | /// <summary> Deletes an VirtualNetworkRule for a Namespace. </summary> |
| | 1211 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1212 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1213 | | /// <param name="virtualNetworkRuleName"> The Virtual Network Rule name. </param> |
| | 1214 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1215 | | public async Task<Response> DeleteVirtualNetworkRuleAsync(string resourceGroupName, string namespaceName, string |
| | 1216 | | { |
| 0 | 1217 | | if (resourceGroupName == null) |
| | 1218 | | { |
| 0 | 1219 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1220 | | } |
| 0 | 1221 | | if (namespaceName == null) |
| | 1222 | | { |
| 0 | 1223 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1224 | | } |
| 0 | 1225 | | if (virtualNetworkRuleName == null) |
| | 1226 | | { |
| 0 | 1227 | | throw new ArgumentNullException(nameof(virtualNetworkRuleName)); |
| | 1228 | | } |
| | 1229 | |
|
| 0 | 1230 | | using var message = CreateDeleteVirtualNetworkRuleRequest(resourceGroupName, namespaceName, virtualNetworkRu |
| 0 | 1231 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1232 | | switch (message.Response.Status) |
| | 1233 | | { |
| | 1234 | | case 200: |
| | 1235 | | case 204: |
| 0 | 1236 | | return message.Response; |
| | 1237 | | default: |
| 0 | 1238 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1239 | | } |
| 0 | 1240 | | } |
| | 1241 | |
|
| | 1242 | | /// <summary> Deletes an VirtualNetworkRule for a Namespace. </summary> |
| | 1243 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1244 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1245 | | /// <param name="virtualNetworkRuleName"> The Virtual Network Rule name. </param> |
| | 1246 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1247 | | public Response DeleteVirtualNetworkRule(string resourceGroupName, string namespaceName, string virtualNetworkRu |
| | 1248 | | { |
| 0 | 1249 | | if (resourceGroupName == null) |
| | 1250 | | { |
| 0 | 1251 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1252 | | } |
| 0 | 1253 | | if (namespaceName == null) |
| | 1254 | | { |
| 0 | 1255 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1256 | | } |
| 0 | 1257 | | if (virtualNetworkRuleName == null) |
| | 1258 | | { |
| 0 | 1259 | | throw new ArgumentNullException(nameof(virtualNetworkRuleName)); |
| | 1260 | | } |
| | 1261 | |
|
| 0 | 1262 | | using var message = CreateDeleteVirtualNetworkRuleRequest(resourceGroupName, namespaceName, virtualNetworkRu |
| 0 | 1263 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1264 | | switch (message.Response.Status) |
| | 1265 | | { |
| | 1266 | | case 200: |
| | 1267 | | case 204: |
| 0 | 1268 | | return message.Response; |
| | 1269 | | default: |
| 0 | 1270 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1271 | | } |
| 0 | 1272 | | } |
| | 1273 | |
|
| | 1274 | | internal HttpMessage CreateGetVirtualNetworkRuleRequest(string resourceGroupName, string namespaceName, string v |
| | 1275 | | { |
| 0 | 1276 | | var message = _pipeline.CreateMessage(); |
| 0 | 1277 | | var request = message.Request; |
| 0 | 1278 | | request.Method = RequestMethod.Get; |
| 0 | 1279 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1280 | | uri.Reset(endpoint); |
| 0 | 1281 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1282 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1283 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1284 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1285 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 0 | 1286 | | uri.AppendPath(namespaceName, true); |
| 0 | 1287 | | uri.AppendPath("/virtualnetworkrules/", false); |
| 0 | 1288 | | uri.AppendPath(virtualNetworkRuleName, true); |
| 0 | 1289 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 0 | 1290 | | request.Uri = uri; |
| 0 | 1291 | | return message; |
| | 1292 | | } |
| | 1293 | |
|
| | 1294 | | /// <summary> Gets an VirtualNetworkRule for a Namespace by rule name. </summary> |
| | 1295 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1296 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1297 | | /// <param name="virtualNetworkRuleName"> The Virtual Network Rule name. </param> |
| | 1298 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1299 | | public async Task<Response<VirtualNetworkRule>> GetVirtualNetworkRuleAsync(string resourceGroupName, string name |
| | 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 | | } |
| 0 | 1309 | | if (virtualNetworkRuleName == null) |
| | 1310 | | { |
| 0 | 1311 | | throw new ArgumentNullException(nameof(virtualNetworkRuleName)); |
| | 1312 | | } |
| | 1313 | |
|
| 0 | 1314 | | using var message = CreateGetVirtualNetworkRuleRequest(resourceGroupName, namespaceName, virtualNetworkRuleN |
| 0 | 1315 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1316 | | switch (message.Response.Status) |
| | 1317 | | { |
| | 1318 | | case 200: |
| | 1319 | | { |
| 0 | 1320 | | VirtualNetworkRule value = default; |
| 0 | 1321 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1322 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1323 | | { |
| 0 | 1324 | | value = null; |
| | 1325 | | } |
| | 1326 | | else |
| | 1327 | | { |
| 0 | 1328 | | value = VirtualNetworkRule.DeserializeVirtualNetworkRule(document.RootElement); |
| | 1329 | | } |
| 0 | 1330 | | return Response.FromValue(value, message.Response); |
| | 1331 | | } |
| | 1332 | | default: |
| 0 | 1333 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1334 | | } |
| 0 | 1335 | | } |
| | 1336 | |
|
| | 1337 | | /// <summary> Gets an VirtualNetworkRule for a Namespace by rule name. </summary> |
| | 1338 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1339 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1340 | | /// <param name="virtualNetworkRuleName"> The Virtual Network Rule name. </param> |
| | 1341 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1342 | | public Response<VirtualNetworkRule> GetVirtualNetworkRule(string resourceGroupName, string namespaceName, string |
| | 1343 | | { |
| 0 | 1344 | | if (resourceGroupName == null) |
| | 1345 | | { |
| 0 | 1346 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1347 | | } |
| 0 | 1348 | | if (namespaceName == null) |
| | 1349 | | { |
| 0 | 1350 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1351 | | } |
| 0 | 1352 | | if (virtualNetworkRuleName == null) |
| | 1353 | | { |
| 0 | 1354 | | throw new ArgumentNullException(nameof(virtualNetworkRuleName)); |
| | 1355 | | } |
| | 1356 | |
|
| 0 | 1357 | | using var message = CreateGetVirtualNetworkRuleRequest(resourceGroupName, namespaceName, virtualNetworkRuleN |
| 0 | 1358 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1359 | | switch (message.Response.Status) |
| | 1360 | | { |
| | 1361 | | case 200: |
| | 1362 | | { |
| 0 | 1363 | | VirtualNetworkRule value = default; |
| 0 | 1364 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1365 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1366 | | { |
| 0 | 1367 | | value = null; |
| | 1368 | | } |
| | 1369 | | else |
| | 1370 | | { |
| 0 | 1371 | | value = VirtualNetworkRule.DeserializeVirtualNetworkRule(document.RootElement); |
| | 1372 | | } |
| 0 | 1373 | | return Response.FromValue(value, message.Response); |
| | 1374 | | } |
| | 1375 | | default: |
| 0 | 1376 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1377 | | } |
| 0 | 1378 | | } |
| | 1379 | |
|
| | 1380 | | internal HttpMessage CreateCreateOrUpdateNetworkRuleSetRequest(string resourceGroupName, string namespaceName, N |
| | 1381 | | { |
| 8 | 1382 | | var message = _pipeline.CreateMessage(); |
| 8 | 1383 | | var request = message.Request; |
| 8 | 1384 | | request.Method = RequestMethod.Put; |
| 8 | 1385 | | var uri = new RawRequestUriBuilder(); |
| 8 | 1386 | | uri.Reset(endpoint); |
| 8 | 1387 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 1388 | | uri.AppendPath(subscriptionId, true); |
| 8 | 1389 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 1390 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 1391 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 8 | 1392 | | uri.AppendPath(namespaceName, true); |
| 8 | 1393 | | uri.AppendPath("/networkRuleSets/default", false); |
| 8 | 1394 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 8 | 1395 | | request.Uri = uri; |
| 8 | 1396 | | request.Headers.Add("Content-Type", "application/json"); |
| 8 | 1397 | | var content = new Utf8JsonRequestContent(); |
| 8 | 1398 | | content.JsonWriter.WriteObjectValue(parameters); |
| 8 | 1399 | | request.Content = content; |
| 8 | 1400 | | return message; |
| | 1401 | | } |
| | 1402 | |
|
| | 1403 | | /// <summary> Create or update NetworkRuleSet for a Namespace. </summary> |
| | 1404 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1405 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1406 | | /// <param name="parameters"> The Namespace IpFilterRule. </param> |
| | 1407 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1408 | | public async Task<Response<NetworkRuleSet>> CreateOrUpdateNetworkRuleSetAsync(string resourceGroupName, string n |
| | 1409 | | { |
| 4 | 1410 | | if (resourceGroupName == null) |
| | 1411 | | { |
| 0 | 1412 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1413 | | } |
| 4 | 1414 | | if (namespaceName == null) |
| | 1415 | | { |
| 0 | 1416 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1417 | | } |
| 4 | 1418 | | if (parameters == null) |
| | 1419 | | { |
| 0 | 1420 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1421 | | } |
| | 1422 | |
|
| 4 | 1423 | | using var message = CreateCreateOrUpdateNetworkRuleSetRequest(resourceGroupName, namespaceName, parameters); |
| 4 | 1424 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 1425 | | switch (message.Response.Status) |
| | 1426 | | { |
| | 1427 | | case 200: |
| | 1428 | | { |
| 4 | 1429 | | NetworkRuleSet value = default; |
| 4 | 1430 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 1431 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1432 | | { |
| 0 | 1433 | | value = null; |
| | 1434 | | } |
| | 1435 | | else |
| | 1436 | | { |
| 4 | 1437 | | value = NetworkRuleSet.DeserializeNetworkRuleSet(document.RootElement); |
| | 1438 | | } |
| 4 | 1439 | | return Response.FromValue(value, message.Response); |
| | 1440 | | } |
| | 1441 | | default: |
| 0 | 1442 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1443 | | } |
| 4 | 1444 | | } |
| | 1445 | |
|
| | 1446 | | /// <summary> Create or update NetworkRuleSet for a Namespace. </summary> |
| | 1447 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1448 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1449 | | /// <param name="parameters"> The Namespace IpFilterRule. </param> |
| | 1450 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1451 | | public Response<NetworkRuleSet> CreateOrUpdateNetworkRuleSet(string resourceGroupName, string namespaceName, Net |
| | 1452 | | { |
| 4 | 1453 | | if (resourceGroupName == null) |
| | 1454 | | { |
| 0 | 1455 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1456 | | } |
| 4 | 1457 | | if (namespaceName == null) |
| | 1458 | | { |
| 0 | 1459 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1460 | | } |
| 4 | 1461 | | if (parameters == null) |
| | 1462 | | { |
| 0 | 1463 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1464 | | } |
| | 1465 | |
|
| 4 | 1466 | | using var message = CreateCreateOrUpdateNetworkRuleSetRequest(resourceGroupName, namespaceName, parameters); |
| 4 | 1467 | | _pipeline.Send(message, cancellationToken); |
| 4 | 1468 | | switch (message.Response.Status) |
| | 1469 | | { |
| | 1470 | | case 200: |
| | 1471 | | { |
| 4 | 1472 | | NetworkRuleSet value = default; |
| 4 | 1473 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 1474 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1475 | | { |
| 0 | 1476 | | value = null; |
| | 1477 | | } |
| | 1478 | | else |
| | 1479 | | { |
| 4 | 1480 | | value = NetworkRuleSet.DeserializeNetworkRuleSet(document.RootElement); |
| | 1481 | | } |
| 4 | 1482 | | return Response.FromValue(value, message.Response); |
| | 1483 | | } |
| | 1484 | | default: |
| 0 | 1485 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1486 | | } |
| 4 | 1487 | | } |
| | 1488 | |
|
| | 1489 | | internal HttpMessage CreateGetNetworkRuleSetRequest(string resourceGroupName, string namespaceName) |
| | 1490 | | { |
| 8 | 1491 | | var message = _pipeline.CreateMessage(); |
| 8 | 1492 | | var request = message.Request; |
| 8 | 1493 | | request.Method = RequestMethod.Get; |
| 8 | 1494 | | var uri = new RawRequestUriBuilder(); |
| 8 | 1495 | | uri.Reset(endpoint); |
| 8 | 1496 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 1497 | | uri.AppendPath(subscriptionId, true); |
| 8 | 1498 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 1499 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 1500 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 8 | 1501 | | uri.AppendPath(namespaceName, true); |
| 8 | 1502 | | uri.AppendPath("/networkRuleSets/default", false); |
| 8 | 1503 | | uri.AppendQuery("api-version", "2018-01-01-preview", true); |
| 8 | 1504 | | request.Uri = uri; |
| 8 | 1505 | | return message; |
| | 1506 | | } |
| | 1507 | |
|
| | 1508 | | /// <summary> Gets NetworkRuleSet for a Namespace. </summary> |
| | 1509 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1510 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1511 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1512 | | public async Task<Response<NetworkRuleSet>> GetNetworkRuleSetAsync(string resourceGroupName, string namespaceNam |
| | 1513 | | { |
| 4 | 1514 | | if (resourceGroupName == null) |
| | 1515 | | { |
| 0 | 1516 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1517 | | } |
| 4 | 1518 | | if (namespaceName == null) |
| | 1519 | | { |
| 0 | 1520 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1521 | | } |
| | 1522 | |
|
| 4 | 1523 | | using var message = CreateGetNetworkRuleSetRequest(resourceGroupName, namespaceName); |
| 4 | 1524 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 1525 | | switch (message.Response.Status) |
| | 1526 | | { |
| | 1527 | | case 200: |
| | 1528 | | { |
| 4 | 1529 | | NetworkRuleSet value = default; |
| 4 | 1530 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 1531 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1532 | | { |
| 0 | 1533 | | value = null; |
| | 1534 | | } |
| | 1535 | | else |
| | 1536 | | { |
| 4 | 1537 | | value = NetworkRuleSet.DeserializeNetworkRuleSet(document.RootElement); |
| | 1538 | | } |
| 4 | 1539 | | return Response.FromValue(value, message.Response); |
| | 1540 | | } |
| | 1541 | | default: |
| 0 | 1542 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1543 | | } |
| 4 | 1544 | | } |
| | 1545 | |
|
| | 1546 | | /// <summary> Gets NetworkRuleSet for a Namespace. </summary> |
| | 1547 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1548 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1549 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1550 | | public Response<NetworkRuleSet> GetNetworkRuleSet(string resourceGroupName, string namespaceName, CancellationTo |
| | 1551 | | { |
| 4 | 1552 | | if (resourceGroupName == null) |
| | 1553 | | { |
| 0 | 1554 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1555 | | } |
| 4 | 1556 | | if (namespaceName == null) |
| | 1557 | | { |
| 0 | 1558 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1559 | | } |
| | 1560 | |
|
| 4 | 1561 | | using var message = CreateGetNetworkRuleSetRequest(resourceGroupName, namespaceName); |
| 4 | 1562 | | _pipeline.Send(message, cancellationToken); |
| 4 | 1563 | | switch (message.Response.Status) |
| | 1564 | | { |
| | 1565 | | case 200: |
| | 1566 | | { |
| 4 | 1567 | | NetworkRuleSet value = default; |
| 4 | 1568 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 1569 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1570 | | { |
| 0 | 1571 | | value = null; |
| | 1572 | | } |
| | 1573 | | else |
| | 1574 | | { |
| 4 | 1575 | | value = NetworkRuleSet.DeserializeNetworkRuleSet(document.RootElement); |
| | 1576 | | } |
| 4 | 1577 | | return Response.FromValue(value, message.Response); |
| | 1578 | | } |
| | 1579 | | default: |
| 0 | 1580 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1581 | | } |
| 4 | 1582 | | } |
| | 1583 | |
|
| | 1584 | | internal HttpMessage CreateListAuthorizationRulesRequest(string resourceGroupName, string namespaceName) |
| | 1585 | | { |
| 4 | 1586 | | var message = _pipeline.CreateMessage(); |
| 4 | 1587 | | var request = message.Request; |
| 4 | 1588 | | request.Method = RequestMethod.Get; |
| 4 | 1589 | | var uri = new RawRequestUriBuilder(); |
| 4 | 1590 | | uri.Reset(endpoint); |
| 4 | 1591 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 1592 | | uri.AppendPath(subscriptionId, true); |
| 4 | 1593 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 1594 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 1595 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 4 | 1596 | | uri.AppendPath(namespaceName, true); |
| 4 | 1597 | | uri.AppendPath("/authorizationRules", false); |
| 4 | 1598 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 4 | 1599 | | request.Uri = uri; |
| 4 | 1600 | | return message; |
| | 1601 | | } |
| | 1602 | |
|
| | 1603 | | /// <summary> Gets a list of authorization rules for a Namespace. </summary> |
| | 1604 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1605 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1606 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1607 | | public async Task<Response<AuthorizationRuleListResult>> ListAuthorizationRulesAsync(string resourceGroupName, s |
| | 1608 | | { |
| 2 | 1609 | | if (resourceGroupName == null) |
| | 1610 | | { |
| 0 | 1611 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1612 | | } |
| 2 | 1613 | | if (namespaceName == null) |
| | 1614 | | { |
| 0 | 1615 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1616 | | } |
| | 1617 | |
|
| 2 | 1618 | | using var message = CreateListAuthorizationRulesRequest(resourceGroupName, namespaceName); |
| 2 | 1619 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 1620 | | switch (message.Response.Status) |
| | 1621 | | { |
| | 1622 | | case 200: |
| | 1623 | | { |
| 2 | 1624 | | AuthorizationRuleListResult value = default; |
| 2 | 1625 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 1626 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1627 | | { |
| 0 | 1628 | | value = null; |
| | 1629 | | } |
| | 1630 | | else |
| | 1631 | | { |
| 2 | 1632 | | value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem |
| | 1633 | | } |
| 2 | 1634 | | return Response.FromValue(value, message.Response); |
| | 1635 | | } |
| | 1636 | | default: |
| 0 | 1637 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1638 | | } |
| 2 | 1639 | | } |
| | 1640 | |
|
| | 1641 | | /// <summary> Gets a list of authorization rules for a Namespace. </summary> |
| | 1642 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1643 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1644 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1645 | | public Response<AuthorizationRuleListResult> ListAuthorizationRules(string resourceGroupName, string namespaceNa |
| | 1646 | | { |
| 2 | 1647 | | if (resourceGroupName == null) |
| | 1648 | | { |
| 0 | 1649 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1650 | | } |
| 2 | 1651 | | if (namespaceName == null) |
| | 1652 | | { |
| 0 | 1653 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1654 | | } |
| | 1655 | |
|
| 2 | 1656 | | using var message = CreateListAuthorizationRulesRequest(resourceGroupName, namespaceName); |
| 2 | 1657 | | _pipeline.Send(message, cancellationToken); |
| 2 | 1658 | | switch (message.Response.Status) |
| | 1659 | | { |
| | 1660 | | case 200: |
| | 1661 | | { |
| 2 | 1662 | | AuthorizationRuleListResult value = default; |
| 2 | 1663 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 1664 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1665 | | { |
| 0 | 1666 | | value = null; |
| | 1667 | | } |
| | 1668 | | else |
| | 1669 | | { |
| 2 | 1670 | | value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem |
| | 1671 | | } |
| 2 | 1672 | | return Response.FromValue(value, message.Response); |
| | 1673 | | } |
| | 1674 | | default: |
| 0 | 1675 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1676 | | } |
| 2 | 1677 | | } |
| | 1678 | |
|
| | 1679 | | internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string resourceGroupName, string namespaceName |
| | 1680 | | { |
| 16 | 1681 | | var message = _pipeline.CreateMessage(); |
| 16 | 1682 | | var request = message.Request; |
| 16 | 1683 | | request.Method = RequestMethod.Put; |
| 16 | 1684 | | var uri = new RawRequestUriBuilder(); |
| 16 | 1685 | | uri.Reset(endpoint); |
| 16 | 1686 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 1687 | | uri.AppendPath(subscriptionId, true); |
| 16 | 1688 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 1689 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 1690 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 16 | 1691 | | uri.AppendPath(namespaceName, true); |
| 16 | 1692 | | uri.AppendPath("/authorizationRules/", false); |
| 16 | 1693 | | uri.AppendPath(authorizationRuleName, true); |
| 16 | 1694 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 16 | 1695 | | request.Uri = uri; |
| 16 | 1696 | | request.Headers.Add("Content-Type", "application/json"); |
| 16 | 1697 | | var content = new Utf8JsonRequestContent(); |
| 16 | 1698 | | content.JsonWriter.WriteObjectValue(parameters); |
| 16 | 1699 | | request.Content = content; |
| 16 | 1700 | | return message; |
| | 1701 | | } |
| | 1702 | |
|
| | 1703 | | /// <summary> Creates or updates an AuthorizationRule for a Namespace. </summary> |
| | 1704 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1705 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1706 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 1707 | | /// <param name="parameters"> The shared access AuthorizationRule. </param> |
| | 1708 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1709 | | public async Task<Response<AuthorizationRule>> CreateOrUpdateAuthorizationRuleAsync(string resourceGroupName, st |
| | 1710 | | { |
| 8 | 1711 | | if (resourceGroupName == null) |
| | 1712 | | { |
| 0 | 1713 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1714 | | } |
| 8 | 1715 | | if (namespaceName == null) |
| | 1716 | | { |
| 0 | 1717 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1718 | | } |
| 8 | 1719 | | if (authorizationRuleName == null) |
| | 1720 | | { |
| 0 | 1721 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 1722 | | } |
| 8 | 1723 | | if (parameters == null) |
| | 1724 | | { |
| 0 | 1725 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1726 | | } |
| | 1727 | |
|
| 8 | 1728 | | using var message = CreateCreateOrUpdateAuthorizationRuleRequest(resourceGroupName, namespaceName, authoriza |
| 8 | 1729 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 8 | 1730 | | switch (message.Response.Status) |
| | 1731 | | { |
| | 1732 | | case 200: |
| | 1733 | | { |
| 8 | 1734 | | AuthorizationRule value = default; |
| 8 | 1735 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 8 | 1736 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1737 | | { |
| 0 | 1738 | | value = null; |
| | 1739 | | } |
| | 1740 | | else |
| | 1741 | | { |
| 8 | 1742 | | value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement); |
| | 1743 | | } |
| 8 | 1744 | | return Response.FromValue(value, message.Response); |
| | 1745 | | } |
| | 1746 | | default: |
| 0 | 1747 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1748 | | } |
| 8 | 1749 | | } |
| | 1750 | |
|
| | 1751 | | /// <summary> Creates or updates an AuthorizationRule for a Namespace. </summary> |
| | 1752 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1753 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1754 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 1755 | | /// <param name="parameters"> The shared access AuthorizationRule. </param> |
| | 1756 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1757 | | public Response<AuthorizationRule> CreateOrUpdateAuthorizationRule(string resourceGroupName, string namespaceNam |
| | 1758 | | { |
| 8 | 1759 | | if (resourceGroupName == null) |
| | 1760 | | { |
| 0 | 1761 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1762 | | } |
| 8 | 1763 | | if (namespaceName == null) |
| | 1764 | | { |
| 0 | 1765 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1766 | | } |
| 8 | 1767 | | if (authorizationRuleName == null) |
| | 1768 | | { |
| 0 | 1769 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 1770 | | } |
| 8 | 1771 | | if (parameters == null) |
| | 1772 | | { |
| 0 | 1773 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1774 | | } |
| | 1775 | |
|
| 8 | 1776 | | using var message = CreateCreateOrUpdateAuthorizationRuleRequest(resourceGroupName, namespaceName, authoriza |
| 8 | 1777 | | _pipeline.Send(message, cancellationToken); |
| 8 | 1778 | | switch (message.Response.Status) |
| | 1779 | | { |
| | 1780 | | case 200: |
| | 1781 | | { |
| 8 | 1782 | | AuthorizationRule value = default; |
| 8 | 1783 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 8 | 1784 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1785 | | { |
| 0 | 1786 | | value = null; |
| | 1787 | | } |
| | 1788 | | else |
| | 1789 | | { |
| 8 | 1790 | | value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement); |
| | 1791 | | } |
| 8 | 1792 | | return Response.FromValue(value, message.Response); |
| | 1793 | | } |
| | 1794 | | default: |
| 0 | 1795 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1796 | | } |
| 8 | 1797 | | } |
| | 1798 | |
|
| | 1799 | | internal HttpMessage CreateDeleteAuthorizationRuleRequest(string resourceGroupName, string namespaceName, string |
| | 1800 | | { |
| 4 | 1801 | | var message = _pipeline.CreateMessage(); |
| 4 | 1802 | | var request = message.Request; |
| 4 | 1803 | | request.Method = RequestMethod.Delete; |
| 4 | 1804 | | var uri = new RawRequestUriBuilder(); |
| 4 | 1805 | | uri.Reset(endpoint); |
| 4 | 1806 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 1807 | | uri.AppendPath(subscriptionId, true); |
| 4 | 1808 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 1809 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 1810 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 4 | 1811 | | uri.AppendPath(namespaceName, true); |
| 4 | 1812 | | uri.AppendPath("/authorizationRules/", false); |
| 4 | 1813 | | uri.AppendPath(authorizationRuleName, true); |
| 4 | 1814 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 4 | 1815 | | request.Uri = uri; |
| 4 | 1816 | | return message; |
| | 1817 | | } |
| | 1818 | |
|
| | 1819 | | /// <summary> Deletes an AuthorizationRule for a Namespace. </summary> |
| | 1820 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1821 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1822 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 1823 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1824 | | public async Task<Response> DeleteAuthorizationRuleAsync(string resourceGroupName, string namespaceName, string |
| | 1825 | | { |
| 2 | 1826 | | if (resourceGroupName == null) |
| | 1827 | | { |
| 0 | 1828 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1829 | | } |
| 2 | 1830 | | if (namespaceName == null) |
| | 1831 | | { |
| 0 | 1832 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1833 | | } |
| 2 | 1834 | | if (authorizationRuleName == null) |
| | 1835 | | { |
| 0 | 1836 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 1837 | | } |
| | 1838 | |
|
| 2 | 1839 | | using var message = CreateDeleteAuthorizationRuleRequest(resourceGroupName, namespaceName, authorizationRule |
| 2 | 1840 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 1841 | | switch (message.Response.Status) |
| | 1842 | | { |
| | 1843 | | case 200: |
| | 1844 | | case 204: |
| 2 | 1845 | | return message.Response; |
| | 1846 | | default: |
| 0 | 1847 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1848 | | } |
| 2 | 1849 | | } |
| | 1850 | |
|
| | 1851 | | /// <summary> Deletes an AuthorizationRule for a Namespace. </summary> |
| | 1852 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1853 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1854 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 1855 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1856 | | public Response DeleteAuthorizationRule(string resourceGroupName, string namespaceName, string authorizationRule |
| | 1857 | | { |
| 2 | 1858 | | if (resourceGroupName == null) |
| | 1859 | | { |
| 0 | 1860 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1861 | | } |
| 2 | 1862 | | if (namespaceName == null) |
| | 1863 | | { |
| 0 | 1864 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1865 | | } |
| 2 | 1866 | | if (authorizationRuleName == null) |
| | 1867 | | { |
| 0 | 1868 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 1869 | | } |
| | 1870 | |
|
| 2 | 1871 | | using var message = CreateDeleteAuthorizationRuleRequest(resourceGroupName, namespaceName, authorizationRule |
| 2 | 1872 | | _pipeline.Send(message, cancellationToken); |
| 2 | 1873 | | switch (message.Response.Status) |
| | 1874 | | { |
| | 1875 | | case 200: |
| | 1876 | | case 204: |
| 2 | 1877 | | return message.Response; |
| | 1878 | | default: |
| 0 | 1879 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1880 | | } |
| 2 | 1881 | | } |
| | 1882 | |
|
| | 1883 | | internal HttpMessage CreateGetAuthorizationRuleRequest(string resourceGroupName, string namespaceName, string au |
| | 1884 | | { |
| 20 | 1885 | | var message = _pipeline.CreateMessage(); |
| 20 | 1886 | | var request = message.Request; |
| 20 | 1887 | | request.Method = RequestMethod.Get; |
| 20 | 1888 | | var uri = new RawRequestUriBuilder(); |
| 20 | 1889 | | uri.Reset(endpoint); |
| 20 | 1890 | | uri.AppendPath("/subscriptions/", false); |
| 20 | 1891 | | uri.AppendPath(subscriptionId, true); |
| 20 | 1892 | | uri.AppendPath("/resourceGroups/", false); |
| 20 | 1893 | | uri.AppendPath(resourceGroupName, true); |
| 20 | 1894 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 20 | 1895 | | uri.AppendPath(namespaceName, true); |
| 20 | 1896 | | uri.AppendPath("/authorizationRules/", false); |
| 20 | 1897 | | uri.AppendPath(authorizationRuleName, true); |
| 20 | 1898 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 20 | 1899 | | request.Uri = uri; |
| 20 | 1900 | | return message; |
| | 1901 | | } |
| | 1902 | |
|
| | 1903 | | /// <summary> Gets an AuthorizationRule for a Namespace by rule name. </summary> |
| | 1904 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1905 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1906 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 1907 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1908 | | public async Task<Response<AuthorizationRule>> GetAuthorizationRuleAsync(string resourceGroupName, string namesp |
| | 1909 | | { |
| 10 | 1910 | | if (resourceGroupName == null) |
| | 1911 | | { |
| 0 | 1912 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1913 | | } |
| 10 | 1914 | | if (namespaceName == null) |
| | 1915 | | { |
| 0 | 1916 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1917 | | } |
| 10 | 1918 | | if (authorizationRuleName == null) |
| | 1919 | | { |
| 0 | 1920 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 1921 | | } |
| | 1922 | |
|
| 10 | 1923 | | using var message = CreateGetAuthorizationRuleRequest(resourceGroupName, namespaceName, authorizationRuleNam |
| 10 | 1924 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 10 | 1925 | | switch (message.Response.Status) |
| | 1926 | | { |
| | 1927 | | case 200: |
| | 1928 | | { |
| 10 | 1929 | | AuthorizationRule value = default; |
| 10 | 1930 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 10 | 1931 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1932 | | { |
| 0 | 1933 | | value = null; |
| | 1934 | | } |
| | 1935 | | else |
| | 1936 | | { |
| 10 | 1937 | | value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement); |
| | 1938 | | } |
| 10 | 1939 | | return Response.FromValue(value, message.Response); |
| | 1940 | | } |
| | 1941 | | default: |
| 0 | 1942 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1943 | | } |
| 10 | 1944 | | } |
| | 1945 | |
|
| | 1946 | | /// <summary> Gets an AuthorizationRule for a Namespace by rule name. </summary> |
| | 1947 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 1948 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 1949 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 1950 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1951 | | public Response<AuthorizationRule> GetAuthorizationRule(string resourceGroupName, string namespaceName, string a |
| | 1952 | | { |
| 10 | 1953 | | if (resourceGroupName == null) |
| | 1954 | | { |
| 0 | 1955 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1956 | | } |
| 10 | 1957 | | if (namespaceName == null) |
| | 1958 | | { |
| 0 | 1959 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 1960 | | } |
| 10 | 1961 | | if (authorizationRuleName == null) |
| | 1962 | | { |
| 0 | 1963 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 1964 | | } |
| | 1965 | |
|
| 10 | 1966 | | using var message = CreateGetAuthorizationRuleRequest(resourceGroupName, namespaceName, authorizationRuleNam |
| 10 | 1967 | | _pipeline.Send(message, cancellationToken); |
| 10 | 1968 | | switch (message.Response.Status) |
| | 1969 | | { |
| | 1970 | | case 200: |
| | 1971 | | { |
| 10 | 1972 | | AuthorizationRule value = default; |
| 10 | 1973 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 10 | 1974 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1975 | | { |
| 0 | 1976 | | value = null; |
| | 1977 | | } |
| | 1978 | | else |
| | 1979 | | { |
| 10 | 1980 | | value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement); |
| | 1981 | | } |
| 10 | 1982 | | return Response.FromValue(value, message.Response); |
| | 1983 | | } |
| | 1984 | | default: |
| 0 | 1985 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1986 | | } |
| 10 | 1987 | | } |
| | 1988 | |
|
| | 1989 | | internal HttpMessage CreateListKeysRequest(string resourceGroupName, string namespaceName, string authorizationR |
| | 1990 | | { |
| 12 | 1991 | | var message = _pipeline.CreateMessage(); |
| 12 | 1992 | | var request = message.Request; |
| 12 | 1993 | | request.Method = RequestMethod.Post; |
| 12 | 1994 | | var uri = new RawRequestUriBuilder(); |
| 12 | 1995 | | uri.Reset(endpoint); |
| 12 | 1996 | | uri.AppendPath("/subscriptions/", false); |
| 12 | 1997 | | uri.AppendPath(subscriptionId, true); |
| 12 | 1998 | | uri.AppendPath("/resourceGroups/", false); |
| 12 | 1999 | | uri.AppendPath(resourceGroupName, true); |
| 12 | 2000 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 12 | 2001 | | uri.AppendPath(namespaceName, true); |
| 12 | 2002 | | uri.AppendPath("/authorizationRules/", false); |
| 12 | 2003 | | uri.AppendPath(authorizationRuleName, true); |
| 12 | 2004 | | uri.AppendPath("/listKeys", false); |
| 12 | 2005 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 12 | 2006 | | request.Uri = uri; |
| 12 | 2007 | | return message; |
| | 2008 | | } |
| | 2009 | |
|
| | 2010 | | /// <summary> Gets the primary and secondary connection strings for the Namespace. </summary> |
| | 2011 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2012 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2013 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 2014 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2015 | | public async Task<Response<AccessKeys>> ListKeysAsync(string resourceGroupName, string namespaceName, string aut |
| | 2016 | | { |
| 6 | 2017 | | if (resourceGroupName == null) |
| | 2018 | | { |
| 0 | 2019 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2020 | | } |
| 6 | 2021 | | if (namespaceName == null) |
| | 2022 | | { |
| 0 | 2023 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2024 | | } |
| 6 | 2025 | | if (authorizationRuleName == null) |
| | 2026 | | { |
| 0 | 2027 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 2028 | | } |
| | 2029 | |
|
| 6 | 2030 | | using var message = CreateListKeysRequest(resourceGroupName, namespaceName, authorizationRuleName); |
| 6 | 2031 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 6 | 2032 | | switch (message.Response.Status) |
| | 2033 | | { |
| | 2034 | | case 200: |
| | 2035 | | { |
| 6 | 2036 | | AccessKeys value = default; |
| 6 | 2037 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 6 | 2038 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2039 | | { |
| 0 | 2040 | | value = null; |
| | 2041 | | } |
| | 2042 | | else |
| | 2043 | | { |
| 6 | 2044 | | value = AccessKeys.DeserializeAccessKeys(document.RootElement); |
| | 2045 | | } |
| 6 | 2046 | | return Response.FromValue(value, message.Response); |
| | 2047 | | } |
| | 2048 | | default: |
| 0 | 2049 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2050 | | } |
| 6 | 2051 | | } |
| | 2052 | |
|
| | 2053 | | /// <summary> Gets the primary and secondary connection strings for the Namespace. </summary> |
| | 2054 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2055 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2056 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 2057 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2058 | | public Response<AccessKeys> ListKeys(string resourceGroupName, string namespaceName, string authorizationRuleNam |
| | 2059 | | { |
| 6 | 2060 | | if (resourceGroupName == null) |
| | 2061 | | { |
| 0 | 2062 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2063 | | } |
| 6 | 2064 | | if (namespaceName == null) |
| | 2065 | | { |
| 0 | 2066 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2067 | | } |
| 6 | 2068 | | if (authorizationRuleName == null) |
| | 2069 | | { |
| 0 | 2070 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 2071 | | } |
| | 2072 | |
|
| 6 | 2073 | | using var message = CreateListKeysRequest(resourceGroupName, namespaceName, authorizationRuleName); |
| 6 | 2074 | | _pipeline.Send(message, cancellationToken); |
| 6 | 2075 | | switch (message.Response.Status) |
| | 2076 | | { |
| | 2077 | | case 200: |
| | 2078 | | { |
| 6 | 2079 | | AccessKeys value = default; |
| 6 | 2080 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 2081 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2082 | | { |
| 0 | 2083 | | value = null; |
| | 2084 | | } |
| | 2085 | | else |
| | 2086 | | { |
| 6 | 2087 | | value = AccessKeys.DeserializeAccessKeys(document.RootElement); |
| | 2088 | | } |
| 6 | 2089 | | return Response.FromValue(value, message.Response); |
| | 2090 | | } |
| | 2091 | | default: |
| 0 | 2092 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2093 | | } |
| 6 | 2094 | | } |
| | 2095 | |
|
| | 2096 | | internal HttpMessage CreateRegenerateKeysRequest(string resourceGroupName, string namespaceName, string authoriz |
| | 2097 | | { |
| 8 | 2098 | | var message = _pipeline.CreateMessage(); |
| 8 | 2099 | | var request = message.Request; |
| 8 | 2100 | | request.Method = RequestMethod.Post; |
| 8 | 2101 | | var uri = new RawRequestUriBuilder(); |
| 8 | 2102 | | uri.Reset(endpoint); |
| 8 | 2103 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 2104 | | uri.AppendPath(subscriptionId, true); |
| 8 | 2105 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 2106 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 2107 | | uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false); |
| 8 | 2108 | | uri.AppendPath(namespaceName, true); |
| 8 | 2109 | | uri.AppendPath("/authorizationRules/", false); |
| 8 | 2110 | | uri.AppendPath(authorizationRuleName, true); |
| 8 | 2111 | | uri.AppendPath("/regenerateKeys", false); |
| 8 | 2112 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 8 | 2113 | | request.Uri = uri; |
| 8 | 2114 | | request.Headers.Add("Content-Type", "application/json"); |
| 8 | 2115 | | var content = new Utf8JsonRequestContent(); |
| 8 | 2116 | | content.JsonWriter.WriteObjectValue(parameters); |
| 8 | 2117 | | request.Content = content; |
| 8 | 2118 | | return message; |
| | 2119 | | } |
| | 2120 | |
|
| | 2121 | | /// <summary> Regenerates the primary or secondary connection strings for the specified Namespace. </summary> |
| | 2122 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2123 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2124 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 2125 | | /// <param name="parameters"> Parameters required to regenerate the connection string. </param> |
| | 2126 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2127 | | public async Task<Response<AccessKeys>> RegenerateKeysAsync(string resourceGroupName, string namespaceName, stri |
| | 2128 | | { |
| 4 | 2129 | | if (resourceGroupName == null) |
| | 2130 | | { |
| 0 | 2131 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2132 | | } |
| 4 | 2133 | | if (namespaceName == null) |
| | 2134 | | { |
| 0 | 2135 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2136 | | } |
| 4 | 2137 | | if (authorizationRuleName == null) |
| | 2138 | | { |
| 0 | 2139 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 2140 | | } |
| 4 | 2141 | | if (parameters == null) |
| | 2142 | | { |
| 0 | 2143 | | throw new ArgumentNullException(nameof(parameters)); |
| | 2144 | | } |
| | 2145 | |
|
| 4 | 2146 | | using var message = CreateRegenerateKeysRequest(resourceGroupName, namespaceName, authorizationRuleName, par |
| 4 | 2147 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 2148 | | switch (message.Response.Status) |
| | 2149 | | { |
| | 2150 | | case 200: |
| | 2151 | | { |
| 4 | 2152 | | AccessKeys value = default; |
| 4 | 2153 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 2154 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2155 | | { |
| 0 | 2156 | | value = null; |
| | 2157 | | } |
| | 2158 | | else |
| | 2159 | | { |
| 4 | 2160 | | value = AccessKeys.DeserializeAccessKeys(document.RootElement); |
| | 2161 | | } |
| 4 | 2162 | | return Response.FromValue(value, message.Response); |
| | 2163 | | } |
| | 2164 | | default: |
| 0 | 2165 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2166 | | } |
| 4 | 2167 | | } |
| | 2168 | |
|
| | 2169 | | /// <summary> Regenerates the primary or secondary connection strings for the specified Namespace. </summary> |
| | 2170 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2171 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2172 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 2173 | | /// <param name="parameters"> Parameters required to regenerate the connection string. </param> |
| | 2174 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2175 | | public Response<AccessKeys> RegenerateKeys(string resourceGroupName, string namespaceName, string authorizationR |
| | 2176 | | { |
| 4 | 2177 | | if (resourceGroupName == null) |
| | 2178 | | { |
| 0 | 2179 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2180 | | } |
| 4 | 2181 | | if (namespaceName == null) |
| | 2182 | | { |
| 0 | 2183 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2184 | | } |
| 4 | 2185 | | if (authorizationRuleName == null) |
| | 2186 | | { |
| 0 | 2187 | | throw new ArgumentNullException(nameof(authorizationRuleName)); |
| | 2188 | | } |
| 4 | 2189 | | if (parameters == null) |
| | 2190 | | { |
| 0 | 2191 | | throw new ArgumentNullException(nameof(parameters)); |
| | 2192 | | } |
| | 2193 | |
|
| 4 | 2194 | | using var message = CreateRegenerateKeysRequest(resourceGroupName, namespaceName, authorizationRuleName, par |
| 4 | 2195 | | _pipeline.Send(message, cancellationToken); |
| 4 | 2196 | | switch (message.Response.Status) |
| | 2197 | | { |
| | 2198 | | case 200: |
| | 2199 | | { |
| 4 | 2200 | | AccessKeys value = default; |
| 4 | 2201 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 2202 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2203 | | { |
| 0 | 2204 | | value = null; |
| | 2205 | | } |
| | 2206 | | else |
| | 2207 | | { |
| 4 | 2208 | | value = AccessKeys.DeserializeAccessKeys(document.RootElement); |
| | 2209 | | } |
| 4 | 2210 | | return Response.FromValue(value, message.Response); |
| | 2211 | | } |
| | 2212 | | default: |
| 0 | 2213 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2214 | | } |
| 4 | 2215 | | } |
| | 2216 | |
|
| | 2217 | | internal HttpMessage CreateCheckNameAvailabilityRequest(CheckNameAvailabilityParameter parameters) |
| | 2218 | | { |
| 4 | 2219 | | var message = _pipeline.CreateMessage(); |
| 4 | 2220 | | var request = message.Request; |
| 4 | 2221 | | request.Method = RequestMethod.Post; |
| 4 | 2222 | | var uri = new RawRequestUriBuilder(); |
| 4 | 2223 | | uri.Reset(endpoint); |
| 4 | 2224 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 2225 | | uri.AppendPath(subscriptionId, true); |
| 4 | 2226 | | uri.AppendPath("/providers/Microsoft.EventHub/checkNameAvailability", false); |
| 4 | 2227 | | uri.AppendQuery("api-version", "2017-04-01", true); |
| 4 | 2228 | | request.Uri = uri; |
| 4 | 2229 | | request.Headers.Add("Content-Type", "application/json"); |
| 4 | 2230 | | var content = new Utf8JsonRequestContent(); |
| 4 | 2231 | | content.JsonWriter.WriteObjectValue(parameters); |
| 4 | 2232 | | request.Content = content; |
| 4 | 2233 | | return message; |
| | 2234 | | } |
| | 2235 | |
|
| | 2236 | | /// <summary> Check the give Namespace name availability. </summary> |
| | 2237 | | /// <param name="parameters"> Parameters to check availability of the given Namespace name. </param> |
| | 2238 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2239 | | public async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(CheckNameAvailabilityParamet |
| | 2240 | | { |
| 2 | 2241 | | if (parameters == null) |
| | 2242 | | { |
| 0 | 2243 | | throw new ArgumentNullException(nameof(parameters)); |
| | 2244 | | } |
| | 2245 | |
|
| 2 | 2246 | | using var message = CreateCheckNameAvailabilityRequest(parameters); |
| 2 | 2247 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 2248 | | switch (message.Response.Status) |
| | 2249 | | { |
| | 2250 | | case 200: |
| | 2251 | | { |
| 2 | 2252 | | CheckNameAvailabilityResult value = default; |
| 2 | 2253 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 2254 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2255 | | { |
| 0 | 2256 | | value = null; |
| | 2257 | | } |
| | 2258 | | else |
| | 2259 | | { |
| 2 | 2260 | | value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElem |
| | 2261 | | } |
| 2 | 2262 | | return Response.FromValue(value, message.Response); |
| | 2263 | | } |
| | 2264 | | default: |
| 0 | 2265 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2266 | | } |
| 2 | 2267 | | } |
| | 2268 | |
|
| | 2269 | | /// <summary> Check the give Namespace name availability. </summary> |
| | 2270 | | /// <param name="parameters"> Parameters to check availability of the given Namespace name. </param> |
| | 2271 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2272 | | public Response<CheckNameAvailabilityResult> CheckNameAvailability(CheckNameAvailabilityParameter parameters, Ca |
| | 2273 | | { |
| 2 | 2274 | | if (parameters == null) |
| | 2275 | | { |
| 0 | 2276 | | throw new ArgumentNullException(nameof(parameters)); |
| | 2277 | | } |
| | 2278 | |
|
| 2 | 2279 | | using var message = CreateCheckNameAvailabilityRequest(parameters); |
| 2 | 2280 | | _pipeline.Send(message, cancellationToken); |
| 2 | 2281 | | switch (message.Response.Status) |
| | 2282 | | { |
| | 2283 | | case 200: |
| | 2284 | | { |
| 2 | 2285 | | CheckNameAvailabilityResult value = default; |
| 2 | 2286 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 2287 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2288 | | { |
| 0 | 2289 | | value = null; |
| | 2290 | | } |
| | 2291 | | else |
| | 2292 | | { |
| 2 | 2293 | | value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElem |
| | 2294 | | } |
| 2 | 2295 | | return Response.FromValue(value, message.Response); |
| | 2296 | | } |
| | 2297 | | default: |
| 0 | 2298 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2299 | | } |
| 2 | 2300 | | } |
| | 2301 | |
|
| | 2302 | | internal HttpMessage CreateListIPFilterRulesNextPageRequest(string nextLink, string resourceGroupName, string na |
| | 2303 | | { |
| 0 | 2304 | | var message = _pipeline.CreateMessage(); |
| 0 | 2305 | | var request = message.Request; |
| 0 | 2306 | | request.Method = RequestMethod.Get; |
| 0 | 2307 | | var uri = new RawRequestUriBuilder(); |
| 0 | 2308 | | uri.Reset(endpoint); |
| 0 | 2309 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 2310 | | request.Uri = uri; |
| 0 | 2311 | | return message; |
| | 2312 | | } |
| | 2313 | |
|
| | 2314 | | /// <summary> Gets a list of IP Filter rules for a Namespace. </summary> |
| | 2315 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2316 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2317 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2318 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2319 | | public async Task<Response<IpFilterRuleListResult>> ListIPFilterRulesNextPageAsync(string nextLink, string resou |
| | 2320 | | { |
| 0 | 2321 | | if (nextLink == null) |
| | 2322 | | { |
| 0 | 2323 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2324 | | } |
| 0 | 2325 | | if (resourceGroupName == null) |
| | 2326 | | { |
| 0 | 2327 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2328 | | } |
| 0 | 2329 | | if (namespaceName == null) |
| | 2330 | | { |
| 0 | 2331 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2332 | | } |
| | 2333 | |
|
| 0 | 2334 | | using var message = CreateListIPFilterRulesNextPageRequest(nextLink, resourceGroupName, namespaceName); |
| 0 | 2335 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 2336 | | switch (message.Response.Status) |
| | 2337 | | { |
| | 2338 | | case 200: |
| | 2339 | | { |
| 0 | 2340 | | IpFilterRuleListResult value = default; |
| 0 | 2341 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 2342 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2343 | | { |
| 0 | 2344 | | value = null; |
| | 2345 | | } |
| | 2346 | | else |
| | 2347 | | { |
| 0 | 2348 | | value = IpFilterRuleListResult.DeserializeIpFilterRuleListResult(document.RootElement); |
| | 2349 | | } |
| 0 | 2350 | | return Response.FromValue(value, message.Response); |
| | 2351 | | } |
| | 2352 | | default: |
| 0 | 2353 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2354 | | } |
| 0 | 2355 | | } |
| | 2356 | |
|
| | 2357 | | /// <summary> Gets a list of IP Filter rules for a Namespace. </summary> |
| | 2358 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2359 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2360 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2361 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2362 | | public Response<IpFilterRuleListResult> ListIPFilterRulesNextPage(string nextLink, string resourceGroupName, str |
| | 2363 | | { |
| 0 | 2364 | | if (nextLink == null) |
| | 2365 | | { |
| 0 | 2366 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2367 | | } |
| 0 | 2368 | | if (resourceGroupName == null) |
| | 2369 | | { |
| 0 | 2370 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2371 | | } |
| 0 | 2372 | | if (namespaceName == null) |
| | 2373 | | { |
| 0 | 2374 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2375 | | } |
| | 2376 | |
|
| 0 | 2377 | | using var message = CreateListIPFilterRulesNextPageRequest(nextLink, resourceGroupName, namespaceName); |
| 0 | 2378 | | _pipeline.Send(message, cancellationToken); |
| 0 | 2379 | | switch (message.Response.Status) |
| | 2380 | | { |
| | 2381 | | case 200: |
| | 2382 | | { |
| 0 | 2383 | | IpFilterRuleListResult value = default; |
| 0 | 2384 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 2385 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2386 | | { |
| 0 | 2387 | | value = null; |
| | 2388 | | } |
| | 2389 | | else |
| | 2390 | | { |
| 0 | 2391 | | value = IpFilterRuleListResult.DeserializeIpFilterRuleListResult(document.RootElement); |
| | 2392 | | } |
| 0 | 2393 | | return Response.FromValue(value, message.Response); |
| | 2394 | | } |
| | 2395 | | default: |
| 0 | 2396 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2397 | | } |
| 0 | 2398 | | } |
| | 2399 | |
|
| | 2400 | | internal HttpMessage CreateListNextPageRequest(string nextLink) |
| | 2401 | | { |
| 0 | 2402 | | var message = _pipeline.CreateMessage(); |
| 0 | 2403 | | var request = message.Request; |
| 0 | 2404 | | request.Method = RequestMethod.Get; |
| 0 | 2405 | | var uri = new RawRequestUriBuilder(); |
| 0 | 2406 | | uri.Reset(endpoint); |
| 0 | 2407 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 2408 | | request.Uri = uri; |
| 0 | 2409 | | return message; |
| | 2410 | | } |
| | 2411 | |
|
| | 2412 | | /// <summary> Lists all the available Namespaces within a subscription, irrespective of the resource groups. </s |
| | 2413 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2414 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2415 | | public async Task<Response<EHNamespaceListResult>> ListNextPageAsync(string nextLink, CancellationToken cancella |
| | 2416 | | { |
| 0 | 2417 | | if (nextLink == null) |
| | 2418 | | { |
| 0 | 2419 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2420 | | } |
| | 2421 | |
|
| 0 | 2422 | | using var message = CreateListNextPageRequest(nextLink); |
| 0 | 2423 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 2424 | | switch (message.Response.Status) |
| | 2425 | | { |
| | 2426 | | case 200: |
| | 2427 | | { |
| 0 | 2428 | | EHNamespaceListResult value = default; |
| 0 | 2429 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 2430 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2431 | | { |
| 0 | 2432 | | value = null; |
| | 2433 | | } |
| | 2434 | | else |
| | 2435 | | { |
| 0 | 2436 | | value = EHNamespaceListResult.DeserializeEHNamespaceListResult(document.RootElement); |
| | 2437 | | } |
| 0 | 2438 | | return Response.FromValue(value, message.Response); |
| | 2439 | | } |
| | 2440 | | default: |
| 0 | 2441 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2442 | | } |
| 0 | 2443 | | } |
| | 2444 | |
|
| | 2445 | | /// <summary> Lists all the available Namespaces within a subscription, irrespective of the resource groups. </s |
| | 2446 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2447 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2448 | | public Response<EHNamespaceListResult> ListNextPage(string nextLink, CancellationToken cancellationToken = defau |
| | 2449 | | { |
| 0 | 2450 | | if (nextLink == null) |
| | 2451 | | { |
| 0 | 2452 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2453 | | } |
| | 2454 | |
|
| 0 | 2455 | | using var message = CreateListNextPageRequest(nextLink); |
| 0 | 2456 | | _pipeline.Send(message, cancellationToken); |
| 0 | 2457 | | switch (message.Response.Status) |
| | 2458 | | { |
| | 2459 | | case 200: |
| | 2460 | | { |
| 0 | 2461 | | EHNamespaceListResult value = default; |
| 0 | 2462 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 2463 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2464 | | { |
| 0 | 2465 | | value = null; |
| | 2466 | | } |
| | 2467 | | else |
| | 2468 | | { |
| 0 | 2469 | | value = EHNamespaceListResult.DeserializeEHNamespaceListResult(document.RootElement); |
| | 2470 | | } |
| 0 | 2471 | | return Response.FromValue(value, message.Response); |
| | 2472 | | } |
| | 2473 | | default: |
| 0 | 2474 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2475 | | } |
| 0 | 2476 | | } |
| | 2477 | |
|
| | 2478 | | internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName) |
| | 2479 | | { |
| 0 | 2480 | | var message = _pipeline.CreateMessage(); |
| 0 | 2481 | | var request = message.Request; |
| 0 | 2482 | | request.Method = RequestMethod.Get; |
| 0 | 2483 | | var uri = new RawRequestUriBuilder(); |
| 0 | 2484 | | uri.Reset(endpoint); |
| 0 | 2485 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 2486 | | request.Uri = uri; |
| 0 | 2487 | | return message; |
| | 2488 | | } |
| | 2489 | |
|
| | 2490 | | /// <summary> Lists the available Namespaces within a resource group. </summary> |
| | 2491 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2492 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2493 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2494 | | public async Task<Response<EHNamespaceListResult>> ListByResourceGroupNextPageAsync(string nextLink, string reso |
| | 2495 | | { |
| 0 | 2496 | | if (nextLink == null) |
| | 2497 | | { |
| 0 | 2498 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2499 | | } |
| 0 | 2500 | | if (resourceGroupName == null) |
| | 2501 | | { |
| 0 | 2502 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2503 | | } |
| | 2504 | |
|
| 0 | 2505 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 2506 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 2507 | | switch (message.Response.Status) |
| | 2508 | | { |
| | 2509 | | case 200: |
| | 2510 | | { |
| 0 | 2511 | | EHNamespaceListResult value = default; |
| 0 | 2512 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 2513 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2514 | | { |
| 0 | 2515 | | value = null; |
| | 2516 | | } |
| | 2517 | | else |
| | 2518 | | { |
| 0 | 2519 | | value = EHNamespaceListResult.DeserializeEHNamespaceListResult(document.RootElement); |
| | 2520 | | } |
| 0 | 2521 | | return Response.FromValue(value, message.Response); |
| | 2522 | | } |
| | 2523 | | default: |
| 0 | 2524 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2525 | | } |
| 0 | 2526 | | } |
| | 2527 | |
|
| | 2528 | | /// <summary> Lists the available Namespaces within a resource group. </summary> |
| | 2529 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2530 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2531 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2532 | | public Response<EHNamespaceListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, Ca |
| | 2533 | | { |
| 0 | 2534 | | if (nextLink == null) |
| | 2535 | | { |
| 0 | 2536 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2537 | | } |
| 0 | 2538 | | if (resourceGroupName == null) |
| | 2539 | | { |
| 0 | 2540 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2541 | | } |
| | 2542 | |
|
| 0 | 2543 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 2544 | | _pipeline.Send(message, cancellationToken); |
| 0 | 2545 | | switch (message.Response.Status) |
| | 2546 | | { |
| | 2547 | | case 200: |
| | 2548 | | { |
| 0 | 2549 | | EHNamespaceListResult value = default; |
| 0 | 2550 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 2551 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2552 | | { |
| 0 | 2553 | | value = null; |
| | 2554 | | } |
| | 2555 | | else |
| | 2556 | | { |
| 0 | 2557 | | value = EHNamespaceListResult.DeserializeEHNamespaceListResult(document.RootElement); |
| | 2558 | | } |
| 0 | 2559 | | return Response.FromValue(value, message.Response); |
| | 2560 | | } |
| | 2561 | | default: |
| 0 | 2562 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2563 | | } |
| 0 | 2564 | | } |
| | 2565 | |
|
| | 2566 | | internal HttpMessage CreateListVirtualNetworkRulesNextPageRequest(string nextLink, string resourceGroupName, str |
| | 2567 | | { |
| 0 | 2568 | | var message = _pipeline.CreateMessage(); |
| 0 | 2569 | | var request = message.Request; |
| 0 | 2570 | | request.Method = RequestMethod.Get; |
| 0 | 2571 | | var uri = new RawRequestUriBuilder(); |
| 0 | 2572 | | uri.Reset(endpoint); |
| 0 | 2573 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 2574 | | request.Uri = uri; |
| 0 | 2575 | | return message; |
| | 2576 | | } |
| | 2577 | |
|
| | 2578 | | /// <summary> Gets a list of VirtualNetwork rules for a Namespace. </summary> |
| | 2579 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2580 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2581 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2582 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2583 | | public async Task<Response<VirtualNetworkRuleListResult>> ListVirtualNetworkRulesNextPageAsync(string nextLink, |
| | 2584 | | { |
| 0 | 2585 | | if (nextLink == null) |
| | 2586 | | { |
| 0 | 2587 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2588 | | } |
| 0 | 2589 | | if (resourceGroupName == null) |
| | 2590 | | { |
| 0 | 2591 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2592 | | } |
| 0 | 2593 | | if (namespaceName == null) |
| | 2594 | | { |
| 0 | 2595 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2596 | | } |
| | 2597 | |
|
| 0 | 2598 | | using var message = CreateListVirtualNetworkRulesNextPageRequest(nextLink, resourceGroupName, namespaceName) |
| 0 | 2599 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 2600 | | switch (message.Response.Status) |
| | 2601 | | { |
| | 2602 | | case 200: |
| | 2603 | | { |
| 0 | 2604 | | VirtualNetworkRuleListResult value = default; |
| 0 | 2605 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 2606 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2607 | | { |
| 0 | 2608 | | value = null; |
| | 2609 | | } |
| | 2610 | | else |
| | 2611 | | { |
| 0 | 2612 | | value = VirtualNetworkRuleListResult.DeserializeVirtualNetworkRuleListResult(document.RootEl |
| | 2613 | | } |
| 0 | 2614 | | return Response.FromValue(value, message.Response); |
| | 2615 | | } |
| | 2616 | | default: |
| 0 | 2617 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2618 | | } |
| 0 | 2619 | | } |
| | 2620 | |
|
| | 2621 | | /// <summary> Gets a list of VirtualNetwork rules for a Namespace. </summary> |
| | 2622 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2623 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2624 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2625 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2626 | | public Response<VirtualNetworkRuleListResult> ListVirtualNetworkRulesNextPage(string nextLink, string resourceGr |
| | 2627 | | { |
| 0 | 2628 | | if (nextLink == null) |
| | 2629 | | { |
| 0 | 2630 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2631 | | } |
| 0 | 2632 | | if (resourceGroupName == null) |
| | 2633 | | { |
| 0 | 2634 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2635 | | } |
| 0 | 2636 | | if (namespaceName == null) |
| | 2637 | | { |
| 0 | 2638 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2639 | | } |
| | 2640 | |
|
| 0 | 2641 | | using var message = CreateListVirtualNetworkRulesNextPageRequest(nextLink, resourceGroupName, namespaceName) |
| 0 | 2642 | | _pipeline.Send(message, cancellationToken); |
| 0 | 2643 | | switch (message.Response.Status) |
| | 2644 | | { |
| | 2645 | | case 200: |
| | 2646 | | { |
| 0 | 2647 | | VirtualNetworkRuleListResult value = default; |
| 0 | 2648 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 2649 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2650 | | { |
| 0 | 2651 | | value = null; |
| | 2652 | | } |
| | 2653 | | else |
| | 2654 | | { |
| 0 | 2655 | | value = VirtualNetworkRuleListResult.DeserializeVirtualNetworkRuleListResult(document.RootEl |
| | 2656 | | } |
| 0 | 2657 | | return Response.FromValue(value, message.Response); |
| | 2658 | | } |
| | 2659 | | default: |
| 0 | 2660 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2661 | | } |
| 0 | 2662 | | } |
| | 2663 | |
|
| | 2664 | | internal HttpMessage CreateListAuthorizationRulesNextPageRequest(string nextLink, string resourceGroupName, stri |
| | 2665 | | { |
| 0 | 2666 | | var message = _pipeline.CreateMessage(); |
| 0 | 2667 | | var request = message.Request; |
| 0 | 2668 | | request.Method = RequestMethod.Get; |
| 0 | 2669 | | var uri = new RawRequestUriBuilder(); |
| 0 | 2670 | | uri.Reset(endpoint); |
| 0 | 2671 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 2672 | | request.Uri = uri; |
| 0 | 2673 | | return message; |
| | 2674 | | } |
| | 2675 | |
|
| | 2676 | | /// <summary> Gets a list of authorization rules for a Namespace. </summary> |
| | 2677 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2678 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2679 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2680 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2681 | | public async Task<Response<AuthorizationRuleListResult>> ListAuthorizationRulesNextPageAsync(string nextLink, st |
| | 2682 | | { |
| 0 | 2683 | | if (nextLink == null) |
| | 2684 | | { |
| 0 | 2685 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2686 | | } |
| 0 | 2687 | | if (resourceGroupName == null) |
| | 2688 | | { |
| 0 | 2689 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2690 | | } |
| 0 | 2691 | | if (namespaceName == null) |
| | 2692 | | { |
| 0 | 2693 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2694 | | } |
| | 2695 | |
|
| 0 | 2696 | | using var message = CreateListAuthorizationRulesNextPageRequest(nextLink, resourceGroupName, namespaceName); |
| 0 | 2697 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 2698 | | switch (message.Response.Status) |
| | 2699 | | { |
| | 2700 | | case 200: |
| | 2701 | | { |
| 0 | 2702 | | AuthorizationRuleListResult value = default; |
| 0 | 2703 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 2704 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2705 | | { |
| 0 | 2706 | | value = null; |
| | 2707 | | } |
| | 2708 | | else |
| | 2709 | | { |
| 0 | 2710 | | value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem |
| | 2711 | | } |
| 0 | 2712 | | return Response.FromValue(value, message.Response); |
| | 2713 | | } |
| | 2714 | | default: |
| 0 | 2715 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2716 | | } |
| 0 | 2717 | | } |
| | 2718 | |
|
| | 2719 | | /// <summary> Gets a list of authorization rules for a Namespace. </summary> |
| | 2720 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2721 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 2722 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 2723 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2724 | | public Response<AuthorizationRuleListResult> ListAuthorizationRulesNextPage(string nextLink, string resourceGrou |
| | 2725 | | { |
| 0 | 2726 | | if (nextLink == null) |
| | 2727 | | { |
| 0 | 2728 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2729 | | } |
| 0 | 2730 | | if (resourceGroupName == null) |
| | 2731 | | { |
| 0 | 2732 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2733 | | } |
| 0 | 2734 | | if (namespaceName == null) |
| | 2735 | | { |
| 0 | 2736 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 2737 | | } |
| | 2738 | |
|
| 0 | 2739 | | using var message = CreateListAuthorizationRulesNextPageRequest(nextLink, resourceGroupName, namespaceName); |
| 0 | 2740 | | _pipeline.Send(message, cancellationToken); |
| 0 | 2741 | | switch (message.Response.Status) |
| | 2742 | | { |
| | 2743 | | case 200: |
| | 2744 | | { |
| 0 | 2745 | | AuthorizationRuleListResult value = default; |
| 0 | 2746 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 2747 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2748 | | { |
| 0 | 2749 | | value = null; |
| | 2750 | | } |
| | 2751 | | else |
| | 2752 | | { |
| 0 | 2753 | | value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem |
| | 2754 | | } |
| 0 | 2755 | | return Response.FromValue(value, message.Response); |
| | 2756 | | } |
| | 2757 | | default: |
| 0 | 2758 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2759 | | } |
| 0 | 2760 | | } |
| | 2761 | | } |
| | 2762 | | } |