1package migrate 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "github.com/Azure/go-autorest/autorest" 12 "github.com/Azure/go-autorest/autorest/azure" 13 "github.com/Azure/go-autorest/tracing" 14 "net/http" 15) 16 17// SitesClient is the discover your workloads for Azure. 18type SitesClient struct { 19 BaseClient 20} 21 22// NewSitesClient creates an instance of the SitesClient client. 23func NewSitesClient() SitesClient { 24 return NewSitesClientWithBaseURI(DefaultBaseURI) 25} 26 27// NewSitesClientWithBaseURI creates an instance of the SitesClient client using a custom endpoint. Use this when 28// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 29func NewSitesClientWithBaseURI(baseURI string) SitesClient { 30 return SitesClient{NewWithBaseURI(baseURI)} 31} 32 33// DeleteSite sends the delete site request. 34// Parameters: 35// subscriptionID - the ID of the target subscription. 36// resourceGroupName - the name of the resource group. The name is case insensitive. 37// siteName - site name. 38// APIVersion - the API version to use for this operation. 39func (client SitesClient) DeleteSite(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (result autorest.Response, err error) { 40 if tracing.IsEnabled() { 41 ctx = tracing.StartSpan(ctx, fqdn+"/SitesClient.DeleteSite") 42 defer func() { 43 sc := -1 44 if result.Response != nil { 45 sc = result.Response.StatusCode 46 } 47 tracing.EndSpan(ctx, sc, err) 48 }() 49 } 50 req, err := client.DeleteSitePreparer(ctx, subscriptionID, resourceGroupName, siteName, APIVersion) 51 if err != nil { 52 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "DeleteSite", nil, "Failure preparing request") 53 return 54 } 55 56 resp, err := client.DeleteSiteSender(req) 57 if err != nil { 58 result.Response = resp 59 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "DeleteSite", resp, "Failure sending request") 60 return 61 } 62 63 result, err = client.DeleteSiteResponder(resp) 64 if err != nil { 65 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "DeleteSite", resp, "Failure responding to request") 66 return 67 } 68 69 return 70} 71 72// DeleteSitePreparer prepares the DeleteSite request. 73func (client SitesClient) DeleteSitePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (*http.Request, error) { 74 pathParameters := map[string]interface{}{ 75 "resourceGroupName": autorest.Encode("path", resourceGroupName), 76 "siteName": autorest.Encode("path", siteName), 77 "subscriptionId": autorest.Encode("path", subscriptionID), 78 } 79 80 queryParameters := map[string]interface{}{ 81 "api-version": APIVersion, 82 } 83 84 preparer := autorest.CreatePreparer( 85 autorest.AsDelete(), 86 autorest.WithBaseURL(client.BaseURI), 87 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}", pathParameters), 88 autorest.WithQueryParameters(queryParameters)) 89 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 90} 91 92// DeleteSiteSender sends the DeleteSite request. The method will close the 93// http.Response Body if it receives an error. 94func (client SitesClient) DeleteSiteSender(req *http.Request) (*http.Response, error) { 95 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 96} 97 98// DeleteSiteResponder handles the response to the DeleteSite request. The method always 99// closes the http.Response Body. 100func (client SitesClient) DeleteSiteResponder(resp *http.Response) (result autorest.Response, err error) { 101 err = autorest.Respond( 102 resp, 103 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), 104 autorest.ByClosing()) 105 result.Response = resp 106 return 107} 108 109// GetSite sends the get site request. 110// Parameters: 111// subscriptionID - the ID of the target subscription. 112// resourceGroupName - the name of the resource group. The name is case insensitive. 113// siteName - site name. 114// APIVersion - the API version to use for this operation. 115func (client SitesClient) GetSite(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (result VMwareSite, err error) { 116 if tracing.IsEnabled() { 117 ctx = tracing.StartSpan(ctx, fqdn+"/SitesClient.GetSite") 118 defer func() { 119 sc := -1 120 if result.Response.Response != nil { 121 sc = result.Response.Response.StatusCode 122 } 123 tracing.EndSpan(ctx, sc, err) 124 }() 125 } 126 req, err := client.GetSitePreparer(ctx, subscriptionID, resourceGroupName, siteName, APIVersion) 127 if err != nil { 128 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSite", nil, "Failure preparing request") 129 return 130 } 131 132 resp, err := client.GetSiteSender(req) 133 if err != nil { 134 result.Response = autorest.Response{Response: resp} 135 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSite", resp, "Failure sending request") 136 return 137 } 138 139 result, err = client.GetSiteResponder(resp) 140 if err != nil { 141 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSite", resp, "Failure responding to request") 142 return 143 } 144 145 return 146} 147 148// GetSitePreparer prepares the GetSite request. 149func (client SitesClient) GetSitePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (*http.Request, error) { 150 pathParameters := map[string]interface{}{ 151 "resourceGroupName": autorest.Encode("path", resourceGroupName), 152 "siteName": autorest.Encode("path", siteName), 153 "subscriptionId": autorest.Encode("path", subscriptionID), 154 } 155 156 queryParameters := map[string]interface{}{ 157 "api-version": APIVersion, 158 } 159 160 preparer := autorest.CreatePreparer( 161 autorest.AsGet(), 162 autorest.WithBaseURL(client.BaseURI), 163 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}", pathParameters), 164 autorest.WithQueryParameters(queryParameters)) 165 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 166} 167 168// GetSiteSender sends the GetSite request. The method will close the 169// http.Response Body if it receives an error. 170func (client SitesClient) GetSiteSender(req *http.Request) (*http.Response, error) { 171 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 172} 173 174// GetSiteResponder handles the response to the GetSite request. The method always 175// closes the http.Response Body. 176func (client SitesClient) GetSiteResponder(resp *http.Response) (result VMwareSite, err error) { 177 err = autorest.Respond( 178 resp, 179 azure.WithErrorUnlessStatusCode(http.StatusOK), 180 autorest.ByUnmarshallingJSON(&result), 181 autorest.ByClosing()) 182 result.Response = autorest.Response{Response: resp} 183 return 184} 185 186// GetSiteHealthSummary sends the get site health summary request. 187// Parameters: 188// subscriptionID - the ID of the target subscription. 189// resourceGroupName - the name of the resource group. The name is case insensitive. 190// siteName - site name. 191// APIVersion - the API version to use for this operation. 192func (client SitesClient) GetSiteHealthSummary(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (result SiteHealthSummaryCollectionPage, err error) { 193 if tracing.IsEnabled() { 194 ctx = tracing.StartSpan(ctx, fqdn+"/SitesClient.GetSiteHealthSummary") 195 defer func() { 196 sc := -1 197 if result.shsc.Response.Response != nil { 198 sc = result.shsc.Response.Response.StatusCode 199 } 200 tracing.EndSpan(ctx, sc, err) 201 }() 202 } 203 result.fn = client.getSiteHealthSummaryNextResults 204 req, err := client.GetSiteHealthSummaryPreparer(ctx, subscriptionID, resourceGroupName, siteName, APIVersion) 205 if err != nil { 206 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSiteHealthSummary", nil, "Failure preparing request") 207 return 208 } 209 210 resp, err := client.GetSiteHealthSummarySender(req) 211 if err != nil { 212 result.shsc.Response = autorest.Response{Response: resp} 213 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSiteHealthSummary", resp, "Failure sending request") 214 return 215 } 216 217 result.shsc, err = client.GetSiteHealthSummaryResponder(resp) 218 if err != nil { 219 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSiteHealthSummary", resp, "Failure responding to request") 220 return 221 } 222 if result.shsc.hasNextLink() && result.shsc.IsEmpty() { 223 err = result.NextWithContext(ctx) 224 return 225 } 226 227 return 228} 229 230// GetSiteHealthSummaryPreparer prepares the GetSiteHealthSummary request. 231func (client SitesClient) GetSiteHealthSummaryPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (*http.Request, error) { 232 pathParameters := map[string]interface{}{ 233 "resourceGroupName": autorest.Encode("path", resourceGroupName), 234 "siteName": autorest.Encode("path", siteName), 235 "subscriptionId": autorest.Encode("path", subscriptionID), 236 } 237 238 queryParameters := map[string]interface{}{ 239 "api-version": APIVersion, 240 } 241 242 preparer := autorest.CreatePreparer( 243 autorest.AsPost(), 244 autorest.WithBaseURL(client.BaseURI), 245 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/healthSummary", pathParameters), 246 autorest.WithQueryParameters(queryParameters)) 247 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 248} 249 250// GetSiteHealthSummarySender sends the GetSiteHealthSummary request. The method will close the 251// http.Response Body if it receives an error. 252func (client SitesClient) GetSiteHealthSummarySender(req *http.Request) (*http.Response, error) { 253 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 254} 255 256// GetSiteHealthSummaryResponder handles the response to the GetSiteHealthSummary request. The method always 257// closes the http.Response Body. 258func (client SitesClient) GetSiteHealthSummaryResponder(resp *http.Response) (result SiteHealthSummaryCollection, err error) { 259 err = autorest.Respond( 260 resp, 261 azure.WithErrorUnlessStatusCode(http.StatusOK), 262 autorest.ByUnmarshallingJSON(&result), 263 autorest.ByClosing()) 264 result.Response = autorest.Response{Response: resp} 265 return 266} 267 268// getSiteHealthSummaryNextResults retrieves the next set of results, if any. 269func (client SitesClient) getSiteHealthSummaryNextResults(ctx context.Context, lastResults SiteHealthSummaryCollection) (result SiteHealthSummaryCollection, err error) { 270 req, err := lastResults.siteHealthSummaryCollectionPreparer(ctx) 271 if err != nil { 272 return result, autorest.NewErrorWithError(err, "migrate.SitesClient", "getSiteHealthSummaryNextResults", nil, "Failure preparing next results request") 273 } 274 if req == nil { 275 return 276 } 277 resp, err := client.GetSiteHealthSummarySender(req) 278 if err != nil { 279 result.Response = autorest.Response{Response: resp} 280 return result, autorest.NewErrorWithError(err, "migrate.SitesClient", "getSiteHealthSummaryNextResults", resp, "Failure sending next results request") 281 } 282 result, err = client.GetSiteHealthSummaryResponder(resp) 283 if err != nil { 284 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "getSiteHealthSummaryNextResults", resp, "Failure responding to next results request") 285 } 286 return 287} 288 289// GetSiteHealthSummaryComplete enumerates all values, automatically crossing page boundaries as required. 290func (client SitesClient) GetSiteHealthSummaryComplete(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (result SiteHealthSummaryCollectionIterator, err error) { 291 if tracing.IsEnabled() { 292 ctx = tracing.StartSpan(ctx, fqdn+"/SitesClient.GetSiteHealthSummary") 293 defer func() { 294 sc := -1 295 if result.Response().Response.Response != nil { 296 sc = result.page.Response().Response.Response.StatusCode 297 } 298 tracing.EndSpan(ctx, sc, err) 299 }() 300 } 301 result.page, err = client.GetSiteHealthSummary(ctx, subscriptionID, resourceGroupName, siteName, APIVersion) 302 return 303} 304 305// GetSiteUsage sends the get site usage request. 306// Parameters: 307// subscriptionID - the ID of the target subscription. 308// resourceGroupName - the name of the resource group. The name is case insensitive. 309// siteName - site name. 310func (client SitesClient) GetSiteUsage(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (result VMwareSiteUsage, err error) { 311 if tracing.IsEnabled() { 312 ctx = tracing.StartSpan(ctx, fqdn+"/SitesClient.GetSiteUsage") 313 defer func() { 314 sc := -1 315 if result.Response.Response != nil { 316 sc = result.Response.Response.StatusCode 317 } 318 tracing.EndSpan(ctx, sc, err) 319 }() 320 } 321 req, err := client.GetSiteUsagePreparer(ctx, subscriptionID, resourceGroupName, siteName, APIVersion) 322 if err != nil { 323 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSiteUsage", nil, "Failure preparing request") 324 return 325 } 326 327 resp, err := client.GetSiteUsageSender(req) 328 if err != nil { 329 result.Response = autorest.Response{Response: resp} 330 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSiteUsage", resp, "Failure sending request") 331 return 332 } 333 334 result, err = client.GetSiteUsageResponder(resp) 335 if err != nil { 336 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "GetSiteUsage", resp, "Failure responding to request") 337 return 338 } 339 340 return 341} 342 343// GetSiteUsagePreparer prepares the GetSiteUsage request. 344func (client SitesClient) GetSiteUsagePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (*http.Request, error) { 345 pathParameters := map[string]interface{}{ 346 "resourceGroupName": autorest.Encode("path", resourceGroupName), 347 "siteName": autorest.Encode("path", siteName), 348 "subscriptionId": autorest.Encode("path", subscriptionID), 349 } 350 351 queryParameters := map[string]interface{}{ 352 "api-version": APIVersion, 353 } 354 355 preparer := autorest.CreatePreparer( 356 autorest.AsPost(), 357 autorest.WithBaseURL(client.BaseURI), 358 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/summary", pathParameters), 359 autorest.WithQueryParameters(queryParameters)) 360 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 361} 362 363// GetSiteUsageSender sends the GetSiteUsage request. The method will close the 364// http.Response Body if it receives an error. 365func (client SitesClient) GetSiteUsageSender(req *http.Request) (*http.Response, error) { 366 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 367} 368 369// GetSiteUsageResponder handles the response to the GetSiteUsage request. The method always 370// closes the http.Response Body. 371func (client SitesClient) GetSiteUsageResponder(resp *http.Response) (result VMwareSiteUsage, err error) { 372 err = autorest.Respond( 373 resp, 374 azure.WithErrorUnlessStatusCode(http.StatusOK), 375 autorest.ByUnmarshallingJSON(&result), 376 autorest.ByClosing()) 377 result.Response = autorest.Response{Response: resp} 378 return 379} 380 381// PatchSite sends the patch site request. 382// Parameters: 383// subscriptionID - the ID of the target subscription. 384// resourceGroupName - the name of the resource group. The name is case insensitive. 385// siteName - site name. 386// body - body with site details. 387// APIVersion - the API version to use for this operation. 388func (client SitesClient) PatchSite(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, body VMwareSite, APIVersion string) (result VMwareSite, err error) { 389 if tracing.IsEnabled() { 390 ctx = tracing.StartSpan(ctx, fqdn+"/SitesClient.PatchSite") 391 defer func() { 392 sc := -1 393 if result.Response.Response != nil { 394 sc = result.Response.Response.StatusCode 395 } 396 tracing.EndSpan(ctx, sc, err) 397 }() 398 } 399 req, err := client.PatchSitePreparer(ctx, subscriptionID, resourceGroupName, siteName, body, APIVersion) 400 if err != nil { 401 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "PatchSite", nil, "Failure preparing request") 402 return 403 } 404 405 resp, err := client.PatchSiteSender(req) 406 if err != nil { 407 result.Response = autorest.Response{Response: resp} 408 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "PatchSite", resp, "Failure sending request") 409 return 410 } 411 412 result, err = client.PatchSiteResponder(resp) 413 if err != nil { 414 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "PatchSite", resp, "Failure responding to request") 415 return 416 } 417 418 return 419} 420 421// PatchSitePreparer prepares the PatchSite request. 422func (client SitesClient) PatchSitePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, body VMwareSite, APIVersion string) (*http.Request, error) { 423 pathParameters := map[string]interface{}{ 424 "resourceGroupName": autorest.Encode("path", resourceGroupName), 425 "siteName": autorest.Encode("path", siteName), 426 "subscriptionId": autorest.Encode("path", subscriptionID), 427 } 428 429 queryParameters := map[string]interface{}{ 430 "api-version": APIVersion, 431 } 432 433 body.ID = nil 434 body.Type = nil 435 preparer := autorest.CreatePreparer( 436 autorest.AsContentType("application/json; charset=utf-8"), 437 autorest.AsPatch(), 438 autorest.WithBaseURL(client.BaseURI), 439 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}", pathParameters), 440 autorest.WithJSON(body), 441 autorest.WithQueryParameters(queryParameters)) 442 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 443} 444 445// PatchSiteSender sends the PatchSite request. The method will close the 446// http.Response Body if it receives an error. 447func (client SitesClient) PatchSiteSender(req *http.Request) (*http.Response, error) { 448 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 449} 450 451// PatchSiteResponder handles the response to the PatchSite request. The method always 452// closes the http.Response Body. 453func (client SitesClient) PatchSiteResponder(resp *http.Response) (result VMwareSite, err error) { 454 err = autorest.Respond( 455 resp, 456 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 457 autorest.ByUnmarshallingJSON(&result), 458 autorest.ByClosing()) 459 result.Response = autorest.Response{Response: resp} 460 return 461} 462 463// PutSite sends the put site request. 464// Parameters: 465// subscriptionID - the ID of the target subscription. 466// resourceGroupName - the name of the resource group. The name is case insensitive. 467// siteName - site name. 468// body - body with site details. 469// APIVersion - the API version to use for this operation. 470func (client SitesClient) PutSite(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, body VMwareSite, APIVersion string) (result VMwareSite, err error) { 471 if tracing.IsEnabled() { 472 ctx = tracing.StartSpan(ctx, fqdn+"/SitesClient.PutSite") 473 defer func() { 474 sc := -1 475 if result.Response.Response != nil { 476 sc = result.Response.Response.StatusCode 477 } 478 tracing.EndSpan(ctx, sc, err) 479 }() 480 } 481 req, err := client.PutSitePreparer(ctx, subscriptionID, resourceGroupName, siteName, body, APIVersion) 482 if err != nil { 483 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "PutSite", nil, "Failure preparing request") 484 return 485 } 486 487 resp, err := client.PutSiteSender(req) 488 if err != nil { 489 result.Response = autorest.Response{Response: resp} 490 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "PutSite", resp, "Failure sending request") 491 return 492 } 493 494 result, err = client.PutSiteResponder(resp) 495 if err != nil { 496 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "PutSite", resp, "Failure responding to request") 497 return 498 } 499 500 return 501} 502 503// PutSitePreparer prepares the PutSite request. 504func (client SitesClient) PutSitePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, body VMwareSite, APIVersion string) (*http.Request, error) { 505 pathParameters := map[string]interface{}{ 506 "resourceGroupName": autorest.Encode("path", resourceGroupName), 507 "siteName": autorest.Encode("path", siteName), 508 "subscriptionId": autorest.Encode("path", subscriptionID), 509 } 510 511 queryParameters := map[string]interface{}{ 512 "api-version": APIVersion, 513 } 514 515 body.ID = nil 516 body.Type = nil 517 preparer := autorest.CreatePreparer( 518 autorest.AsContentType("application/json; charset=utf-8"), 519 autorest.AsPut(), 520 autorest.WithBaseURL(client.BaseURI), 521 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}", pathParameters), 522 autorest.WithJSON(body), 523 autorest.WithQueryParameters(queryParameters)) 524 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 525} 526 527// PutSiteSender sends the PutSite request. The method will close the 528// http.Response Body if it receives an error. 529func (client SitesClient) PutSiteSender(req *http.Request) (*http.Response, error) { 530 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 531} 532 533// PutSiteResponder handles the response to the PutSite request. The method always 534// closes the http.Response Body. 535func (client SitesClient) PutSiteResponder(resp *http.Response) (result VMwareSite, err error) { 536 err = autorest.Respond( 537 resp, 538 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 539 autorest.ByUnmarshallingJSON(&result), 540 autorest.ByClosing()) 541 result.Response = autorest.Response{Response: resp} 542 return 543} 544 545// RefreshSite sends the refresh site request. 546// Parameters: 547// subscriptionID - the ID of the target subscription. 548// resourceGroupName - the name of the resource group. The name is case insensitive. 549// siteName - site name. 550// APIVersion - the API version to use for this operation. 551func (client SitesClient) RefreshSite(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (result autorest.Response, err error) { 552 if tracing.IsEnabled() { 553 ctx = tracing.StartSpan(ctx, fqdn+"/SitesClient.RefreshSite") 554 defer func() { 555 sc := -1 556 if result.Response != nil { 557 sc = result.Response.StatusCode 558 } 559 tracing.EndSpan(ctx, sc, err) 560 }() 561 } 562 req, err := client.RefreshSitePreparer(ctx, subscriptionID, resourceGroupName, siteName, APIVersion) 563 if err != nil { 564 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "RefreshSite", nil, "Failure preparing request") 565 return 566 } 567 568 resp, err := client.RefreshSiteSender(req) 569 if err != nil { 570 result.Response = resp 571 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "RefreshSite", resp, "Failure sending request") 572 return 573 } 574 575 result, err = client.RefreshSiteResponder(resp) 576 if err != nil { 577 err = autorest.NewErrorWithError(err, "migrate.SitesClient", "RefreshSite", resp, "Failure responding to request") 578 return 579 } 580 581 return 582} 583 584// RefreshSitePreparer prepares the RefreshSite request. 585func (client SitesClient) RefreshSitePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (*http.Request, error) { 586 pathParameters := map[string]interface{}{ 587 "resourceGroupName": autorest.Encode("path", resourceGroupName), 588 "siteName": autorest.Encode("path", siteName), 589 "subscriptionId": autorest.Encode("path", subscriptionID), 590 } 591 592 queryParameters := map[string]interface{}{ 593 "api-version": APIVersion, 594 } 595 596 preparer := autorest.CreatePreparer( 597 autorest.AsPost(), 598 autorest.WithBaseURL(client.BaseURI), 599 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/refresh", pathParameters), 600 autorest.WithQueryParameters(queryParameters)) 601 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 602} 603 604// RefreshSiteSender sends the RefreshSite request. The method will close the 605// http.Response Body if it receives an error. 606func (client SitesClient) RefreshSiteSender(req *http.Request) (*http.Response, error) { 607 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 608} 609 610// RefreshSiteResponder handles the response to the RefreshSite request. The method always 611// closes the http.Response Body. 612func (client SitesClient) RefreshSiteResponder(resp *http.Response) (result autorest.Response, err error) { 613 err = autorest.Respond( 614 resp, 615 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 616 autorest.ByClosing()) 617 result.Response = resp 618 return 619} 620