| | | 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 ExpressRouteCrossConnectionPeeringsRestOperations |
| | | 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 ExpressRouteCrossConnectionPeeringsRestOperations. </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 ExpressRouteCrossConnectionPeeringsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipel |
| | | 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 CreateListRequest(string resourceGroupName, string crossConnectionName) |
| | | 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/expressRouteCrossConnections/", false); |
| | 0 | 58 | | uri.AppendPath(crossConnectionName, true); |
| | 0 | 59 | | uri.AppendPath("/peerings", false); |
| | 0 | 60 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| | 0 | 61 | | request.Uri = uri; |
| | 0 | 62 | | return message; |
| | | 63 | | } |
| | | 64 | | |
| | | 65 | | /// <summary> Gets all peerings in a specified ExpressRouteCrossConnection. </summary> |
| | | 66 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 67 | | /// <param name="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 68 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 69 | | public async Task<Response<ExpressRouteCrossConnectionPeeringList>> ListAsync(string resourceGroupName, string c |
| | | 70 | | { |
| | 0 | 71 | | if (resourceGroupName == null) |
| | | 72 | | { |
| | 0 | 73 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 74 | | } |
| | 0 | 75 | | if (crossConnectionName == null) |
| | | 76 | | { |
| | 0 | 77 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 78 | | } |
| | | 79 | | |
| | 0 | 80 | | using var message = CreateListRequest(resourceGroupName, crossConnectionName); |
| | 0 | 81 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 82 | | switch (message.Response.Status) |
| | | 83 | | { |
| | | 84 | | case 200: |
| | | 85 | | { |
| | 0 | 86 | | ExpressRouteCrossConnectionPeeringList 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 = ExpressRouteCrossConnectionPeeringList.DeserializeExpressRouteCrossConnectionPeering |
| | | 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 all peerings in a specified ExpressRouteCrossConnection. </summary> |
| | | 104 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 105 | | /// <param name="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 106 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 107 | | public Response<ExpressRouteCrossConnectionPeeringList> List(string resourceGroupName, string crossConnectionNam |
| | | 108 | | { |
| | 0 | 109 | | if (resourceGroupName == null) |
| | | 110 | | { |
| | 0 | 111 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 112 | | } |
| | 0 | 113 | | if (crossConnectionName == null) |
| | | 114 | | { |
| | 0 | 115 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 116 | | } |
| | | 117 | | |
| | 0 | 118 | | using var message = CreateListRequest(resourceGroupName, crossConnectionName); |
| | 0 | 119 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 120 | | switch (message.Response.Status) |
| | | 121 | | { |
| | | 122 | | case 200: |
| | | 123 | | { |
| | 0 | 124 | | ExpressRouteCrossConnectionPeeringList 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 = ExpressRouteCrossConnectionPeeringList.DeserializeExpressRouteCrossConnectionPeering |
| | | 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 CreateDeleteRequest(string resourceGroupName, string crossConnectionName, string peeringNam |
| | | 142 | | { |
| | 0 | 143 | | var message = _pipeline.CreateMessage(); |
| | 0 | 144 | | var request = message.Request; |
| | 0 | 145 | | request.Method = RequestMethod.Delete; |
| | 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.Network/expressRouteCrossConnections/", false); |
| | 0 | 153 | | uri.AppendPath(crossConnectionName, true); |
| | 0 | 154 | | uri.AppendPath("/peerings/", false); |
| | 0 | 155 | | uri.AppendPath(peeringName, true); |
| | 0 | 156 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| | 0 | 157 | | request.Uri = uri; |
| | 0 | 158 | | return message; |
| | | 159 | | } |
| | | 160 | | |
| | | 161 | | /// <summary> Deletes the specified peering from the ExpressRouteCrossConnection. </summary> |
| | | 162 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 163 | | /// <param name="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 164 | | /// <param name="peeringName"> The name of the peering. </param> |
| | | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 166 | | public async Task<Response> DeleteAsync(string resourceGroupName, string crossConnectionName, string peeringName |
| | | 167 | | { |
| | 0 | 168 | | if (resourceGroupName == null) |
| | | 169 | | { |
| | 0 | 170 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 171 | | } |
| | 0 | 172 | | if (crossConnectionName == null) |
| | | 173 | | { |
| | 0 | 174 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 175 | | } |
| | 0 | 176 | | if (peeringName == null) |
| | | 177 | | { |
| | 0 | 178 | | throw new ArgumentNullException(nameof(peeringName)); |
| | | 179 | | } |
| | | 180 | | |
| | 0 | 181 | | using var message = CreateDeleteRequest(resourceGroupName, crossConnectionName, peeringName); |
| | 0 | 182 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 183 | | switch (message.Response.Status) |
| | | 184 | | { |
| | | 185 | | case 200: |
| | | 186 | | case 202: |
| | | 187 | | case 204: |
| | 0 | 188 | | return message.Response; |
| | | 189 | | default: |
| | 0 | 190 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 191 | | } |
| | 0 | 192 | | } |
| | | 193 | | |
| | | 194 | | /// <summary> Deletes the specified peering from the ExpressRouteCrossConnection. </summary> |
| | | 195 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 196 | | /// <param name="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 197 | | /// <param name="peeringName"> The name of the peering. </param> |
| | | 198 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 199 | | public Response Delete(string resourceGroupName, string crossConnectionName, string peeringName, CancellationTok |
| | | 200 | | { |
| | 0 | 201 | | if (resourceGroupName == null) |
| | | 202 | | { |
| | 0 | 203 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 204 | | } |
| | 0 | 205 | | if (crossConnectionName == null) |
| | | 206 | | { |
| | 0 | 207 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 208 | | } |
| | 0 | 209 | | if (peeringName == null) |
| | | 210 | | { |
| | 0 | 211 | | throw new ArgumentNullException(nameof(peeringName)); |
| | | 212 | | } |
| | | 213 | | |
| | 0 | 214 | | using var message = CreateDeleteRequest(resourceGroupName, crossConnectionName, peeringName); |
| | 0 | 215 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 216 | | switch (message.Response.Status) |
| | | 217 | | { |
| | | 218 | | case 200: |
| | | 219 | | case 202: |
| | | 220 | | case 204: |
| | 0 | 221 | | return message.Response; |
| | | 222 | | default: |
| | 0 | 223 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 224 | | } |
| | 0 | 225 | | } |
| | | 226 | | |
| | | 227 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string crossConnectionName, string peeringName) |
| | | 228 | | { |
| | 0 | 229 | | var message = _pipeline.CreateMessage(); |
| | 0 | 230 | | var request = message.Request; |
| | 0 | 231 | | request.Method = RequestMethod.Get; |
| | 0 | 232 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 233 | | uri.Reset(endpoint); |
| | 0 | 234 | | uri.AppendPath("/subscriptions/", false); |
| | 0 | 235 | | uri.AppendPath(subscriptionId, true); |
| | 0 | 236 | | uri.AppendPath("/resourceGroups/", false); |
| | 0 | 237 | | uri.AppendPath(resourceGroupName, true); |
| | 0 | 238 | | uri.AppendPath("/providers/Microsoft.Network/expressRouteCrossConnections/", false); |
| | 0 | 239 | | uri.AppendPath(crossConnectionName, true); |
| | 0 | 240 | | uri.AppendPath("/peerings/", false); |
| | 0 | 241 | | uri.AppendPath(peeringName, true); |
| | 0 | 242 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| | 0 | 243 | | request.Uri = uri; |
| | 0 | 244 | | return message; |
| | | 245 | | } |
| | | 246 | | |
| | | 247 | | /// <summary> Gets the specified peering for the ExpressRouteCrossConnection. </summary> |
| | | 248 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 249 | | /// <param name="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 250 | | /// <param name="peeringName"> The name of the peering. </param> |
| | | 251 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 252 | | public async Task<Response<ExpressRouteCrossConnectionPeering>> GetAsync(string resourceGroupName, string crossC |
| | | 253 | | { |
| | 0 | 254 | | if (resourceGroupName == null) |
| | | 255 | | { |
| | 0 | 256 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 257 | | } |
| | 0 | 258 | | if (crossConnectionName == null) |
| | | 259 | | { |
| | 0 | 260 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 261 | | } |
| | 0 | 262 | | if (peeringName == null) |
| | | 263 | | { |
| | 0 | 264 | | throw new ArgumentNullException(nameof(peeringName)); |
| | | 265 | | } |
| | | 266 | | |
| | 0 | 267 | | using var message = CreateGetRequest(resourceGroupName, crossConnectionName, peeringName); |
| | 0 | 268 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 269 | | switch (message.Response.Status) |
| | | 270 | | { |
| | | 271 | | case 200: |
| | | 272 | | { |
| | 0 | 273 | | ExpressRouteCrossConnectionPeering value = default; |
| | 0 | 274 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| | 0 | 275 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 276 | | { |
| | 0 | 277 | | value = null; |
| | | 278 | | } |
| | | 279 | | else |
| | | 280 | | { |
| | 0 | 281 | | value = ExpressRouteCrossConnectionPeering.DeserializeExpressRouteCrossConnectionPeering(doc |
| | | 282 | | } |
| | 0 | 283 | | return Response.FromValue(value, message.Response); |
| | | 284 | | } |
| | | 285 | | default: |
| | 0 | 286 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 287 | | } |
| | 0 | 288 | | } |
| | | 289 | | |
| | | 290 | | /// <summary> Gets the specified peering for the ExpressRouteCrossConnection. </summary> |
| | | 291 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 292 | | /// <param name="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 293 | | /// <param name="peeringName"> The name of the peering. </param> |
| | | 294 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 295 | | public Response<ExpressRouteCrossConnectionPeering> Get(string resourceGroupName, string crossConnectionName, st |
| | | 296 | | { |
| | 0 | 297 | | if (resourceGroupName == null) |
| | | 298 | | { |
| | 0 | 299 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 300 | | } |
| | 0 | 301 | | if (crossConnectionName == null) |
| | | 302 | | { |
| | 0 | 303 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 304 | | } |
| | 0 | 305 | | if (peeringName == null) |
| | | 306 | | { |
| | 0 | 307 | | throw new ArgumentNullException(nameof(peeringName)); |
| | | 308 | | } |
| | | 309 | | |
| | 0 | 310 | | using var message = CreateGetRequest(resourceGroupName, crossConnectionName, peeringName); |
| | 0 | 311 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 312 | | switch (message.Response.Status) |
| | | 313 | | { |
| | | 314 | | case 200: |
| | | 315 | | { |
| | 0 | 316 | | ExpressRouteCrossConnectionPeering value = default; |
| | 0 | 317 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| | 0 | 318 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 319 | | { |
| | 0 | 320 | | value = null; |
| | | 321 | | } |
| | | 322 | | else |
| | | 323 | | { |
| | 0 | 324 | | value = ExpressRouteCrossConnectionPeering.DeserializeExpressRouteCrossConnectionPeering(doc |
| | | 325 | | } |
| | 0 | 326 | | return Response.FromValue(value, message.Response); |
| | | 327 | | } |
| | | 328 | | default: |
| | 0 | 329 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 330 | | } |
| | 0 | 331 | | } |
| | | 332 | | |
| | | 333 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string crossConnectionName, string pe |
| | | 334 | | { |
| | 0 | 335 | | var message = _pipeline.CreateMessage(); |
| | 0 | 336 | | var request = message.Request; |
| | 0 | 337 | | request.Method = RequestMethod.Put; |
| | 0 | 338 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 339 | | uri.Reset(endpoint); |
| | 0 | 340 | | uri.AppendPath("/subscriptions/", false); |
| | 0 | 341 | | uri.AppendPath(subscriptionId, true); |
| | 0 | 342 | | uri.AppendPath("/resourceGroups/", false); |
| | 0 | 343 | | uri.AppendPath(resourceGroupName, true); |
| | 0 | 344 | | uri.AppendPath("/providers/Microsoft.Network/expressRouteCrossConnections/", false); |
| | 0 | 345 | | uri.AppendPath(crossConnectionName, true); |
| | 0 | 346 | | uri.AppendPath("/peerings/", false); |
| | 0 | 347 | | uri.AppendPath(peeringName, true); |
| | 0 | 348 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| | 0 | 349 | | request.Uri = uri; |
| | 0 | 350 | | request.Headers.Add("Content-Type", "application/json"); |
| | 0 | 351 | | var content = new Utf8JsonRequestContent(); |
| | 0 | 352 | | content.JsonWriter.WriteObjectValue(peeringParameters); |
| | 0 | 353 | | request.Content = content; |
| | 0 | 354 | | return message; |
| | | 355 | | } |
| | | 356 | | |
| | | 357 | | /// <summary> Creates or updates a peering in the specified ExpressRouteCrossConnection. </summary> |
| | | 358 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 359 | | /// <param name="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 360 | | /// <param name="peeringName"> The name of the peering. </param> |
| | | 361 | | /// <param name="peeringParameters"> Parameters supplied to the create or update ExpressRouteCrossConnection pee |
| | | 362 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 363 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string crossConnectionName, string pee |
| | | 364 | | { |
| | 0 | 365 | | if (resourceGroupName == null) |
| | | 366 | | { |
| | 0 | 367 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 368 | | } |
| | 0 | 369 | | if (crossConnectionName == null) |
| | | 370 | | { |
| | 0 | 371 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 372 | | } |
| | 0 | 373 | | if (peeringName == null) |
| | | 374 | | { |
| | 0 | 375 | | throw new ArgumentNullException(nameof(peeringName)); |
| | | 376 | | } |
| | 0 | 377 | | if (peeringParameters == null) |
| | | 378 | | { |
| | 0 | 379 | | throw new ArgumentNullException(nameof(peeringParameters)); |
| | | 380 | | } |
| | | 381 | | |
| | 0 | 382 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, crossConnectionName, peeringName, peering |
| | 0 | 383 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 384 | | switch (message.Response.Status) |
| | | 385 | | { |
| | | 386 | | case 200: |
| | | 387 | | case 201: |
| | 0 | 388 | | return message.Response; |
| | | 389 | | default: |
| | 0 | 390 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 391 | | } |
| | 0 | 392 | | } |
| | | 393 | | |
| | | 394 | | /// <summary> Creates or updates a peering in the specified ExpressRouteCrossConnection. </summary> |
| | | 395 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 396 | | /// <param name="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 397 | | /// <param name="peeringName"> The name of the peering. </param> |
| | | 398 | | /// <param name="peeringParameters"> Parameters supplied to the create or update ExpressRouteCrossConnection pee |
| | | 399 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 400 | | public Response CreateOrUpdate(string resourceGroupName, string crossConnectionName, string peeringName, Express |
| | | 401 | | { |
| | 0 | 402 | | if (resourceGroupName == null) |
| | | 403 | | { |
| | 0 | 404 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 405 | | } |
| | 0 | 406 | | if (crossConnectionName == null) |
| | | 407 | | { |
| | 0 | 408 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 409 | | } |
| | 0 | 410 | | if (peeringName == null) |
| | | 411 | | { |
| | 0 | 412 | | throw new ArgumentNullException(nameof(peeringName)); |
| | | 413 | | } |
| | 0 | 414 | | if (peeringParameters == null) |
| | | 415 | | { |
| | 0 | 416 | | throw new ArgumentNullException(nameof(peeringParameters)); |
| | | 417 | | } |
| | | 418 | | |
| | 0 | 419 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, crossConnectionName, peeringName, peering |
| | 0 | 420 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 421 | | switch (message.Response.Status) |
| | | 422 | | { |
| | | 423 | | case 200: |
| | | 424 | | case 201: |
| | 0 | 425 | | return message.Response; |
| | | 426 | | default: |
| | 0 | 427 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 428 | | } |
| | 0 | 429 | | } |
| | | 430 | | |
| | | 431 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string crossConnection |
| | | 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 ExpressRouteCrossConnection. </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="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 447 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 448 | | public async Task<Response<ExpressRouteCrossConnectionPeeringList>> ListNextPageAsync(string nextLink, string re |
| | | 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 (crossConnectionName == null) |
| | | 459 | | { |
| | 0 | 460 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 461 | | } |
| | | 462 | | |
| | 0 | 463 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, crossConnectionName); |
| | 0 | 464 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 465 | | switch (message.Response.Status) |
| | | 466 | | { |
| | | 467 | | case 200: |
| | | 468 | | { |
| | 0 | 469 | | ExpressRouteCrossConnectionPeeringList 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 = ExpressRouteCrossConnectionPeeringList.DeserializeExpressRouteCrossConnectionPeering |
| | | 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 ExpressRouteCrossConnection. </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="crossConnectionName"> The name of the ExpressRouteCrossConnection. </param> |
| | | 490 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 491 | | public Response<ExpressRouteCrossConnectionPeeringList> ListNextPage(string nextLink, string resourceGroupName, |
| | | 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 (crossConnectionName == null) |
| | | 502 | | { |
| | 0 | 503 | | throw new ArgumentNullException(nameof(crossConnectionName)); |
| | | 504 | | } |
| | | 505 | | |
| | 0 | 506 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, crossConnectionName); |
| | 0 | 507 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 508 | | switch (message.Response.Status) |
| | | 509 | | { |
| | | 510 | | case 200: |
| | | 511 | | { |
| | 0 | 512 | | ExpressRouteCrossConnectionPeeringList 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 = ExpressRouteCrossConnectionPeeringList.DeserializeExpressRouteCrossConnectionPeering |
| | | 521 | | } |
| | 0 | 522 | | return Response.FromValue(value, message.Response); |
| | | 523 | | } |
| | | 524 | | default: |
| | 0 | 525 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 526 | | } |
| | 0 | 527 | | } |
| | | 528 | | } |
| | | 529 | | } |