| | 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 HubRouteTablesRestOperations |
| | 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 HubRouteTablesRestOperations. </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 HubRouteTablesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript |
| | 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 CreateCreateOrUpdateRequest(string resourceGroupName, string virtualHubName, string routeTa |
| | 47 | | { |
| 0 | 48 | | var message = _pipeline.CreateMessage(); |
| 0 | 49 | | var request = message.Request; |
| 0 | 50 | | request.Method = RequestMethod.Put; |
| 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/virtualHubs/", false); |
| 0 | 58 | | uri.AppendPath(virtualHubName, true); |
| 0 | 59 | | uri.AppendPath("/hubRouteTables/", false); |
| 0 | 60 | | uri.AppendPath(routeTableName, true); |
| 0 | 61 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 62 | | request.Uri = uri; |
| 0 | 63 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 64 | | var content = new Utf8JsonRequestContent(); |
| 0 | 65 | | content.JsonWriter.WriteObjectValue(routeTableParameters); |
| 0 | 66 | | request.Content = content; |
| 0 | 67 | | return message; |
| | 68 | | } |
| | 69 | |
|
| | 70 | | /// <summary> Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. </sum |
| | 71 | | /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param> |
| | 72 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 73 | | /// <param name="routeTableName"> The name of the RouteTable. </param> |
| | 74 | | /// <param name="routeTableParameters"> Parameters supplied to create or update RouteTable. </param> |
| | 75 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 76 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string virtualHubName, string routeTab |
| | 77 | | { |
| 0 | 78 | | if (resourceGroupName == null) |
| | 79 | | { |
| 0 | 80 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 81 | | } |
| 0 | 82 | | if (virtualHubName == null) |
| | 83 | | { |
| 0 | 84 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 85 | | } |
| 0 | 86 | | if (routeTableName == null) |
| | 87 | | { |
| 0 | 88 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 89 | | } |
| 0 | 90 | | if (routeTableParameters == null) |
| | 91 | | { |
| 0 | 92 | | throw new ArgumentNullException(nameof(routeTableParameters)); |
| | 93 | | } |
| | 94 | |
|
| 0 | 95 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualHubName, routeTableName, routeTabl |
| 0 | 96 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 97 | | switch (message.Response.Status) |
| | 98 | | { |
| | 99 | | case 200: |
| | 100 | | case 201: |
| 0 | 101 | | return message.Response; |
| | 102 | | default: |
| 0 | 103 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 104 | | } |
| 0 | 105 | | } |
| | 106 | |
|
| | 107 | | /// <summary> Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. </sum |
| | 108 | | /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param> |
| | 109 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 110 | | /// <param name="routeTableName"> The name of the RouteTable. </param> |
| | 111 | | /// <param name="routeTableParameters"> Parameters supplied to create or update RouteTable. </param> |
| | 112 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 113 | | public Response CreateOrUpdate(string resourceGroupName, string virtualHubName, string routeTableName, HubRouteT |
| | 114 | | { |
| 0 | 115 | | if (resourceGroupName == null) |
| | 116 | | { |
| 0 | 117 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 118 | | } |
| 0 | 119 | | if (virtualHubName == null) |
| | 120 | | { |
| 0 | 121 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 122 | | } |
| 0 | 123 | | if (routeTableName == null) |
| | 124 | | { |
| 0 | 125 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 126 | | } |
| 0 | 127 | | if (routeTableParameters == null) |
| | 128 | | { |
| 0 | 129 | | throw new ArgumentNullException(nameof(routeTableParameters)); |
| | 130 | | } |
| | 131 | |
|
| 0 | 132 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualHubName, routeTableName, routeTabl |
| 0 | 133 | | _pipeline.Send(message, cancellationToken); |
| 0 | 134 | | switch (message.Response.Status) |
| | 135 | | { |
| | 136 | | case 200: |
| | 137 | | case 201: |
| 0 | 138 | | return message.Response; |
| | 139 | | default: |
| 0 | 140 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 141 | | } |
| 0 | 142 | | } |
| | 143 | |
|
| | 144 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string virtualHubName, string routeTableName) |
| | 145 | | { |
| 0 | 146 | | var message = _pipeline.CreateMessage(); |
| 0 | 147 | | var request = message.Request; |
| 0 | 148 | | request.Method = RequestMethod.Get; |
| 0 | 149 | | var uri = new RawRequestUriBuilder(); |
| 0 | 150 | | uri.Reset(endpoint); |
| 0 | 151 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 152 | | uri.AppendPath(subscriptionId, true); |
| 0 | 153 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 154 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 155 | | uri.AppendPath("/providers/Microsoft.Network/virtualHubs/", false); |
| 0 | 156 | | uri.AppendPath(virtualHubName, true); |
| 0 | 157 | | uri.AppendPath("/hubRouteTables/", false); |
| 0 | 158 | | uri.AppendPath(routeTableName, true); |
| 0 | 159 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 160 | | request.Uri = uri; |
| 0 | 161 | | return message; |
| | 162 | | } |
| | 163 | |
|
| | 164 | | /// <summary> Retrieves the details of a RouteTable. </summary> |
| | 165 | | /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param> |
| | 166 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 167 | | /// <param name="routeTableName"> The name of the RouteTable. </param> |
| | 168 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 169 | | public async Task<Response<HubRouteTable>> GetAsync(string resourceGroupName, string virtualHubName, string rout |
| | 170 | | { |
| 0 | 171 | | if (resourceGroupName == null) |
| | 172 | | { |
| 0 | 173 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 174 | | } |
| 0 | 175 | | if (virtualHubName == null) |
| | 176 | | { |
| 0 | 177 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 178 | | } |
| 0 | 179 | | if (routeTableName == null) |
| | 180 | | { |
| 0 | 181 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 182 | | } |
| | 183 | |
|
| 0 | 184 | | using var message = CreateGetRequest(resourceGroupName, virtualHubName, routeTableName); |
| 0 | 185 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 186 | | switch (message.Response.Status) |
| | 187 | | { |
| | 188 | | case 200: |
| | 189 | | { |
| 0 | 190 | | HubRouteTable value = default; |
| 0 | 191 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 192 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 193 | | { |
| 0 | 194 | | value = null; |
| | 195 | | } |
| | 196 | | else |
| | 197 | | { |
| 0 | 198 | | value = HubRouteTable.DeserializeHubRouteTable(document.RootElement); |
| | 199 | | } |
| 0 | 200 | | return Response.FromValue(value, message.Response); |
| | 201 | | } |
| | 202 | | default: |
| 0 | 203 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 204 | | } |
| 0 | 205 | | } |
| | 206 | |
|
| | 207 | | /// <summary> Retrieves the details of a RouteTable. </summary> |
| | 208 | | /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param> |
| | 209 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 210 | | /// <param name="routeTableName"> The name of the RouteTable. </param> |
| | 211 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 212 | | public Response<HubRouteTable> Get(string resourceGroupName, string virtualHubName, string routeTableName, Cance |
| | 213 | | { |
| 0 | 214 | | if (resourceGroupName == null) |
| | 215 | | { |
| 0 | 216 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 217 | | } |
| 0 | 218 | | if (virtualHubName == null) |
| | 219 | | { |
| 0 | 220 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 221 | | } |
| 0 | 222 | | if (routeTableName == null) |
| | 223 | | { |
| 0 | 224 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 225 | | } |
| | 226 | |
|
| 0 | 227 | | using var message = CreateGetRequest(resourceGroupName, virtualHubName, routeTableName); |
| 0 | 228 | | _pipeline.Send(message, cancellationToken); |
| 0 | 229 | | switch (message.Response.Status) |
| | 230 | | { |
| | 231 | | case 200: |
| | 232 | | { |
| 0 | 233 | | HubRouteTable value = default; |
| 0 | 234 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 235 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 236 | | { |
| 0 | 237 | | value = null; |
| | 238 | | } |
| | 239 | | else |
| | 240 | | { |
| 0 | 241 | | value = HubRouteTable.DeserializeHubRouteTable(document.RootElement); |
| | 242 | | } |
| 0 | 243 | | return Response.FromValue(value, message.Response); |
| | 244 | | } |
| | 245 | | default: |
| 0 | 246 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 247 | | } |
| 0 | 248 | | } |
| | 249 | |
|
| | 250 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string virtualHubName, string routeTableName) |
| | 251 | | { |
| 0 | 252 | | var message = _pipeline.CreateMessage(); |
| 0 | 253 | | var request = message.Request; |
| 0 | 254 | | request.Method = RequestMethod.Delete; |
| 0 | 255 | | var uri = new RawRequestUriBuilder(); |
| 0 | 256 | | uri.Reset(endpoint); |
| 0 | 257 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 258 | | uri.AppendPath(subscriptionId, true); |
| 0 | 259 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 260 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 261 | | uri.AppendPath("/providers/Microsoft.Network/virtualHubs/", false); |
| 0 | 262 | | uri.AppendPath(virtualHubName, true); |
| 0 | 263 | | uri.AppendPath("/hubRouteTables/", false); |
| 0 | 264 | | uri.AppendPath(routeTableName, true); |
| 0 | 265 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 266 | | request.Uri = uri; |
| 0 | 267 | | return message; |
| | 268 | | } |
| | 269 | |
|
| | 270 | | /// <summary> Deletes a RouteTable. </summary> |
| | 271 | | /// <param name="resourceGroupName"> The resource group name of the RouteTable. </param> |
| | 272 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 273 | | /// <param name="routeTableName"> The name of the RouteTable. </param> |
| | 274 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 275 | | public async Task<Response> DeleteAsync(string resourceGroupName, string virtualHubName, string routeTableName, |
| | 276 | | { |
| 0 | 277 | | if (resourceGroupName == null) |
| | 278 | | { |
| 0 | 279 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 280 | | } |
| 0 | 281 | | if (virtualHubName == null) |
| | 282 | | { |
| 0 | 283 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 284 | | } |
| 0 | 285 | | if (routeTableName == null) |
| | 286 | | { |
| 0 | 287 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 288 | | } |
| | 289 | |
|
| 0 | 290 | | using var message = CreateDeleteRequest(resourceGroupName, virtualHubName, routeTableName); |
| 0 | 291 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 292 | | switch (message.Response.Status) |
| | 293 | | { |
| | 294 | | case 200: |
| | 295 | | case 202: |
| | 296 | | case 204: |
| 0 | 297 | | return message.Response; |
| | 298 | | default: |
| 0 | 299 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 300 | | } |
| 0 | 301 | | } |
| | 302 | |
|
| | 303 | | /// <summary> Deletes a RouteTable. </summary> |
| | 304 | | /// <param name="resourceGroupName"> The resource group name of the RouteTable. </param> |
| | 305 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 306 | | /// <param name="routeTableName"> The name of the RouteTable. </param> |
| | 307 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 308 | | public Response Delete(string resourceGroupName, string virtualHubName, string routeTableName, CancellationToken |
| | 309 | | { |
| 0 | 310 | | if (resourceGroupName == null) |
| | 311 | | { |
| 0 | 312 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 313 | | } |
| 0 | 314 | | if (virtualHubName == null) |
| | 315 | | { |
| 0 | 316 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 317 | | } |
| 0 | 318 | | if (routeTableName == null) |
| | 319 | | { |
| 0 | 320 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 321 | | } |
| | 322 | |
|
| 0 | 323 | | using var message = CreateDeleteRequest(resourceGroupName, virtualHubName, routeTableName); |
| 0 | 324 | | _pipeline.Send(message, cancellationToken); |
| 0 | 325 | | switch (message.Response.Status) |
| | 326 | | { |
| | 327 | | case 200: |
| | 328 | | case 202: |
| | 329 | | case 204: |
| 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 virtualHubName) |
| | 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/virtualHubs/", false); |
| 0 | 348 | | uri.AppendPath(virtualHubName, true); |
| 0 | 349 | | uri.AppendPath("/hubRouteTables", false); |
| 0 | 350 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 351 | | request.Uri = uri; |
| 0 | 352 | | return message; |
| | 353 | | } |
| | 354 | |
|
| | 355 | | /// <summary> Retrieves the details of all RouteTables. </summary> |
| | 356 | | /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param> |
| | 357 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 358 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 359 | | public async Task<Response<ListHubRouteTablesResult>> ListAsync(string resourceGroupName, string virtualHubName, |
| | 360 | | { |
| 0 | 361 | | if (resourceGroupName == null) |
| | 362 | | { |
| 0 | 363 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 364 | | } |
| 0 | 365 | | if (virtualHubName == null) |
| | 366 | | { |
| 0 | 367 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 368 | | } |
| | 369 | |
|
| 0 | 370 | | using var message = CreateListRequest(resourceGroupName, virtualHubName); |
| 0 | 371 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 372 | | switch (message.Response.Status) |
| | 373 | | { |
| | 374 | | case 200: |
| | 375 | | { |
| 0 | 376 | | ListHubRouteTablesResult 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 = ListHubRouteTablesResult.DeserializeListHubRouteTablesResult(document.RootElement); |
| | 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> Retrieves the details of all RouteTables. </summary> |
| | 394 | | /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param> |
| | 395 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 396 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 397 | | public Response<ListHubRouteTablesResult> List(string resourceGroupName, string virtualHubName, CancellationToke |
| | 398 | | { |
| 0 | 399 | | if (resourceGroupName == null) |
| | 400 | | { |
| 0 | 401 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 402 | | } |
| 0 | 403 | | if (virtualHubName == null) |
| | 404 | | { |
| 0 | 405 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 406 | | } |
| | 407 | |
|
| 0 | 408 | | using var message = CreateListRequest(resourceGroupName, virtualHubName); |
| 0 | 409 | | _pipeline.Send(message, cancellationToken); |
| 0 | 410 | | switch (message.Response.Status) |
| | 411 | | { |
| | 412 | | case 200: |
| | 413 | | { |
| 0 | 414 | | ListHubRouteTablesResult 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 = ListHubRouteTablesResult.DeserializeListHubRouteTablesResult(document.RootElement); |
| | 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 virtualHubName) |
| | 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> Retrieves the details of all RouteTables. </summary> |
| | 444 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 445 | | /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param> |
| | 446 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 447 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 448 | | public async Task<Response<ListHubRouteTablesResult>> ListNextPageAsync(string nextLink, string resourceGroupNam |
| | 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 (virtualHubName == null) |
| | 459 | | { |
| 0 | 460 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 461 | | } |
| | 462 | |
|
| 0 | 463 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, virtualHubName); |
| 0 | 464 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 465 | | switch (message.Response.Status) |
| | 466 | | { |
| | 467 | | case 200: |
| | 468 | | { |
| 0 | 469 | | ListHubRouteTablesResult 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 = ListHubRouteTablesResult.DeserializeListHubRouteTablesResult(document.RootElement); |
| | 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> Retrieves the details of all RouteTables. </summary> |
| | 487 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 488 | | /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param> |
| | 489 | | /// <param name="virtualHubName"> The name of the VirtualHub. </param> |
| | 490 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 491 | | public Response<ListHubRouteTablesResult> ListNextPage(string nextLink, string resourceGroupName, string virtual |
| | 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 (virtualHubName == null) |
| | 502 | | { |
| 0 | 503 | | throw new ArgumentNullException(nameof(virtualHubName)); |
| | 504 | | } |
| | 505 | |
|
| 0 | 506 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, virtualHubName); |
| 0 | 507 | | _pipeline.Send(message, cancellationToken); |
| 0 | 508 | | switch (message.Response.Status) |
| | 509 | | { |
| | 510 | | case 200: |
| | 511 | | { |
| 0 | 512 | | ListHubRouteTablesResult 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 = ListHubRouteTablesResult.DeserializeListHubRouteTablesResult(document.RootElement); |
| | 521 | | } |
| 0 | 522 | | return Response.FromValue(value, message.Response); |
| | 523 | | } |
| | 524 | | default: |
| 0 | 525 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 526 | | } |
| 0 | 527 | | } |
| | 528 | | } |
| | 529 | | } |