| | 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 PeerExpressRouteCircuitConnectionsRestOperations |
| | 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 PeerExpressRouteCircuitConnectionsRestOperations. </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 PeerExpressRouteCircuitConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeli |
| | 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 CreateGetRequest(string resourceGroupName, string circuitName, string peeringName, string c |
| | 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.Network/expressRouteCircuits/", false); |
| 0 | 58 | | uri.AppendPath(circuitName, true); |
| 0 | 59 | | uri.AppendPath("/peerings/", false); |
| 0 | 60 | | uri.AppendPath(peeringName, true); |
| 0 | 61 | | uri.AppendPath("/peerConnections/", false); |
| 0 | 62 | | uri.AppendPath(connectionName, true); |
| 0 | 63 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 64 | | request.Uri = uri; |
| 0 | 65 | | return message; |
| | 66 | | } |
| | 67 | |
|
| | 68 | | /// <summary> Gets the specified Peer Express Route Circuit Connection from the specified express route circuit. |
| | 69 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 70 | | /// <param name="circuitName"> The name of the express route circuit. </param> |
| | 71 | | /// <param name="peeringName"> The name of the peering. </param> |
| | 72 | | /// <param name="connectionName"> The name of the peer express route circuit connection. </param> |
| | 73 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 74 | | public async Task<Response<PeerExpressRouteCircuitConnection>> GetAsync(string resourceGroupName, string circuit |
| | 75 | | { |
| 0 | 76 | | if (resourceGroupName == null) |
| | 77 | | { |
| 0 | 78 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 79 | | } |
| 0 | 80 | | if (circuitName == null) |
| | 81 | | { |
| 0 | 82 | | throw new ArgumentNullException(nameof(circuitName)); |
| | 83 | | } |
| 0 | 84 | | if (peeringName == null) |
| | 85 | | { |
| 0 | 86 | | throw new ArgumentNullException(nameof(peeringName)); |
| | 87 | | } |
| 0 | 88 | | if (connectionName == null) |
| | 89 | | { |
| 0 | 90 | | throw new ArgumentNullException(nameof(connectionName)); |
| | 91 | | } |
| | 92 | |
|
| 0 | 93 | | using var message = CreateGetRequest(resourceGroupName, circuitName, peeringName, connectionName); |
| 0 | 94 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 95 | | switch (message.Response.Status) |
| | 96 | | { |
| | 97 | | case 200: |
| | 98 | | { |
| 0 | 99 | | PeerExpressRouteCircuitConnection value = default; |
| 0 | 100 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 101 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 102 | | { |
| 0 | 103 | | value = null; |
| | 104 | | } |
| | 105 | | else |
| | 106 | | { |
| 0 | 107 | | value = PeerExpressRouteCircuitConnection.DeserializePeerExpressRouteCircuitConnection(docum |
| | 108 | | } |
| 0 | 109 | | return Response.FromValue(value, message.Response); |
| | 110 | | } |
| | 111 | | default: |
| 0 | 112 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 113 | | } |
| 0 | 114 | | } |
| | 115 | |
|
| | 116 | | /// <summary> Gets the specified Peer Express Route Circuit Connection from the specified express route circuit. |
| | 117 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 118 | | /// <param name="circuitName"> The name of the express route circuit. </param> |
| | 119 | | /// <param name="peeringName"> The name of the peering. </param> |
| | 120 | | /// <param name="connectionName"> The name of the peer express route circuit connection. </param> |
| | 121 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 122 | | public Response<PeerExpressRouteCircuitConnection> Get(string resourceGroupName, string circuitName, string peer |
| | 123 | | { |
| 0 | 124 | | if (resourceGroupName == null) |
| | 125 | | { |
| 0 | 126 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 127 | | } |
| 0 | 128 | | if (circuitName == null) |
| | 129 | | { |
| 0 | 130 | | throw new ArgumentNullException(nameof(circuitName)); |
| | 131 | | } |
| 0 | 132 | | if (peeringName == null) |
| | 133 | | { |
| 0 | 134 | | throw new ArgumentNullException(nameof(peeringName)); |
| | 135 | | } |
| 0 | 136 | | if (connectionName == null) |
| | 137 | | { |
| 0 | 138 | | throw new ArgumentNullException(nameof(connectionName)); |
| | 139 | | } |
| | 140 | |
|
| 0 | 141 | | using var message = CreateGetRequest(resourceGroupName, circuitName, peeringName, connectionName); |
| 0 | 142 | | _pipeline.Send(message, cancellationToken); |
| 0 | 143 | | switch (message.Response.Status) |
| | 144 | | { |
| | 145 | | case 200: |
| | 146 | | { |
| 0 | 147 | | PeerExpressRouteCircuitConnection value = default; |
| 0 | 148 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 149 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| 0 | 151 | | value = null; |
| | 152 | | } |
| | 153 | | else |
| | 154 | | { |
| 0 | 155 | | value = PeerExpressRouteCircuitConnection.DeserializePeerExpressRouteCircuitConnection(docum |
| | 156 | | } |
| 0 | 157 | | return Response.FromValue(value, message.Response); |
| | 158 | | } |
| | 159 | | default: |
| 0 | 160 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 161 | | } |
| 0 | 162 | | } |
| | 163 | |
|
| | 164 | | internal HttpMessage CreateListRequest(string resourceGroupName, string circuitName, string peeringName) |
| | 165 | | { |
| 0 | 166 | | var message = _pipeline.CreateMessage(); |
| 0 | 167 | | var request = message.Request; |
| 0 | 168 | | request.Method = RequestMethod.Get; |
| 0 | 169 | | var uri = new RawRequestUriBuilder(); |
| 0 | 170 | | uri.Reset(endpoint); |
| 0 | 171 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 172 | | uri.AppendPath(subscriptionId, true); |
| 0 | 173 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 174 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 175 | | uri.AppendPath("/providers/Microsoft.Network/expressRouteCircuits/", false); |
| 0 | 176 | | uri.AppendPath(circuitName, true); |
| 0 | 177 | | uri.AppendPath("/peerings/", false); |
| 0 | 178 | | uri.AppendPath(peeringName, true); |
| 0 | 179 | | uri.AppendPath("/peerConnections", false); |
| 0 | 180 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 181 | | request.Uri = uri; |
| 0 | 182 | | return message; |
| | 183 | | } |
| | 184 | |
|
| | 185 | | /// <summary> Gets all global reach peer connections associated with a private peering in an express route circu |
| | 186 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 187 | | /// <param name="circuitName"> The name of the circuit. </param> |
| | 188 | | /// <param name="peeringName"> The name of the peering. </param> |
| | 189 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 190 | | public async Task<Response<PeerExpressRouteCircuitConnectionListResult>> ListAsync(string resourceGroupName, str |
| | 191 | | { |
| 0 | 192 | | if (resourceGroupName == null) |
| | 193 | | { |
| 0 | 194 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 195 | | } |
| 0 | 196 | | if (circuitName == null) |
| | 197 | | { |
| 0 | 198 | | throw new ArgumentNullException(nameof(circuitName)); |
| | 199 | | } |
| 0 | 200 | | if (peeringName == null) |
| | 201 | | { |
| 0 | 202 | | throw new ArgumentNullException(nameof(peeringName)); |
| | 203 | | } |
| | 204 | |
|
| 0 | 205 | | using var message = CreateListRequest(resourceGroupName, circuitName, peeringName); |
| 0 | 206 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 207 | | switch (message.Response.Status) |
| | 208 | | { |
| | 209 | | case 200: |
| | 210 | | { |
| 0 | 211 | | PeerExpressRouteCircuitConnectionListResult value = default; |
| 0 | 212 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 213 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 214 | | { |
| 0 | 215 | | value = null; |
| | 216 | | } |
| | 217 | | else |
| | 218 | | { |
| 0 | 219 | | value = PeerExpressRouteCircuitConnectionListResult.DeserializePeerExpressRouteCircuitConnec |
| | 220 | | } |
| 0 | 221 | | return Response.FromValue(value, message.Response); |
| | 222 | | } |
| | 223 | | default: |
| 0 | 224 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 225 | | } |
| 0 | 226 | | } |
| | 227 | |
|
| | 228 | | /// <summary> Gets all global reach peer connections associated with a private peering in an express route circu |
| | 229 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 230 | | /// <param name="circuitName"> The name of the circuit. </param> |
| | 231 | | /// <param name="peeringName"> The name of the peering. </param> |
| | 232 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 233 | | public Response<PeerExpressRouteCircuitConnectionListResult> List(string resourceGroupName, string circuitName, |
| | 234 | | { |
| 0 | 235 | | if (resourceGroupName == null) |
| | 236 | | { |
| 0 | 237 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 238 | | } |
| 0 | 239 | | if (circuitName == null) |
| | 240 | | { |
| 0 | 241 | | throw new ArgumentNullException(nameof(circuitName)); |
| | 242 | | } |
| 0 | 243 | | if (peeringName == null) |
| | 244 | | { |
| 0 | 245 | | throw new ArgumentNullException(nameof(peeringName)); |
| | 246 | | } |
| | 247 | |
|
| 0 | 248 | | using var message = CreateListRequest(resourceGroupName, circuitName, peeringName); |
| 0 | 249 | | _pipeline.Send(message, cancellationToken); |
| 0 | 250 | | switch (message.Response.Status) |
| | 251 | | { |
| | 252 | | case 200: |
| | 253 | | { |
| 0 | 254 | | PeerExpressRouteCircuitConnectionListResult value = default; |
| 0 | 255 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 256 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 257 | | { |
| 0 | 258 | | value = null; |
| | 259 | | } |
| | 260 | | else |
| | 261 | | { |
| 0 | 262 | | value = PeerExpressRouteCircuitConnectionListResult.DeserializePeerExpressRouteCircuitConnec |
| | 263 | | } |
| 0 | 264 | | return Response.FromValue(value, message.Response); |
| | 265 | | } |
| | 266 | | default: |
| 0 | 267 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 268 | | } |
| 0 | 269 | | } |
| | 270 | |
|
| | 271 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string circuitName, st |
| | 272 | | { |
| 0 | 273 | | var message = _pipeline.CreateMessage(); |
| 0 | 274 | | var request = message.Request; |
| 0 | 275 | | request.Method = RequestMethod.Get; |
| 0 | 276 | | var uri = new RawRequestUriBuilder(); |
| 0 | 277 | | uri.Reset(endpoint); |
| 0 | 278 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 279 | | request.Uri = uri; |
| 0 | 280 | | return message; |
| | 281 | | } |
| | 282 | |
|
| | 283 | | /// <summary> Gets all global reach peer connections associated with a private peering in an express route circu |
| | 284 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 285 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 286 | | /// <param name="circuitName"> The name of the circuit. </param> |
| | 287 | | /// <param name="peeringName"> The name of the peering. </param> |
| | 288 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 289 | | public async Task<Response<PeerExpressRouteCircuitConnectionListResult>> ListNextPageAsync(string nextLink, stri |
| | 290 | | { |
| 0 | 291 | | if (nextLink == null) |
| | 292 | | { |
| 0 | 293 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 294 | | } |
| 0 | 295 | | if (resourceGroupName == null) |
| | 296 | | { |
| 0 | 297 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 298 | | } |
| 0 | 299 | | if (circuitName == null) |
| | 300 | | { |
| 0 | 301 | | throw new ArgumentNullException(nameof(circuitName)); |
| | 302 | | } |
| 0 | 303 | | if (peeringName == null) |
| | 304 | | { |
| 0 | 305 | | throw new ArgumentNullException(nameof(peeringName)); |
| | 306 | | } |
| | 307 | |
|
| 0 | 308 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, circuitName, peeringName); |
| 0 | 309 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 310 | | switch (message.Response.Status) |
| | 311 | | { |
| | 312 | | case 200: |
| | 313 | | { |
| 0 | 314 | | PeerExpressRouteCircuitConnectionListResult value = default; |
| 0 | 315 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 316 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 317 | | { |
| 0 | 318 | | value = null; |
| | 319 | | } |
| | 320 | | else |
| | 321 | | { |
| 0 | 322 | | value = PeerExpressRouteCircuitConnectionListResult.DeserializePeerExpressRouteCircuitConnec |
| | 323 | | } |
| 0 | 324 | | return Response.FromValue(value, message.Response); |
| | 325 | | } |
| | 326 | | default: |
| 0 | 327 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 328 | | } |
| 0 | 329 | | } |
| | 330 | |
|
| | 331 | | /// <summary> Gets all global reach peer connections associated with a private peering in an express route circu |
| | 332 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 333 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 334 | | /// <param name="circuitName"> The name of the circuit. </param> |
| | 335 | | /// <param name="peeringName"> The name of the peering. </param> |
| | 336 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 337 | | public Response<PeerExpressRouteCircuitConnectionListResult> ListNextPage(string nextLink, string resourceGroupN |
| | 338 | | { |
| 0 | 339 | | if (nextLink == null) |
| | 340 | | { |
| 0 | 341 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 342 | | } |
| 0 | 343 | | if (resourceGroupName == null) |
| | 344 | | { |
| 0 | 345 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 346 | | } |
| 0 | 347 | | if (circuitName == null) |
| | 348 | | { |
| 0 | 349 | | throw new ArgumentNullException(nameof(circuitName)); |
| | 350 | | } |
| 0 | 351 | | if (peeringName == null) |
| | 352 | | { |
| 0 | 353 | | throw new ArgumentNullException(nameof(peeringName)); |
| | 354 | | } |
| | 355 | |
|
| 0 | 356 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, circuitName, peeringName); |
| 0 | 357 | | _pipeline.Send(message, cancellationToken); |
| 0 | 358 | | switch (message.Response.Status) |
| | 359 | | { |
| | 360 | | case 200: |
| | 361 | | { |
| 0 | 362 | | PeerExpressRouteCircuitConnectionListResult value = default; |
| 0 | 363 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 364 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 365 | | { |
| 0 | 366 | | value = null; |
| | 367 | | } |
| | 368 | | else |
| | 369 | | { |
| 0 | 370 | | value = PeerExpressRouteCircuitConnectionListResult.DeserializePeerExpressRouteCircuitConnec |
| | 371 | | } |
| 0 | 372 | | return Response.FromValue(value, message.Response); |
| | 373 | | } |
| | 374 | | default: |
| 0 | 375 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 376 | | } |
| 0 | 377 | | } |
| | 378 | | } |
| | 379 | | } |