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