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