1package network 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/tracing" 25 "net/http" 26) 27 28// ExpressRouteCircuitsClient is the network Client 29type ExpressRouteCircuitsClient struct { 30 BaseClient 31} 32 33// NewExpressRouteCircuitsClient creates an instance of the ExpressRouteCircuitsClient client. 34func NewExpressRouteCircuitsClient(subscriptionID string) ExpressRouteCircuitsClient { 35 return NewExpressRouteCircuitsClientWithBaseURI(DefaultBaseURI, subscriptionID) 36} 37 38// NewExpressRouteCircuitsClientWithBaseURI creates an instance of the ExpressRouteCircuitsClient client using a custom 39// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure 40// stack). 41func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitsClient { 42 return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)} 43} 44 45// CreateOrUpdate creates or updates an express route circuit. 46// Parameters: 47// resourceGroupName - the name of the resource group. 48// circuitName - the name of the circuit. 49// parameters - parameters supplied to the create or update express route circuit operation. 50func (client ExpressRouteCircuitsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (result ExpressRouteCircuitsCreateOrUpdateFuture, err error) { 51 if tracing.IsEnabled() { 52 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.CreateOrUpdate") 53 defer func() { 54 sc := -1 55 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 56 sc = result.FutureAPI.Response().StatusCode 57 } 58 tracing.EndSpan(ctx, sc, err) 59 }() 60 } 61 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, parameters) 62 if err != nil { 63 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request") 64 return 65 } 66 67 result, err = client.CreateOrUpdateSender(req) 68 if err != nil { 69 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure sending request") 70 return 71 } 72 73 return 74} 75 76// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 77func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (*http.Request, error) { 78 pathParameters := map[string]interface{}{ 79 "circuitName": autorest.Encode("path", circuitName), 80 "resourceGroupName": autorest.Encode("path", resourceGroupName), 81 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 82 } 83 84 const APIVersion = "2018-02-01" 85 queryParameters := map[string]interface{}{ 86 "api-version": APIVersion, 87 } 88 89 parameters.Etag = nil 90 preparer := autorest.CreatePreparer( 91 autorest.AsContentType("application/json; charset=utf-8"), 92 autorest.AsPut(), 93 autorest.WithBaseURL(client.BaseURI), 94 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), 95 autorest.WithJSON(parameters), 96 autorest.WithQueryParameters(queryParameters)) 97 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 98} 99 100// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 101// http.Response Body if it receives an error. 102func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitsCreateOrUpdateFuture, err error) { 103 var resp *http.Response 104 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 105 if err != nil { 106 return 107 } 108 var azf azure.Future 109 azf, err = azure.NewFutureFromResponse(resp) 110 future.FutureAPI = &azf 111 future.Result = func(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { 112 var done bool 113 done, err = future.DoneWithContext(context.Background(), client) 114 if err != nil { 115 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 116 return 117 } 118 if !done { 119 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsCreateOrUpdateFuture") 120 return 121 } 122 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 123 erc.Response.Response, err = future.GetResult(sender) 124 if erc.Response.Response == nil && err == nil { 125 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", nil, "received nil response and error") 126 } 127 if err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { 128 erc, err = client.CreateOrUpdateResponder(erc.Response.Response) 129 if err != nil { 130 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") 131 } 132 } 133 return 134 } 135 return 136} 137 138// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 139// closes the http.Response Body. 140func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { 141 err = autorest.Respond( 142 resp, 143 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 144 autorest.ByUnmarshallingJSON(&result), 145 autorest.ByClosing()) 146 result.Response = autorest.Response{Response: resp} 147 return 148} 149 150// Delete deletes the specified express route circuit. 151// Parameters: 152// resourceGroupName - the name of the resource group. 153// circuitName - the name of the express route circuit. 154func (client ExpressRouteCircuitsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitsDeleteFuture, err error) { 155 if tracing.IsEnabled() { 156 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.Delete") 157 defer func() { 158 sc := -1 159 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 160 sc = result.FutureAPI.Response().StatusCode 161 } 162 tracing.EndSpan(ctx, sc, err) 163 }() 164 } 165 req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName) 166 if err != nil { 167 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request") 168 return 169 } 170 171 result, err = client.DeleteSender(req) 172 if err != nil { 173 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure sending request") 174 return 175 } 176 177 return 178} 179 180// DeletePreparer prepares the Delete request. 181func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) { 182 pathParameters := map[string]interface{}{ 183 "circuitName": autorest.Encode("path", circuitName), 184 "resourceGroupName": autorest.Encode("path", resourceGroupName), 185 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 186 } 187 188 const APIVersion = "2018-02-01" 189 queryParameters := map[string]interface{}{ 190 "api-version": APIVersion, 191 } 192 193 preparer := autorest.CreatePreparer( 194 autorest.AsDelete(), 195 autorest.WithBaseURL(client.BaseURI), 196 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), 197 autorest.WithQueryParameters(queryParameters)) 198 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 199} 200 201// DeleteSender sends the Delete request. The method will close the 202// http.Response Body if it receives an error. 203func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitsDeleteFuture, err error) { 204 var resp *http.Response 205 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 206 if err != nil { 207 return 208 } 209 var azf azure.Future 210 azf, err = azure.NewFutureFromResponse(resp) 211 future.FutureAPI = &azf 212 future.Result = func(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { 213 var done bool 214 done, err = future.DoneWithContext(context.Background(), client) 215 if err != nil { 216 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Polling failure") 217 return 218 } 219 if !done { 220 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") 221 return 222 } 223 ar.Response = future.Response() 224 return 225 } 226 return 227} 228 229// DeleteResponder handles the response to the Delete request. The method always 230// closes the http.Response Body. 231func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 232 err = autorest.Respond( 233 resp, 234 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 235 autorest.ByClosing()) 236 result.Response = resp 237 return 238} 239 240// Get gets information about the specified express route circuit. 241// Parameters: 242// resourceGroupName - the name of the resource group. 243// circuitName - the name of express route circuit. 244func (client ExpressRouteCircuitsClient) Get(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) { 245 if tracing.IsEnabled() { 246 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.Get") 247 defer func() { 248 sc := -1 249 if result.Response.Response != nil { 250 sc = result.Response.Response.StatusCode 251 } 252 tracing.EndSpan(ctx, sc, err) 253 }() 254 } 255 req, err := client.GetPreparer(ctx, resourceGroupName, circuitName) 256 if err != nil { 257 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request") 258 return 259 } 260 261 resp, err := client.GetSender(req) 262 if err != nil { 263 result.Response = autorest.Response{Response: resp} 264 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure sending request") 265 return 266 } 267 268 result, err = client.GetResponder(resp) 269 if err != nil { 270 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure responding to request") 271 return 272 } 273 274 return 275} 276 277// GetPreparer prepares the Get request. 278func (client ExpressRouteCircuitsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) { 279 pathParameters := map[string]interface{}{ 280 "circuitName": autorest.Encode("path", circuitName), 281 "resourceGroupName": autorest.Encode("path", resourceGroupName), 282 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 283 } 284 285 const APIVersion = "2018-02-01" 286 queryParameters := map[string]interface{}{ 287 "api-version": APIVersion, 288 } 289 290 preparer := autorest.CreatePreparer( 291 autorest.AsGet(), 292 autorest.WithBaseURL(client.BaseURI), 293 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), 294 autorest.WithQueryParameters(queryParameters)) 295 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 296} 297 298// GetSender sends the Get request. The method will close the 299// http.Response Body if it receives an error. 300func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) { 301 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 302} 303 304// GetResponder handles the response to the Get request. The method always 305// closes the http.Response Body. 306func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { 307 err = autorest.Respond( 308 resp, 309 azure.WithErrorUnlessStatusCode(http.StatusOK), 310 autorest.ByUnmarshallingJSON(&result), 311 autorest.ByClosing()) 312 result.Response = autorest.Response{Response: resp} 313 return 314} 315 316// GetPeeringStats gets all stats from an express route circuit in a resource group. 317// Parameters: 318// resourceGroupName - the name of the resource group. 319// circuitName - the name of the express route circuit. 320// peeringName - the name of the peering. 321func (client ExpressRouteCircuitsClient) GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) { 322 if tracing.IsEnabled() { 323 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.GetPeeringStats") 324 defer func() { 325 sc := -1 326 if result.Response.Response != nil { 327 sc = result.Response.Response.StatusCode 328 } 329 tracing.EndSpan(ctx, sc, err) 330 }() 331 } 332 req, err := client.GetPeeringStatsPreparer(ctx, resourceGroupName, circuitName, peeringName) 333 if err != nil { 334 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request") 335 return 336 } 337 338 resp, err := client.GetPeeringStatsSender(req) 339 if err != nil { 340 result.Response = autorest.Response{Response: resp} 341 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure sending request") 342 return 343 } 344 345 result, err = client.GetPeeringStatsResponder(resp) 346 if err != nil { 347 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure responding to request") 348 return 349 } 350 351 return 352} 353 354// GetPeeringStatsPreparer prepares the GetPeeringStats request. 355func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { 356 pathParameters := map[string]interface{}{ 357 "circuitName": autorest.Encode("path", circuitName), 358 "peeringName": autorest.Encode("path", peeringName), 359 "resourceGroupName": autorest.Encode("path", resourceGroupName), 360 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 361 } 362 363 const APIVersion = "2018-02-01" 364 queryParameters := map[string]interface{}{ 365 "api-version": APIVersion, 366 } 367 368 preparer := autorest.CreatePreparer( 369 autorest.AsGet(), 370 autorest.WithBaseURL(client.BaseURI), 371 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters), 372 autorest.WithQueryParameters(queryParameters)) 373 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 374} 375 376// GetPeeringStatsSender sends the GetPeeringStats request. The method will close the 377// http.Response Body if it receives an error. 378func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) { 379 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 380} 381 382// GetPeeringStatsResponder handles the response to the GetPeeringStats request. The method always 383// closes the http.Response Body. 384func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) { 385 err = autorest.Respond( 386 resp, 387 azure.WithErrorUnlessStatusCode(http.StatusOK), 388 autorest.ByUnmarshallingJSON(&result), 389 autorest.ByClosing()) 390 result.Response = autorest.Response{Response: resp} 391 return 392} 393 394// GetStats gets all the stats from an express route circuit in a resource group. 395// Parameters: 396// resourceGroupName - the name of the resource group. 397// circuitName - the name of the express route circuit. 398func (client ExpressRouteCircuitsClient) GetStats(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) { 399 if tracing.IsEnabled() { 400 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.GetStats") 401 defer func() { 402 sc := -1 403 if result.Response.Response != nil { 404 sc = result.Response.Response.StatusCode 405 } 406 tracing.EndSpan(ctx, sc, err) 407 }() 408 } 409 req, err := client.GetStatsPreparer(ctx, resourceGroupName, circuitName) 410 if err != nil { 411 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request") 412 return 413 } 414 415 resp, err := client.GetStatsSender(req) 416 if err != nil { 417 result.Response = autorest.Response{Response: resp} 418 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure sending request") 419 return 420 } 421 422 result, err = client.GetStatsResponder(resp) 423 if err != nil { 424 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure responding to request") 425 return 426 } 427 428 return 429} 430 431// GetStatsPreparer prepares the GetStats request. 432func (client ExpressRouteCircuitsClient) GetStatsPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) { 433 pathParameters := map[string]interface{}{ 434 "circuitName": autorest.Encode("path", circuitName), 435 "resourceGroupName": autorest.Encode("path", resourceGroupName), 436 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 437 } 438 439 const APIVersion = "2018-02-01" 440 queryParameters := map[string]interface{}{ 441 "api-version": APIVersion, 442 } 443 444 preparer := autorest.CreatePreparer( 445 autorest.AsGet(), 446 autorest.WithBaseURL(client.BaseURI), 447 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters), 448 autorest.WithQueryParameters(queryParameters)) 449 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 450} 451 452// GetStatsSender sends the GetStats request. The method will close the 453// http.Response Body if it receives an error. 454func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) { 455 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 456} 457 458// GetStatsResponder handles the response to the GetStats request. The method always 459// closes the http.Response Body. 460func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) { 461 err = autorest.Respond( 462 resp, 463 azure.WithErrorUnlessStatusCode(http.StatusOK), 464 autorest.ByUnmarshallingJSON(&result), 465 autorest.ByClosing()) 466 result.Response = autorest.Response{Response: resp} 467 return 468} 469 470// List gets all the express route circuits in a resource group. 471// Parameters: 472// resourceGroupName - the name of the resource group. 473func (client ExpressRouteCircuitsClient) List(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultPage, err error) { 474 if tracing.IsEnabled() { 475 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.List") 476 defer func() { 477 sc := -1 478 if result.erclr.Response.Response != nil { 479 sc = result.erclr.Response.Response.StatusCode 480 } 481 tracing.EndSpan(ctx, sc, err) 482 }() 483 } 484 result.fn = client.listNextResults 485 req, err := client.ListPreparer(ctx, resourceGroupName) 486 if err != nil { 487 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request") 488 return 489 } 490 491 resp, err := client.ListSender(req) 492 if err != nil { 493 result.erclr.Response = autorest.Response{Response: resp} 494 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request") 495 return 496 } 497 498 result.erclr, err = client.ListResponder(resp) 499 if err != nil { 500 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request") 501 return 502 } 503 if result.erclr.hasNextLink() && result.erclr.IsEmpty() { 504 err = result.NextWithContext(ctx) 505 return 506 } 507 508 return 509} 510 511// ListPreparer prepares the List request. 512func (client ExpressRouteCircuitsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 513 pathParameters := map[string]interface{}{ 514 "resourceGroupName": autorest.Encode("path", resourceGroupName), 515 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 516 } 517 518 const APIVersion = "2018-02-01" 519 queryParameters := map[string]interface{}{ 520 "api-version": APIVersion, 521 } 522 523 preparer := autorest.CreatePreparer( 524 autorest.AsGet(), 525 autorest.WithBaseURL(client.BaseURI), 526 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), 527 autorest.WithQueryParameters(queryParameters)) 528 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 529} 530 531// ListSender sends the List request. The method will close the 532// http.Response Body if it receives an error. 533func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) { 534 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 535} 536 537// ListResponder handles the response to the List request. The method always 538// closes the http.Response Body. 539func (client ExpressRouteCircuitsClient) ListResponder(resp *http.Response) (result ExpressRouteCircuitListResult, err error) { 540 err = autorest.Respond( 541 resp, 542 azure.WithErrorUnlessStatusCode(http.StatusOK), 543 autorest.ByUnmarshallingJSON(&result), 544 autorest.ByClosing()) 545 result.Response = autorest.Response{Response: resp} 546 return 547} 548 549// listNextResults retrieves the next set of results, if any. 550func (client ExpressRouteCircuitsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { 551 req, err := lastResults.expressRouteCircuitListResultPreparer(ctx) 552 if err != nil { 553 return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", nil, "Failure preparing next results request") 554 } 555 if req == nil { 556 return 557 } 558 resp, err := client.ListSender(req) 559 if err != nil { 560 result.Response = autorest.Response{Response: resp} 561 return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", resp, "Failure sending next results request") 562 } 563 result, err = client.ListResponder(resp) 564 if err != nil { 565 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", resp, "Failure responding to next results request") 566 } 567 return 568} 569 570// ListComplete enumerates all values, automatically crossing page boundaries as required. 571func (client ExpressRouteCircuitsClient) ListComplete(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultIterator, err error) { 572 if tracing.IsEnabled() { 573 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.List") 574 defer func() { 575 sc := -1 576 if result.Response().Response.Response != nil { 577 sc = result.page.Response().Response.Response.StatusCode 578 } 579 tracing.EndSpan(ctx, sc, err) 580 }() 581 } 582 result.page, err = client.List(ctx, resourceGroupName) 583 return 584} 585 586// ListAll gets all the express route circuits in a subscription. 587func (client ExpressRouteCircuitsClient) ListAll(ctx context.Context) (result ExpressRouteCircuitListResultPage, err error) { 588 if tracing.IsEnabled() { 589 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListAll") 590 defer func() { 591 sc := -1 592 if result.erclr.Response.Response != nil { 593 sc = result.erclr.Response.Response.StatusCode 594 } 595 tracing.EndSpan(ctx, sc, err) 596 }() 597 } 598 result.fn = client.listAllNextResults 599 req, err := client.ListAllPreparer(ctx) 600 if err != nil { 601 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request") 602 return 603 } 604 605 resp, err := client.ListAllSender(req) 606 if err != nil { 607 result.erclr.Response = autorest.Response{Response: resp} 608 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request") 609 return 610 } 611 612 result.erclr, err = client.ListAllResponder(resp) 613 if err != nil { 614 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request") 615 return 616 } 617 if result.erclr.hasNextLink() && result.erclr.IsEmpty() { 618 err = result.NextWithContext(ctx) 619 return 620 } 621 622 return 623} 624 625// ListAllPreparer prepares the ListAll request. 626func (client ExpressRouteCircuitsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { 627 pathParameters := map[string]interface{}{ 628 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 629 } 630 631 const APIVersion = "2018-02-01" 632 queryParameters := map[string]interface{}{ 633 "api-version": APIVersion, 634 } 635 636 preparer := autorest.CreatePreparer( 637 autorest.AsGet(), 638 autorest.WithBaseURL(client.BaseURI), 639 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), 640 autorest.WithQueryParameters(queryParameters)) 641 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 642} 643 644// ListAllSender sends the ListAll request. The method will close the 645// http.Response Body if it receives an error. 646func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) { 647 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 648} 649 650// ListAllResponder handles the response to the ListAll request. The method always 651// closes the http.Response Body. 652func (client ExpressRouteCircuitsClient) ListAllResponder(resp *http.Response) (result ExpressRouteCircuitListResult, err error) { 653 err = autorest.Respond( 654 resp, 655 azure.WithErrorUnlessStatusCode(http.StatusOK), 656 autorest.ByUnmarshallingJSON(&result), 657 autorest.ByClosing()) 658 result.Response = autorest.Response{Response: resp} 659 return 660} 661 662// listAllNextResults retrieves the next set of results, if any. 663func (client ExpressRouteCircuitsClient) listAllNextResults(ctx context.Context, lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { 664 req, err := lastResults.expressRouteCircuitListResultPreparer(ctx) 665 if err != nil { 666 return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", nil, "Failure preparing next results request") 667 } 668 if req == nil { 669 return 670 } 671 resp, err := client.ListAllSender(req) 672 if err != nil { 673 result.Response = autorest.Response{Response: resp} 674 return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", resp, "Failure sending next results request") 675 } 676 result, err = client.ListAllResponder(resp) 677 if err != nil { 678 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", resp, "Failure responding to next results request") 679 } 680 return 681} 682 683// ListAllComplete enumerates all values, automatically crossing page boundaries as required. 684func (client ExpressRouteCircuitsClient) ListAllComplete(ctx context.Context) (result ExpressRouteCircuitListResultIterator, err error) { 685 if tracing.IsEnabled() { 686 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListAll") 687 defer func() { 688 sc := -1 689 if result.Response().Response.Response != nil { 690 sc = result.page.Response().Response.Response.StatusCode 691 } 692 tracing.EndSpan(ctx, sc, err) 693 }() 694 } 695 result.page, err = client.ListAll(ctx) 696 return 697} 698 699// ListArpTable gets the currently advertised ARP table associated with the express route circuit in a resource group. 700// Parameters: 701// resourceGroupName - the name of the resource group. 702// circuitName - the name of the express route circuit. 703// peeringName - the name of the peering. 704// devicePath - the path of the device. 705func (client ExpressRouteCircuitsClient) ListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListArpTableFuture, err error) { 706 if tracing.IsEnabled() { 707 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListArpTable") 708 defer func() { 709 sc := -1 710 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 711 sc = result.FutureAPI.Response().StatusCode 712 } 713 tracing.EndSpan(ctx, sc, err) 714 }() 715 } 716 req, err := client.ListArpTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) 717 if err != nil { 718 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request") 719 return 720 } 721 722 result, err = client.ListArpTableSender(req) 723 if err != nil { 724 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure sending request") 725 return 726 } 727 728 return 729} 730 731// ListArpTablePreparer prepares the ListArpTable request. 732func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) { 733 pathParameters := map[string]interface{}{ 734 "circuitName": autorest.Encode("path", circuitName), 735 "devicePath": autorest.Encode("path", devicePath), 736 "peeringName": autorest.Encode("path", peeringName), 737 "resourceGroupName": autorest.Encode("path", resourceGroupName), 738 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 739 } 740 741 const APIVersion = "2018-02-01" 742 queryParameters := map[string]interface{}{ 743 "api-version": APIVersion, 744 } 745 746 preparer := autorest.CreatePreparer( 747 autorest.AsPost(), 748 autorest.WithBaseURL(client.BaseURI), 749 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters), 750 autorest.WithQueryParameters(queryParameters)) 751 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 752} 753 754// ListArpTableSender sends the ListArpTable request. The method will close the 755// http.Response Body if it receives an error. 756func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCircuitsListArpTableFuture, err error) { 757 var resp *http.Response 758 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 759 if err != nil { 760 return 761 } 762 var azf azure.Future 763 azf, err = azure.NewFutureFromResponse(resp) 764 future.FutureAPI = &azf 765 future.Result = func(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { 766 var done bool 767 done, err = future.DoneWithContext(context.Background(), client) 768 if err != nil { 769 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", future.Response(), "Polling failure") 770 return 771 } 772 if !done { 773 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListArpTableFuture") 774 return 775 } 776 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 777 ercatlr.Response.Response, err = future.GetResult(sender) 778 if ercatlr.Response.Response == nil && err == nil { 779 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", nil, "received nil response and error") 780 } 781 if err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent { 782 ercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response) 783 if err != nil { 784 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") 785 } 786 } 787 return 788 } 789 return 790} 791 792// ListArpTableResponder handles the response to the ListArpTable request. The method always 793// closes the http.Response Body. 794func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) { 795 err = autorest.Respond( 796 resp, 797 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 798 autorest.ByUnmarshallingJSON(&result), 799 autorest.ByClosing()) 800 result.Response = autorest.Response{Response: resp} 801 return 802} 803 804// ListRoutesTable gets the currently advertised routes table associated with the express route circuit in a resource 805// group. 806// Parameters: 807// resourceGroupName - the name of the resource group. 808// circuitName - the name of the express route circuit. 809// peeringName - the name of the peering. 810// devicePath - the path of the device. 811func (client ExpressRouteCircuitsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableFuture, err error) { 812 if tracing.IsEnabled() { 813 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListRoutesTable") 814 defer func() { 815 sc := -1 816 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 817 sc = result.FutureAPI.Response().StatusCode 818 } 819 tracing.EndSpan(ctx, sc, err) 820 }() 821 } 822 req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) 823 if err != nil { 824 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request") 825 return 826 } 827 828 result, err = client.ListRoutesTableSender(req) 829 if err != nil { 830 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure sending request") 831 return 832 } 833 834 return 835} 836 837// ListRoutesTablePreparer prepares the ListRoutesTable request. 838func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) { 839 pathParameters := map[string]interface{}{ 840 "circuitName": autorest.Encode("path", circuitName), 841 "devicePath": autorest.Encode("path", devicePath), 842 "peeringName": autorest.Encode("path", peeringName), 843 "resourceGroupName": autorest.Encode("path", resourceGroupName), 844 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 845 } 846 847 const APIVersion = "2018-02-01" 848 queryParameters := map[string]interface{}{ 849 "api-version": APIVersion, 850 } 851 852 preparer := autorest.CreatePreparer( 853 autorest.AsPost(), 854 autorest.WithBaseURL(client.BaseURI), 855 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters), 856 autorest.WithQueryParameters(queryParameters)) 857 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 858} 859 860// ListRoutesTableSender sends the ListRoutesTable request. The method will close the 861// http.Response Body if it receives an error. 862func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableFuture, err error) { 863 var resp *http.Response 864 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 865 if err != nil { 866 return 867 } 868 var azf azure.Future 869 azf, err = azure.NewFutureFromResponse(resp) 870 future.FutureAPI = &azf 871 future.Result = func(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { 872 var done bool 873 done, err = future.DoneWithContext(context.Background(), client) 874 if err != nil { 875 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", future.Response(), "Polling failure") 876 return 877 } 878 if !done { 879 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableFuture") 880 return 881 } 882 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 883 ercrtlr.Response.Response, err = future.GetResult(sender) 884 if ercrtlr.Response.Response == nil && err == nil { 885 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", nil, "received nil response and error") 886 } 887 if err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent { 888 ercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response) 889 if err != nil { 890 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") 891 } 892 } 893 return 894 } 895 return 896} 897 898// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always 899// closes the http.Response Body. 900func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) { 901 err = autorest.Respond( 902 resp, 903 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 904 autorest.ByUnmarshallingJSON(&result), 905 autorest.ByClosing()) 906 result.Response = autorest.Response{Response: resp} 907 return 908} 909 910// ListRoutesTableSummary gets the currently advertised routes table summary associated with the express route circuit 911// in a resource group. 912// Parameters: 913// resourceGroupName - the name of the resource group. 914// circuitName - the name of the express route circuit. 915// peeringName - the name of the peering. 916// devicePath - the path of the device. 917func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) { 918 if tracing.IsEnabled() { 919 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListRoutesTableSummary") 920 defer func() { 921 sc := -1 922 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 923 sc = result.FutureAPI.Response().StatusCode 924 } 925 tracing.EndSpan(ctx, sc, err) 926 }() 927 } 928 req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) 929 if err != nil { 930 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request") 931 return 932 } 933 934 result, err = client.ListRoutesTableSummarySender(req) 935 if err != nil { 936 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure sending request") 937 return 938 } 939 940 return 941} 942 943// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request. 944func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) { 945 pathParameters := map[string]interface{}{ 946 "circuitName": autorest.Encode("path", circuitName), 947 "devicePath": autorest.Encode("path", devicePath), 948 "peeringName": autorest.Encode("path", peeringName), 949 "resourceGroupName": autorest.Encode("path", resourceGroupName), 950 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 951 } 952 953 const APIVersion = "2018-02-01" 954 queryParameters := map[string]interface{}{ 955 "api-version": APIVersion, 956 } 957 958 preparer := autorest.CreatePreparer( 959 autorest.AsPost(), 960 autorest.WithBaseURL(client.BaseURI), 961 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters), 962 autorest.WithQueryParameters(queryParameters)) 963 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 964} 965 966// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the 967// http.Response Body if it receives an error. 968func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) { 969 var resp *http.Response 970 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 971 if err != nil { 972 return 973 } 974 var azf azure.Future 975 azf, err = azure.NewFutureFromResponse(resp) 976 future.FutureAPI = &azf 977 future.Result = func(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { 978 var done bool 979 done, err = future.DoneWithContext(context.Background(), client) 980 if err != nil { 981 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") 982 return 983 } 984 if !done { 985 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableSummaryFuture") 986 return 987 } 988 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 989 ercrtslr.Response.Response, err = future.GetResult(sender) 990 if ercrtslr.Response.Response == nil && err == nil { 991 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", nil, "received nil response and error") 992 } 993 if err == nil && ercrtslr.Response.Response.StatusCode != http.StatusNoContent { 994 ercrtslr, err = client.ListRoutesTableSummaryResponder(ercrtslr.Response.Response) 995 if err != nil { 996 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", ercrtslr.Response.Response, "Failure responding to request") 997 } 998 } 999 return 1000 } 1001 return 1002} 1003 1004// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always 1005// closes the http.Response Body. 1006func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { 1007 err = autorest.Respond( 1008 resp, 1009 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 1010 autorest.ByUnmarshallingJSON(&result), 1011 autorest.ByClosing()) 1012 result.Response = autorest.Response{Response: resp} 1013 return 1014} 1015 1016// UpdateTags updates an express route circuit tags. 1017// Parameters: 1018// resourceGroupName - the name of the resource group. 1019// circuitName - the name of the circuit. 1020// parameters - parameters supplied to update express route circuit tags. 1021func (client ExpressRouteCircuitsClient) UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (result ExpressRouteCircuitsUpdateTagsFuture, err error) { 1022 if tracing.IsEnabled() { 1023 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.UpdateTags") 1024 defer func() { 1025 sc := -1 1026 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 1027 sc = result.FutureAPI.Response().StatusCode 1028 } 1029 tracing.EndSpan(ctx, sc, err) 1030 }() 1031 } 1032 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, circuitName, parameters) 1033 if err != nil { 1034 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", nil, "Failure preparing request") 1035 return 1036 } 1037 1038 result, err = client.UpdateTagsSender(req) 1039 if err != nil { 1040 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", nil, "Failure sending request") 1041 return 1042 } 1043 1044 return 1045} 1046 1047// UpdateTagsPreparer prepares the UpdateTags request. 1048func (client ExpressRouteCircuitsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (*http.Request, error) { 1049 pathParameters := map[string]interface{}{ 1050 "circuitName": autorest.Encode("path", circuitName), 1051 "resourceGroupName": autorest.Encode("path", resourceGroupName), 1052 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 1053 } 1054 1055 const APIVersion = "2018-02-01" 1056 queryParameters := map[string]interface{}{ 1057 "api-version": APIVersion, 1058 } 1059 1060 preparer := autorest.CreatePreparer( 1061 autorest.AsContentType("application/json; charset=utf-8"), 1062 autorest.AsPatch(), 1063 autorest.WithBaseURL(client.BaseURI), 1064 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), 1065 autorest.WithJSON(parameters), 1066 autorest.WithQueryParameters(queryParameters)) 1067 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 1068} 1069 1070// UpdateTagsSender sends the UpdateTags request. The method will close the 1071// http.Response Body if it receives an error. 1072func (client ExpressRouteCircuitsClient) UpdateTagsSender(req *http.Request) (future ExpressRouteCircuitsUpdateTagsFuture, err error) { 1073 var resp *http.Response 1074 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 1075 if err != nil { 1076 return 1077 } 1078 var azf azure.Future 1079 azf, err = azure.NewFutureFromResponse(resp) 1080 future.FutureAPI = &azf 1081 future.Result = func(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { 1082 var done bool 1083 done, err = future.DoneWithContext(context.Background(), client) 1084 if err != nil { 1085 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", future.Response(), "Polling failure") 1086 return 1087 } 1088 if !done { 1089 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsUpdateTagsFuture") 1090 return 1091 } 1092 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1093 erc.Response.Response, err = future.GetResult(sender) 1094 if erc.Response.Response == nil && err == nil { 1095 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", nil, "received nil response and error") 1096 } 1097 if err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { 1098 erc, err = client.UpdateTagsResponder(erc.Response.Response) 1099 if err != nil { 1100 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", erc.Response.Response, "Failure responding to request") 1101 } 1102 } 1103 return 1104 } 1105 return 1106} 1107 1108// UpdateTagsResponder handles the response to the UpdateTags request. The method always 1109// closes the http.Response Body. 1110func (client ExpressRouteCircuitsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { 1111 err = autorest.Respond( 1112 resp, 1113 azure.WithErrorUnlessStatusCode(http.StatusOK), 1114 autorest.ByUnmarshallingJSON(&result), 1115 autorest.ByClosing()) 1116 result.Response = autorest.Response{Response: resp} 1117 return 1118} 1119