| | 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 LoadBalancerFrontendIPConfigurationsRestOperations |
| | 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 LoadBalancerFrontendIPConfigurationsRestOperations. </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 |
| 8 | 32 | | public LoadBalancerFrontendIPConfigurationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipe |
| | 33 | | { |
| 8 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 8 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 8 | 40 | | this.subscriptionId = subscriptionId; |
| 8 | 41 | | this.endpoint = endpoint; |
| 8 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 43 | | _pipeline = pipeline; |
| 8 | 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("/frontendIPConfigurations", 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 load balancer frontend IP configurations. </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<LoadBalancerFrontendIPConfigurationListResult>> ListAsync(string resourceGroupName, s |
| | 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 | | LoadBalancerFrontendIPConfigurationListResult 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 = LoadBalancerFrontendIPConfigurationListResult.DeserializeLoadBalancerFrontendIPConfi |
| | 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 load balancer frontend IP configurations. </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<LoadBalancerFrontendIPConfigurationListResult> List(string resourceGroupName, string loadBalance |
| | 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 | | LoadBalancerFrontendIPConfigurationListResult 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 = LoadBalancerFrontendIPConfigurationListResult.DeserializeLoadBalancerFrontendIPConfi |
| | 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 CreateGetRequest(string resourceGroupName, string loadBalancerName, string frontendIPConfig |
| | 142 | | { |
| 4 | 143 | | var message = _pipeline.CreateMessage(); |
| 4 | 144 | | var request = message.Request; |
| 4 | 145 | | request.Method = RequestMethod.Get; |
| 4 | 146 | | var uri = new RawRequestUriBuilder(); |
| 4 | 147 | | uri.Reset(endpoint); |
| 4 | 148 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 149 | | uri.AppendPath(subscriptionId, true); |
| 4 | 150 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 151 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 152 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 4 | 153 | | uri.AppendPath(loadBalancerName, true); |
| 4 | 154 | | uri.AppendPath("/frontendIPConfigurations/", false); |
| 4 | 155 | | uri.AppendPath(frontendIPConfigurationName, true); |
| 4 | 156 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 4 | 157 | | request.Uri = uri; |
| 4 | 158 | | return message; |
| | 159 | | } |
| | 160 | |
|
| | 161 | | /// <summary> Gets load balancer frontend IP configuration. </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="frontendIPConfigurationName"> The name of the frontend IP configuration. </param> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public async Task<Response<FrontendIPConfiguration>> GetAsync(string resourceGroupName, string loadBalancerName, |
| | 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 (frontendIPConfigurationName == null) |
| | 177 | | { |
| 0 | 178 | | throw new ArgumentNullException(nameof(frontendIPConfigurationName)); |
| | 179 | | } |
| | 180 | |
|
| 2 | 181 | | using var message = CreateGetRequest(resourceGroupName, loadBalancerName, frontendIPConfigurationName); |
| 2 | 182 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 183 | | switch (message.Response.Status) |
| | 184 | | { |
| | 185 | | case 200: |
| | 186 | | { |
| 2 | 187 | | FrontendIPConfiguration value = default; |
| 2 | 188 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 189 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| 0 | 191 | | value = null; |
| | 192 | | } |
| | 193 | | else |
| | 194 | | { |
| 2 | 195 | | value = FrontendIPConfiguration.DeserializeFrontendIPConfiguration(document.RootElement); |
| | 196 | | } |
| 2 | 197 | | return Response.FromValue(value, message.Response); |
| | 198 | | } |
| | 199 | | default: |
| 0 | 200 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 201 | | } |
| 2 | 202 | | } |
| | 203 | |
|
| | 204 | | /// <summary> Gets load balancer frontend IP configuration. </summary> |
| | 205 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 206 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 207 | | /// <param name="frontendIPConfigurationName"> The name of the frontend IP configuration. </param> |
| | 208 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 209 | | public Response<FrontendIPConfiguration> Get(string resourceGroupName, string loadBalancerName, string frontendI |
| | 210 | | { |
| 2 | 211 | | if (resourceGroupName == null) |
| | 212 | | { |
| 0 | 213 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 214 | | } |
| 2 | 215 | | if (loadBalancerName == null) |
| | 216 | | { |
| 0 | 217 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 218 | | } |
| 2 | 219 | | if (frontendIPConfigurationName == null) |
| | 220 | | { |
| 0 | 221 | | throw new ArgumentNullException(nameof(frontendIPConfigurationName)); |
| | 222 | | } |
| | 223 | |
|
| 2 | 224 | | using var message = CreateGetRequest(resourceGroupName, loadBalancerName, frontendIPConfigurationName); |
| 2 | 225 | | _pipeline.Send(message, cancellationToken); |
| 2 | 226 | | switch (message.Response.Status) |
| | 227 | | { |
| | 228 | | case 200: |
| | 229 | | { |
| 2 | 230 | | FrontendIPConfiguration value = default; |
| 2 | 231 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 232 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 233 | | { |
| 0 | 234 | | value = null; |
| | 235 | | } |
| | 236 | | else |
| | 237 | | { |
| 2 | 238 | | value = FrontendIPConfiguration.DeserializeFrontendIPConfiguration(document.RootElement); |
| | 239 | | } |
| 2 | 240 | | return Response.FromValue(value, message.Response); |
| | 241 | | } |
| | 242 | | default: |
| 0 | 243 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 244 | | } |
| 2 | 245 | | } |
| | 246 | |
|
| | 247 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string loadBalancerNam |
| | 248 | | { |
| 0 | 249 | | var message = _pipeline.CreateMessage(); |
| 0 | 250 | | var request = message.Request; |
| 0 | 251 | | request.Method = RequestMethod.Get; |
| 0 | 252 | | var uri = new RawRequestUriBuilder(); |
| 0 | 253 | | uri.Reset(endpoint); |
| 0 | 254 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 255 | | request.Uri = uri; |
| 0 | 256 | | return message; |
| | 257 | | } |
| | 258 | |
|
| | 259 | | /// <summary> Gets all the load balancer frontend IP configurations. </summary> |
| | 260 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 261 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 262 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 263 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 264 | | public async Task<Response<LoadBalancerFrontendIPConfigurationListResult>> ListNextPageAsync(string nextLink, st |
| | 265 | | { |
| 0 | 266 | | if (nextLink == null) |
| | 267 | | { |
| 0 | 268 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 269 | | } |
| 0 | 270 | | if (resourceGroupName == null) |
| | 271 | | { |
| 0 | 272 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 273 | | } |
| 0 | 274 | | if (loadBalancerName == null) |
| | 275 | | { |
| 0 | 276 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 277 | | } |
| | 278 | |
|
| 0 | 279 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, loadBalancerName); |
| 0 | 280 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 281 | | switch (message.Response.Status) |
| | 282 | | { |
| | 283 | | case 200: |
| | 284 | | { |
| 0 | 285 | | LoadBalancerFrontendIPConfigurationListResult value = default; |
| 0 | 286 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 287 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 288 | | { |
| 0 | 289 | | value = null; |
| | 290 | | } |
| | 291 | | else |
| | 292 | | { |
| 0 | 293 | | value = LoadBalancerFrontendIPConfigurationListResult.DeserializeLoadBalancerFrontendIPConfi |
| | 294 | | } |
| 0 | 295 | | return Response.FromValue(value, message.Response); |
| | 296 | | } |
| | 297 | | default: |
| 0 | 298 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 299 | | } |
| 0 | 300 | | } |
| | 301 | |
|
| | 302 | | /// <summary> Gets all the load balancer frontend IP configurations. </summary> |
| | 303 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 304 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 305 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 306 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 307 | | public Response<LoadBalancerFrontendIPConfigurationListResult> ListNextPage(string nextLink, string resourceGrou |
| | 308 | | { |
| 0 | 309 | | if (nextLink == null) |
| | 310 | | { |
| 0 | 311 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 312 | | } |
| 0 | 313 | | if (resourceGroupName == null) |
| | 314 | | { |
| 0 | 315 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 316 | | } |
| 0 | 317 | | if (loadBalancerName == null) |
| | 318 | | { |
| 0 | 319 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 320 | | } |
| | 321 | |
|
| 0 | 322 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, loadBalancerName); |
| 0 | 323 | | _pipeline.Send(message, cancellationToken); |
| 0 | 324 | | switch (message.Response.Status) |
| | 325 | | { |
| | 326 | | case 200: |
| | 327 | | { |
| 0 | 328 | | LoadBalancerFrontendIPConfigurationListResult value = default; |
| 0 | 329 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 330 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 331 | | { |
| 0 | 332 | | value = null; |
| | 333 | | } |
| | 334 | | else |
| | 335 | | { |
| 0 | 336 | | value = LoadBalancerFrontendIPConfigurationListResult.DeserializeLoadBalancerFrontendIPConfi |
| | 337 | | } |
| 0 | 338 | | return Response.FromValue(value, message.Response); |
| | 339 | | } |
| | 340 | | default: |
| 0 | 341 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 342 | | } |
| 0 | 343 | | } |
| | 344 | | } |
| | 345 | | } |