| | 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.Network.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Network |
| | 18 | | { |
| | 19 | | internal partial class InboundNatRulesRestOperations |
| | 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 InboundNatRulesRestOperations. </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"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 16 | 32 | | public InboundNatRulesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip |
| | 33 | | { |
| 16 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 16 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 16 | 40 | | this.subscriptionId = subscriptionId; |
| 16 | 41 | | this.endpoint = endpoint; |
| 16 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 16 | 43 | | _pipeline = pipeline; |
| 16 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateListRequest(string resourceGroupName, string loadBalancerName) |
| | 47 | | { |
| 4 | 48 | | var message = _pipeline.CreateMessage(); |
| 4 | 49 | | var request = message.Request; |
| 4 | 50 | | request.Method = RequestMethod.Get; |
| 4 | 51 | | var uri = new RawRequestUriBuilder(); |
| 4 | 52 | | uri.Reset(endpoint); |
| 4 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 54 | | uri.AppendPath(subscriptionId, true); |
| 4 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 57 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 4 | 58 | | uri.AppendPath(loadBalancerName, true); |
| 4 | 59 | | uri.AppendPath("/inboundNatRules", false); |
| 4 | 60 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 4 | 61 | | request.Uri = uri; |
| 4 | 62 | | return message; |
| | 63 | | } |
| | 64 | |
|
| | 65 | | /// <summary> Gets all the inbound nat rules in a load balancer. </summary> |
| | 66 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 67 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 68 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 69 | | public async Task<Response<InboundNatRuleListResult>> ListAsync(string resourceGroupName, string loadBalancerNam |
| | 70 | | { |
| 2 | 71 | | if (resourceGroupName == null) |
| | 72 | | { |
| 0 | 73 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 74 | | } |
| 2 | 75 | | if (loadBalancerName == null) |
| | 76 | | { |
| 0 | 77 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 78 | | } |
| | 79 | |
|
| 2 | 80 | | using var message = CreateListRequest(resourceGroupName, loadBalancerName); |
| 2 | 81 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 82 | | switch (message.Response.Status) |
| | 83 | | { |
| | 84 | | case 200: |
| | 85 | | { |
| 2 | 86 | | InboundNatRuleListResult value = default; |
| 2 | 87 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 88 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| 0 | 90 | | value = null; |
| | 91 | | } |
| | 92 | | else |
| | 93 | | { |
| 2 | 94 | | value = InboundNatRuleListResult.DeserializeInboundNatRuleListResult(document.RootElement); |
| | 95 | | } |
| 2 | 96 | | return Response.FromValue(value, message.Response); |
| | 97 | | } |
| | 98 | | default: |
| 0 | 99 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 100 | | } |
| 2 | 101 | | } |
| | 102 | |
|
| | 103 | | /// <summary> Gets all the inbound nat rules in a load balancer. </summary> |
| | 104 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 105 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 106 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 107 | | public Response<InboundNatRuleListResult> List(string resourceGroupName, string loadBalancerName, CancellationTo |
| | 108 | | { |
| 2 | 109 | | if (resourceGroupName == null) |
| | 110 | | { |
| 0 | 111 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 112 | | } |
| 2 | 113 | | if (loadBalancerName == null) |
| | 114 | | { |
| 0 | 115 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 116 | | } |
| | 117 | |
|
| 2 | 118 | | using var message = CreateListRequest(resourceGroupName, loadBalancerName); |
| 2 | 119 | | _pipeline.Send(message, cancellationToken); |
| 2 | 120 | | switch (message.Response.Status) |
| | 121 | | { |
| | 122 | | case 200: |
| | 123 | | { |
| 2 | 124 | | InboundNatRuleListResult value = default; |
| 2 | 125 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 126 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 127 | | { |
| 0 | 128 | | value = null; |
| | 129 | | } |
| | 130 | | else |
| | 131 | | { |
| 2 | 132 | | value = InboundNatRuleListResult.DeserializeInboundNatRuleListResult(document.RootElement); |
| | 133 | | } |
| 2 | 134 | | return Response.FromValue(value, message.Response); |
| | 135 | | } |
| | 136 | | default: |
| 0 | 137 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 138 | | } |
| 2 | 139 | | } |
| | 140 | |
|
| | 141 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string loadBalancerName, string inboundNatRul |
| | 142 | | { |
| 8 | 143 | | var message = _pipeline.CreateMessage(); |
| 8 | 144 | | var request = message.Request; |
| 8 | 145 | | request.Method = RequestMethod.Delete; |
| 8 | 146 | | var uri = new RawRequestUriBuilder(); |
| 8 | 147 | | uri.Reset(endpoint); |
| 8 | 148 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 149 | | uri.AppendPath(subscriptionId, true); |
| 8 | 150 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 151 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 152 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 8 | 153 | | uri.AppendPath(loadBalancerName, true); |
| 8 | 154 | | uri.AppendPath("/inboundNatRules/", false); |
| 8 | 155 | | uri.AppendPath(inboundNatRuleName, true); |
| 8 | 156 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 8 | 157 | | request.Uri = uri; |
| 8 | 158 | | return message; |
| | 159 | | } |
| | 160 | |
|
| | 161 | | /// <summary> Deletes the specified load balancer inbound nat rule. </summary> |
| | 162 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 163 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 164 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public async Task<Response> DeleteAsync(string resourceGroupName, string loadBalancerName, string inboundNatRule |
| | 167 | | { |
| 2 | 168 | | if (resourceGroupName == null) |
| | 169 | | { |
| 0 | 170 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 171 | | } |
| 2 | 172 | | if (loadBalancerName == null) |
| | 173 | | { |
| 0 | 174 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 175 | | } |
| 2 | 176 | | if (inboundNatRuleName == null) |
| | 177 | | { |
| 0 | 178 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | 179 | | } |
| | 180 | |
|
| 2 | 181 | | using var message = CreateDeleteRequest(resourceGroupName, loadBalancerName, inboundNatRuleName); |
| 2 | 182 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 183 | | switch (message.Response.Status) |
| | 184 | | { |
| | 185 | | case 200: |
| | 186 | | case 202: |
| | 187 | | case 204: |
| 2 | 188 | | return message.Response; |
| | 189 | | default: |
| 0 | 190 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 191 | | } |
| 2 | 192 | | } |
| | 193 | |
|
| | 194 | | /// <summary> Deletes the specified load balancer inbound nat rule. </summary> |
| | 195 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 196 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 197 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | 198 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 199 | | public Response Delete(string resourceGroupName, string loadBalancerName, string inboundNatRuleName, Cancellatio |
| | 200 | | { |
| 2 | 201 | | if (resourceGroupName == null) |
| | 202 | | { |
| 0 | 203 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 204 | | } |
| 2 | 205 | | if (loadBalancerName == null) |
| | 206 | | { |
| 0 | 207 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 208 | | } |
| 2 | 209 | | if (inboundNatRuleName == null) |
| | 210 | | { |
| 0 | 211 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | 212 | | } |
| | 213 | |
|
| 2 | 214 | | using var message = CreateDeleteRequest(resourceGroupName, loadBalancerName, inboundNatRuleName); |
| 2 | 215 | | _pipeline.Send(message, cancellationToken); |
| 2 | 216 | | switch (message.Response.Status) |
| | 217 | | { |
| | 218 | | case 200: |
| | 219 | | case 202: |
| | 220 | | case 204: |
| 2 | 221 | | return message.Response; |
| | 222 | | default: |
| 0 | 223 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 224 | | } |
| 2 | 225 | | } |
| | 226 | |
|
| | 227 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string loadBalancerName, string inboundNatRuleNa |
| | 228 | | { |
| 4 | 229 | | var message = _pipeline.CreateMessage(); |
| 4 | 230 | | var request = message.Request; |
| 4 | 231 | | request.Method = RequestMethod.Get; |
| 4 | 232 | | var uri = new RawRequestUriBuilder(); |
| 4 | 233 | | uri.Reset(endpoint); |
| 4 | 234 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 235 | | uri.AppendPath(subscriptionId, true); |
| 4 | 236 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 237 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 238 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 4 | 239 | | uri.AppendPath(loadBalancerName, true); |
| 4 | 240 | | uri.AppendPath("/inboundNatRules/", false); |
| 4 | 241 | | uri.AppendPath(inboundNatRuleName, true); |
| 4 | 242 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 4 | 243 | | if (expand != null) |
| | 244 | | { |
| 0 | 245 | | uri.AppendQuery("$expand", expand, true); |
| | 246 | | } |
| 4 | 247 | | request.Uri = uri; |
| 4 | 248 | | return message; |
| | 249 | | } |
| | 250 | |
|
| | 251 | | /// <summary> Gets the specified load balancer inbound nat rule. </summary> |
| | 252 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 253 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 254 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | 255 | | /// <param name="expand"> Expands referenced resources. </param> |
| | 256 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 257 | | public async Task<Response<InboundNatRule>> GetAsync(string resourceGroupName, string loadBalancerName, string i |
| | 258 | | { |
| 2 | 259 | | if (resourceGroupName == null) |
| | 260 | | { |
| 0 | 261 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 262 | | } |
| 2 | 263 | | if (loadBalancerName == null) |
| | 264 | | { |
| 0 | 265 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 266 | | } |
| 2 | 267 | | if (inboundNatRuleName == null) |
| | 268 | | { |
| 0 | 269 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | 270 | | } |
| | 271 | |
|
| 2 | 272 | | using var message = CreateGetRequest(resourceGroupName, loadBalancerName, inboundNatRuleName, expand); |
| 2 | 273 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 274 | | switch (message.Response.Status) |
| | 275 | | { |
| | 276 | | case 200: |
| | 277 | | { |
| 2 | 278 | | InboundNatRule value = default; |
| 2 | 279 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 280 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 281 | | { |
| 0 | 282 | | value = null; |
| | 283 | | } |
| | 284 | | else |
| | 285 | | { |
| 2 | 286 | | value = InboundNatRule.DeserializeInboundNatRule(document.RootElement); |
| | 287 | | } |
| 2 | 288 | | return Response.FromValue(value, message.Response); |
| | 289 | | } |
| | 290 | | default: |
| 0 | 291 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 292 | | } |
| 2 | 293 | | } |
| | 294 | |
|
| | 295 | | /// <summary> Gets the specified load balancer inbound nat rule. </summary> |
| | 296 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 297 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 298 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | 299 | | /// <param name="expand"> Expands referenced resources. </param> |
| | 300 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 301 | | public Response<InboundNatRule> Get(string resourceGroupName, string loadBalancerName, string inboundNatRuleName |
| | 302 | | { |
| 2 | 303 | | if (resourceGroupName == null) |
| | 304 | | { |
| 0 | 305 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 306 | | } |
| 2 | 307 | | if (loadBalancerName == null) |
| | 308 | | { |
| 0 | 309 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 310 | | } |
| 2 | 311 | | if (inboundNatRuleName == null) |
| | 312 | | { |
| 0 | 313 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | 314 | | } |
| | 315 | |
|
| 2 | 316 | | using var message = CreateGetRequest(resourceGroupName, loadBalancerName, inboundNatRuleName, expand); |
| 2 | 317 | | _pipeline.Send(message, cancellationToken); |
| 2 | 318 | | switch (message.Response.Status) |
| | 319 | | { |
| | 320 | | case 200: |
| | 321 | | { |
| 2 | 322 | | InboundNatRule value = default; |
| 2 | 323 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 324 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 325 | | { |
| 0 | 326 | | value = null; |
| | 327 | | } |
| | 328 | | else |
| | 329 | | { |
| 2 | 330 | | value = InboundNatRule.DeserializeInboundNatRule(document.RootElement); |
| | 331 | | } |
| 2 | 332 | | return Response.FromValue(value, message.Response); |
| | 333 | | } |
| | 334 | | default: |
| 0 | 335 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 336 | | } |
| 2 | 337 | | } |
| | 338 | |
|
| | 339 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string loadBalancerName, string inbou |
| | 340 | | { |
| 8 | 341 | | var message = _pipeline.CreateMessage(); |
| 8 | 342 | | var request = message.Request; |
| 8 | 343 | | request.Method = RequestMethod.Put; |
| 8 | 344 | | var uri = new RawRequestUriBuilder(); |
| 8 | 345 | | uri.Reset(endpoint); |
| 8 | 346 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 347 | | uri.AppendPath(subscriptionId, true); |
| 8 | 348 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 349 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 350 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 8 | 351 | | uri.AppendPath(loadBalancerName, true); |
| 8 | 352 | | uri.AppendPath("/inboundNatRules/", false); |
| 8 | 353 | | uri.AppendPath(inboundNatRuleName, true); |
| 8 | 354 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 8 | 355 | | request.Uri = uri; |
| 8 | 356 | | request.Headers.Add("Content-Type", "application/json"); |
| 8 | 357 | | var content = new Utf8JsonRequestContent(); |
| 8 | 358 | | content.JsonWriter.WriteObjectValue(inboundNatRuleParameters); |
| 8 | 359 | | request.Content = content; |
| 8 | 360 | | return message; |
| | 361 | | } |
| | 362 | |
|
| | 363 | | /// <summary> Creates or updates a load balancer inbound nat rule. </summary> |
| | 364 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 365 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 366 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | 367 | | /// <param name="inboundNatRuleParameters"> Parameters supplied to the create or update inbound nat rule operati |
| | 368 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 369 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string loadBalancerName, string inboun |
| | 370 | | { |
| 2 | 371 | | if (resourceGroupName == null) |
| | 372 | | { |
| 0 | 373 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 374 | | } |
| 2 | 375 | | if (loadBalancerName == null) |
| | 376 | | { |
| 0 | 377 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 378 | | } |
| 2 | 379 | | if (inboundNatRuleName == null) |
| | 380 | | { |
| 0 | 381 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | 382 | | } |
| 2 | 383 | | if (inboundNatRuleParameters == null) |
| | 384 | | { |
| 0 | 385 | | throw new ArgumentNullException(nameof(inboundNatRuleParameters)); |
| | 386 | | } |
| | 387 | |
|
| 2 | 388 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, loadBalancerName, inboundNatRuleName, inb |
| 2 | 389 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 390 | | switch (message.Response.Status) |
| | 391 | | { |
| | 392 | | case 200: |
| | 393 | | case 201: |
| 2 | 394 | | return message.Response; |
| | 395 | | default: |
| 0 | 396 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 397 | | } |
| 2 | 398 | | } |
| | 399 | |
|
| | 400 | | /// <summary> Creates or updates a load balancer inbound nat rule. </summary> |
| | 401 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 402 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 403 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | 404 | | /// <param name="inboundNatRuleParameters"> Parameters supplied to the create or update inbound nat rule operati |
| | 405 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 406 | | public Response CreateOrUpdate(string resourceGroupName, string loadBalancerName, string inboundNatRuleName, Inb |
| | 407 | | { |
| 2 | 408 | | if (resourceGroupName == null) |
| | 409 | | { |
| 0 | 410 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 411 | | } |
| 2 | 412 | | if (loadBalancerName == null) |
| | 413 | | { |
| 0 | 414 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 415 | | } |
| 2 | 416 | | if (inboundNatRuleName == null) |
| | 417 | | { |
| 0 | 418 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | 419 | | } |
| 2 | 420 | | if (inboundNatRuleParameters == null) |
| | 421 | | { |
| 0 | 422 | | throw new ArgumentNullException(nameof(inboundNatRuleParameters)); |
| | 423 | | } |
| | 424 | |
|
| 2 | 425 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, loadBalancerName, inboundNatRuleName, inb |
| 2 | 426 | | _pipeline.Send(message, cancellationToken); |
| 2 | 427 | | switch (message.Response.Status) |
| | 428 | | { |
| | 429 | | case 200: |
| | 430 | | case 201: |
| 2 | 431 | | return message.Response; |
| | 432 | | default: |
| 0 | 433 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 434 | | } |
| 2 | 435 | | } |
| | 436 | |
|
| | 437 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string loadBalancerNam |
| | 438 | | { |
| 0 | 439 | | var message = _pipeline.CreateMessage(); |
| 0 | 440 | | var request = message.Request; |
| 0 | 441 | | request.Method = RequestMethod.Get; |
| 0 | 442 | | var uri = new RawRequestUriBuilder(); |
| 0 | 443 | | uri.Reset(endpoint); |
| 0 | 444 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 445 | | request.Uri = uri; |
| 0 | 446 | | return message; |
| | 447 | | } |
| | 448 | |
|
| | 449 | | /// <summary> Gets all the inbound nat rules in a load balancer. </summary> |
| | 450 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 451 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 452 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 453 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 454 | | public async Task<Response<InboundNatRuleListResult>> ListNextPageAsync(string nextLink, string resourceGroupNam |
| | 455 | | { |
| 0 | 456 | | if (nextLink == null) |
| | 457 | | { |
| 0 | 458 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 459 | | } |
| 0 | 460 | | if (resourceGroupName == null) |
| | 461 | | { |
| 0 | 462 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 463 | | } |
| 0 | 464 | | if (loadBalancerName == null) |
| | 465 | | { |
| 0 | 466 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 467 | | } |
| | 468 | |
|
| 0 | 469 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, loadBalancerName); |
| 0 | 470 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 471 | | switch (message.Response.Status) |
| | 472 | | { |
| | 473 | | case 200: |
| | 474 | | { |
| 0 | 475 | | InboundNatRuleListResult value = default; |
| 0 | 476 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 477 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 478 | | { |
| 0 | 479 | | value = null; |
| | 480 | | } |
| | 481 | | else |
| | 482 | | { |
| 0 | 483 | | value = InboundNatRuleListResult.DeserializeInboundNatRuleListResult(document.RootElement); |
| | 484 | | } |
| 0 | 485 | | return Response.FromValue(value, message.Response); |
| | 486 | | } |
| | 487 | | default: |
| 0 | 488 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 489 | | } |
| 0 | 490 | | } |
| | 491 | |
|
| | 492 | | /// <summary> Gets all the inbound nat rules in a load balancer. </summary> |
| | 493 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 494 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 495 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 496 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 497 | | public Response<InboundNatRuleListResult> ListNextPage(string nextLink, string resourceGroupName, string loadBal |
| | 498 | | { |
| 0 | 499 | | if (nextLink == null) |
| | 500 | | { |
| 0 | 501 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 502 | | } |
| 0 | 503 | | if (resourceGroupName == null) |
| | 504 | | { |
| 0 | 505 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 506 | | } |
| 0 | 507 | | if (loadBalancerName == null) |
| | 508 | | { |
| 0 | 509 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 510 | | } |
| | 511 | |
|
| 0 | 512 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, loadBalancerName); |
| 0 | 513 | | _pipeline.Send(message, cancellationToken); |
| 0 | 514 | | switch (message.Response.Status) |
| | 515 | | { |
| | 516 | | case 200: |
| | 517 | | { |
| 0 | 518 | | InboundNatRuleListResult value = default; |
| 0 | 519 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 520 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 521 | | { |
| 0 | 522 | | value = null; |
| | 523 | | } |
| | 524 | | else |
| | 525 | | { |
| 0 | 526 | | value = InboundNatRuleListResult.DeserializeInboundNatRuleListResult(document.RootElement); |
| | 527 | | } |
| 0 | 528 | | return Response.FromValue(value, message.Response); |
| | 529 | | } |
| | 530 | | default: |
| 0 | 531 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 532 | | } |
| 0 | 533 | | } |
| | 534 | | } |
| | 535 | | } |