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// HyperVSitesClient is the discover your workloads for Azure.
29type HyperVSitesClient struct {
30	BaseClient
31}
32
33// NewHyperVSitesClient creates an instance of the HyperVSitesClient client.
34func NewHyperVSitesClient() HyperVSitesClient {
35	return NewHyperVSitesClientWithBaseURI(DefaultBaseURI)
36}
37
38// NewHyperVSitesClientWithBaseURI creates an instance of the HyperVSitesClient client using a custom endpoint.  Use
39// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
40func NewHyperVSitesClientWithBaseURI(baseURI string) HyperVSitesClient {
41	return HyperVSitesClient{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 HyperVSitesClient) 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+"/HyperVSitesClient.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.HyperVSitesClient", "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.HyperVSitesClient", "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.HyperVSitesClient", "DeleteSite", resp, "Failure responding to request")
77		return
78	}
79
80	return
81}
82
83// DeleteSitePreparer prepares the DeleteSite request.
84func (client HyperVSitesClient) 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/HyperVSites/{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 HyperVSitesClient) 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 HyperVSitesClient) 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 HyperVSitesClient) GetSite(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (result HyperVSite, err error) {
127	if tracing.IsEnabled() {
128		ctx = tracing.StartSpan(ctx, fqdn+"/HyperVSitesClient.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.HyperVSitesClient", "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.HyperVSitesClient", "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.HyperVSitesClient", "GetSite", resp, "Failure responding to request")
153		return
154	}
155
156	return
157}
158
159// GetSitePreparer prepares the GetSite request.
160func (client HyperVSitesClient) 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/HyperVSites/{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 HyperVSitesClient) 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 HyperVSitesClient) GetSiteResponder(resp *http.Response) (result HyperVSite, 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 HyperVSitesClient) 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+"/HyperVSitesClient.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.HyperVSitesClient", "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.HyperVSitesClient", "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.HyperVSitesClient", "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 HyperVSitesClient) 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/HyperVSites/{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 HyperVSitesClient) 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 HyperVSitesClient) 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 HyperVSitesClient) 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.HyperVSitesClient", "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.HyperVSitesClient", "getSiteHealthSummaryNextResults", resp, "Failure sending next results request")
292	}
293	result, err = client.GetSiteHealthSummaryResponder(resp)
294	if err != nil {
295		err = autorest.NewErrorWithError(err, "migrate.HyperVSitesClient", "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 HyperVSitesClient) 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+"/HyperVSitesClient.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 HyperVSitesClient) GetSiteUsage(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, APIVersion string) (result HyperVSiteUsage, err error) {
322	if tracing.IsEnabled() {
323		ctx = tracing.StartSpan(ctx, fqdn+"/HyperVSitesClient.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.HyperVSitesClient", "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.HyperVSitesClient", "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.HyperVSitesClient", "GetSiteUsage", resp, "Failure responding to request")
348		return
349	}
350
351	return
352}
353
354// GetSiteUsagePreparer prepares the GetSiteUsage request.
355func (client HyperVSitesClient) 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/HyperVSites/{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 HyperVSitesClient) 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 HyperVSitesClient) GetSiteUsageResponder(resp *http.Response) (result HyperVSiteUsage, 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 HyperVSitesClient) PatchSite(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, body HyperVSite, APIVersion string) (result HyperVSite, err error) {
400	if tracing.IsEnabled() {
401		ctx = tracing.StartSpan(ctx, fqdn+"/HyperVSitesClient.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.HyperVSitesClient", "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.HyperVSitesClient", "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.HyperVSitesClient", "PatchSite", resp, "Failure responding to request")
426		return
427	}
428
429	return
430}
431
432// PatchSitePreparer prepares the PatchSite request.
433func (client HyperVSitesClient) PatchSitePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, body HyperVSite, 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/HyperVSites/{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 HyperVSitesClient) 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 HyperVSitesClient) PatchSiteResponder(resp *http.Response) (result HyperVSite, 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 HyperVSitesClient) PutSite(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, body HyperVSite, APIVersion string) (result HyperVSite, err error) {
482	if tracing.IsEnabled() {
483		ctx = tracing.StartSpan(ctx, fqdn+"/HyperVSitesClient.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.HyperVSitesClient", "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.HyperVSitesClient", "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.HyperVSitesClient", "PutSite", resp, "Failure responding to request")
508		return
509	}
510
511	return
512}
513
514// PutSitePreparer prepares the PutSite request.
515func (client HyperVSitesClient) PutSitePreparer(ctx context.Context, subscriptionID string, resourceGroupName string, siteName string, body HyperVSite, 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/HyperVSites/{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 HyperVSitesClient) 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 HyperVSitesClient) PutSiteResponder(resp *http.Response) (result HyperVSite, 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 HyperVSitesClient) 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+"/HyperVSitesClient.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.HyperVSitesClient", "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.HyperVSitesClient", "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.HyperVSitesClient", "RefreshSite", resp, "Failure responding to request")
589		return
590	}
591
592	return
593}
594
595// RefreshSitePreparer prepares the RefreshSite request.
596func (client HyperVSitesClient) 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/HyperVSites/{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 HyperVSitesClient) 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 HyperVSitesClient) 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