1package sql
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/autorest/validation"
25	"net/http"
26)
27
28// ServersClient is the the Azure SQL Database management API provides a RESTful set of web services that interact with
29// Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete
30// databases.
31type ServersClient struct {
32	BaseClient
33}
34
35// NewServersClient creates an instance of the ServersClient client.
36func NewServersClient(subscriptionID string) ServersClient {
37	return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID)
38}
39
40// NewServersClientWithBaseURI creates an instance of the ServersClient client.
41func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient {
42	return ServersClient{NewWithBaseURI(baseURI, subscriptionID)}
43}
44
45// CheckNameAvailability determines whether a resource can be created with the specified name.
46// Parameters:
47// parameters - the parameters to request for name availability.
48func (client ServersClient) CheckNameAvailability(ctx context.Context, parameters CheckNameAvailabilityRequest) (result CheckNameAvailabilityResponse, err error) {
49	if err := validation.Validate([]validation.Validation{
50		{TargetValue: parameters,
51			Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil},
52				{Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
53		return result, validation.NewError("sql.ServersClient", "CheckNameAvailability", err.Error())
54	}
55
56	req, err := client.CheckNameAvailabilityPreparer(ctx, parameters)
57	if err != nil {
58		err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", nil, "Failure preparing request")
59		return
60	}
61
62	resp, err := client.CheckNameAvailabilitySender(req)
63	if err != nil {
64		result.Response = autorest.Response{Response: resp}
65		err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", resp, "Failure sending request")
66		return
67	}
68
69	result, err = client.CheckNameAvailabilityResponder(resp)
70	if err != nil {
71		err = autorest.NewErrorWithError(err, "sql.ServersClient", "CheckNameAvailability", resp, "Failure responding to request")
72	}
73
74	return
75}
76
77// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
78func (client ServersClient) CheckNameAvailabilityPreparer(ctx context.Context, parameters CheckNameAvailabilityRequest) (*http.Request, error) {
79	pathParameters := map[string]interface{}{
80		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
81	}
82
83	const APIVersion = "2014-04-01"
84	queryParameters := map[string]interface{}{
85		"api-version": APIVersion,
86	}
87
88	preparer := autorest.CreatePreparer(
89		autorest.AsContentType("application/json; charset=utf-8"),
90		autorest.AsPost(),
91		autorest.WithBaseURL(client.BaseURI),
92		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability", pathParameters),
93		autorest.WithJSON(parameters),
94		autorest.WithQueryParameters(queryParameters))
95	return preparer.Prepare((&http.Request{}).WithContext(ctx))
96}
97
98// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
99// http.Response Body if it receives an error.
100func (client ServersClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
101	return autorest.SendWithSender(client, req,
102		azure.DoRetryWithRegistration(client.Client))
103}
104
105// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
106// closes the http.Response Body.
107func (client ServersClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResponse, err error) {
108	err = autorest.Respond(
109		resp,
110		client.ByInspecting(),
111		azure.WithErrorUnlessStatusCode(http.StatusOK),
112		autorest.ByUnmarshallingJSON(&result),
113		autorest.ByClosing())
114	result.Response = autorest.Response{Response: resp}
115	return
116}
117
118// CreateOrUpdate creates or updates a server.
119// Parameters:
120// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
121// from the Azure Resource Manager API or the portal.
122// serverName - the name of the server.
123// parameters - the requested server resource state.
124func (client ServersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (result ServersCreateOrUpdateFuture, err error) {
125	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters)
126	if err != nil {
127		err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", nil, "Failure preparing request")
128		return
129	}
130
131	result, err = client.CreateOrUpdateSender(req)
132	if err != nil {
133		err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", result.Response(), "Failure sending request")
134		return
135	}
136
137	return
138}
139
140// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
141func (client ServersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (*http.Request, error) {
142	pathParameters := map[string]interface{}{
143		"resourceGroupName": autorest.Encode("path", resourceGroupName),
144		"serverName":        autorest.Encode("path", serverName),
145		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
146	}
147
148	const APIVersion = "2015-05-01-preview"
149	queryParameters := map[string]interface{}{
150		"api-version": APIVersion,
151	}
152
153	preparer := autorest.CreatePreparer(
154		autorest.AsContentType("application/json; charset=utf-8"),
155		autorest.AsPut(),
156		autorest.WithBaseURL(client.BaseURI),
157		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters),
158		autorest.WithJSON(parameters),
159		autorest.WithQueryParameters(queryParameters))
160	return preparer.Prepare((&http.Request{}).WithContext(ctx))
161}
162
163// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
164// http.Response Body if it receives an error.
165func (client ServersClient) CreateOrUpdateSender(req *http.Request) (future ServersCreateOrUpdateFuture, err error) {
166	var resp *http.Response
167	resp, err = autorest.SendWithSender(client, req,
168		azure.DoRetryWithRegistration(client.Client))
169	if err != nil {
170		return
171	}
172	err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted))
173	if err != nil {
174		return
175	}
176	future.Future, err = azure.NewFutureFromResponse(resp)
177	return
178}
179
180// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
181// closes the http.Response Body.
182func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, err error) {
183	err = autorest.Respond(
184		resp,
185		client.ByInspecting(),
186		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
187		autorest.ByUnmarshallingJSON(&result),
188		autorest.ByClosing())
189	result.Response = autorest.Response{Response: resp}
190	return
191}
192
193// Delete deletes a server.
194// Parameters:
195// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
196// from the Azure Resource Manager API or the portal.
197// serverName - the name of the server.
198func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) {
199	req, err := client.DeletePreparer(ctx, resourceGroupName, serverName)
200	if err != nil {
201		err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", nil, "Failure preparing request")
202		return
203	}
204
205	result, err = client.DeleteSender(req)
206	if err != nil {
207		err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", result.Response(), "Failure sending request")
208		return
209	}
210
211	return
212}
213
214// DeletePreparer prepares the Delete request.
215func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) {
216	pathParameters := map[string]interface{}{
217		"resourceGroupName": autorest.Encode("path", resourceGroupName),
218		"serverName":        autorest.Encode("path", serverName),
219		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
220	}
221
222	const APIVersion = "2015-05-01-preview"
223	queryParameters := map[string]interface{}{
224		"api-version": APIVersion,
225	}
226
227	preparer := autorest.CreatePreparer(
228		autorest.AsDelete(),
229		autorest.WithBaseURL(client.BaseURI),
230		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters),
231		autorest.WithQueryParameters(queryParameters))
232	return preparer.Prepare((&http.Request{}).WithContext(ctx))
233}
234
235// DeleteSender sends the Delete request. The method will close the
236// http.Response Body if it receives an error.
237func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) {
238	var resp *http.Response
239	resp, err = autorest.SendWithSender(client, req,
240		azure.DoRetryWithRegistration(client.Client))
241	if err != nil {
242		return
243	}
244	err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
245	if err != nil {
246		return
247	}
248	future.Future, err = azure.NewFutureFromResponse(resp)
249	return
250}
251
252// DeleteResponder handles the response to the Delete request. The method always
253// closes the http.Response Body.
254func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
255	err = autorest.Respond(
256		resp,
257		client.ByInspecting(),
258		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
259		autorest.ByClosing())
260	result.Response = resp
261	return
262}
263
264// Get gets a server.
265// Parameters:
266// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
267// from the Azure Resource Manager API or the portal.
268// serverName - the name of the server.
269func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) {
270	req, err := client.GetPreparer(ctx, resourceGroupName, serverName)
271	if err != nil {
272		err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", nil, "Failure preparing request")
273		return
274	}
275
276	resp, err := client.GetSender(req)
277	if err != nil {
278		result.Response = autorest.Response{Response: resp}
279		err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure sending request")
280		return
281	}
282
283	result, err = client.GetResponder(resp)
284	if err != nil {
285		err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure responding to request")
286	}
287
288	return
289}
290
291// GetPreparer prepares the Get request.
292func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) {
293	pathParameters := map[string]interface{}{
294		"resourceGroupName": autorest.Encode("path", resourceGroupName),
295		"serverName":        autorest.Encode("path", serverName),
296		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
297	}
298
299	const APIVersion = "2015-05-01-preview"
300	queryParameters := map[string]interface{}{
301		"api-version": APIVersion,
302	}
303
304	preparer := autorest.CreatePreparer(
305		autorest.AsGet(),
306		autorest.WithBaseURL(client.BaseURI),
307		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters),
308		autorest.WithQueryParameters(queryParameters))
309	return preparer.Prepare((&http.Request{}).WithContext(ctx))
310}
311
312// GetSender sends the Get request. The method will close the
313// http.Response Body if it receives an error.
314func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) {
315	return autorest.SendWithSender(client, req,
316		azure.DoRetryWithRegistration(client.Client))
317}
318
319// GetResponder handles the response to the Get request. The method always
320// closes the http.Response Body.
321func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) {
322	err = autorest.Respond(
323		resp,
324		client.ByInspecting(),
325		azure.WithErrorUnlessStatusCode(http.StatusOK),
326		autorest.ByUnmarshallingJSON(&result),
327		autorest.ByClosing())
328	result.Response = autorest.Response{Response: resp}
329	return
330}
331
332// List gets a list of all servers in the subscription.
333func (client ServersClient) List(ctx context.Context) (result ServerListResultPage, err error) {
334	result.fn = client.listNextResults
335	req, err := client.ListPreparer(ctx)
336	if err != nil {
337		err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", nil, "Failure preparing request")
338		return
339	}
340
341	resp, err := client.ListSender(req)
342	if err != nil {
343		result.slr.Response = autorest.Response{Response: resp}
344		err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure sending request")
345		return
346	}
347
348	result.slr, err = client.ListResponder(resp)
349	if err != nil {
350		err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure responding to request")
351	}
352
353	return
354}
355
356// ListPreparer prepares the List request.
357func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) {
358	pathParameters := map[string]interface{}{
359		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
360	}
361
362	const APIVersion = "2015-05-01-preview"
363	queryParameters := map[string]interface{}{
364		"api-version": APIVersion,
365	}
366
367	preparer := autorest.CreatePreparer(
368		autorest.AsGet(),
369		autorest.WithBaseURL(client.BaseURI),
370		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers", pathParameters),
371		autorest.WithQueryParameters(queryParameters))
372	return preparer.Prepare((&http.Request{}).WithContext(ctx))
373}
374
375// ListSender sends the List request. The method will close the
376// http.Response Body if it receives an error.
377func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) {
378	return autorest.SendWithSender(client, req,
379		azure.DoRetryWithRegistration(client.Client))
380}
381
382// ListResponder handles the response to the List request. The method always
383// closes the http.Response Body.
384func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) {
385	err = autorest.Respond(
386		resp,
387		client.ByInspecting(),
388		azure.WithErrorUnlessStatusCode(http.StatusOK),
389		autorest.ByUnmarshallingJSON(&result),
390		autorest.ByClosing())
391	result.Response = autorest.Response{Response: resp}
392	return
393}
394
395// listNextResults retrieves the next set of results, if any.
396func (client ServersClient) listNextResults(lastResults ServerListResult) (result ServerListResult, err error) {
397	req, err := lastResults.serverListResultPreparer()
398	if err != nil {
399		return result, autorest.NewErrorWithError(err, "sql.ServersClient", "listNextResults", nil, "Failure preparing next results request")
400	}
401	if req == nil {
402		return
403	}
404	resp, err := client.ListSender(req)
405	if err != nil {
406		result.Response = autorest.Response{Response: resp}
407		return result, autorest.NewErrorWithError(err, "sql.ServersClient", "listNextResults", resp, "Failure sending next results request")
408	}
409	result, err = client.ListResponder(resp)
410	if err != nil {
411		err = autorest.NewErrorWithError(err, "sql.ServersClient", "listNextResults", resp, "Failure responding to next results request")
412	}
413	return
414}
415
416// ListComplete enumerates all values, automatically crossing page boundaries as required.
417func (client ServersClient) ListComplete(ctx context.Context) (result ServerListResultIterator, err error) {
418	result.page, err = client.List(ctx)
419	return
420}
421
422// ListByResourceGroup gets a list of servers in a resource groups.
423// Parameters:
424// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
425// from the Azure Resource Manager API or the portal.
426func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResultPage, err error) {
427	result.fn = client.listByResourceGroupNextResults
428	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
429	if err != nil {
430		err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request")
431		return
432	}
433
434	resp, err := client.ListByResourceGroupSender(req)
435	if err != nil {
436		result.slr.Response = autorest.Response{Response: resp}
437		err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure sending request")
438		return
439	}
440
441	result.slr, err = client.ListByResourceGroupResponder(resp)
442	if err != nil {
443		err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request")
444	}
445
446	return
447}
448
449// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
450func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
451	pathParameters := map[string]interface{}{
452		"resourceGroupName": autorest.Encode("path", resourceGroupName),
453		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
454	}
455
456	const APIVersion = "2015-05-01-preview"
457	queryParameters := map[string]interface{}{
458		"api-version": APIVersion,
459	}
460
461	preparer := autorest.CreatePreparer(
462		autorest.AsGet(),
463		autorest.WithBaseURL(client.BaseURI),
464		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers", pathParameters),
465		autorest.WithQueryParameters(queryParameters))
466	return preparer.Prepare((&http.Request{}).WithContext(ctx))
467}
468
469// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
470// http.Response Body if it receives an error.
471func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
472	return autorest.SendWithSender(client, req,
473		azure.DoRetryWithRegistration(client.Client))
474}
475
476// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
477// closes the http.Response Body.
478func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) {
479	err = autorest.Respond(
480		resp,
481		client.ByInspecting(),
482		azure.WithErrorUnlessStatusCode(http.StatusOK),
483		autorest.ByUnmarshallingJSON(&result),
484		autorest.ByClosing())
485	result.Response = autorest.Response{Response: resp}
486	return
487}
488
489// listByResourceGroupNextResults retrieves the next set of results, if any.
490func (client ServersClient) listByResourceGroupNextResults(lastResults ServerListResult) (result ServerListResult, err error) {
491	req, err := lastResults.serverListResultPreparer()
492	if err != nil {
493		return result, autorest.NewErrorWithError(err, "sql.ServersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
494	}
495	if req == nil {
496		return
497	}
498	resp, err := client.ListByResourceGroupSender(req)
499	if err != nil {
500		result.Response = autorest.Response{Response: resp}
501		return result, autorest.NewErrorWithError(err, "sql.ServersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
502	}
503	result, err = client.ListByResourceGroupResponder(resp)
504	if err != nil {
505		err = autorest.NewErrorWithError(err, "sql.ServersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
506	}
507	return
508}
509
510// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
511func (client ServersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServerListResultIterator, err error) {
512	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
513	return
514}
515
516// Update updates a server.
517// Parameters:
518// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
519// from the Azure Resource Manager API or the portal.
520// serverName - the name of the server.
521// parameters - the requested server resource state.
522func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (result ServersUpdateFuture, err error) {
523	req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters)
524	if err != nil {
525		err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", nil, "Failure preparing request")
526		return
527	}
528
529	result, err = client.UpdateSender(req)
530	if err != nil {
531		err = autorest.NewErrorWithError(err, "sql.ServersClient", "Update", result.Response(), "Failure sending request")
532		return
533	}
534
535	return
536}
537
538// UpdatePreparer prepares the Update request.
539func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate) (*http.Request, error) {
540	pathParameters := map[string]interface{}{
541		"resourceGroupName": autorest.Encode("path", resourceGroupName),
542		"serverName":        autorest.Encode("path", serverName),
543		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
544	}
545
546	const APIVersion = "2015-05-01-preview"
547	queryParameters := map[string]interface{}{
548		"api-version": APIVersion,
549	}
550
551	preparer := autorest.CreatePreparer(
552		autorest.AsContentType("application/json; charset=utf-8"),
553		autorest.AsPatch(),
554		autorest.WithBaseURL(client.BaseURI),
555		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters),
556		autorest.WithJSON(parameters),
557		autorest.WithQueryParameters(queryParameters))
558	return preparer.Prepare((&http.Request{}).WithContext(ctx))
559}
560
561// UpdateSender sends the Update request. The method will close the
562// http.Response Body if it receives an error.
563func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) {
564	var resp *http.Response
565	resp, err = autorest.SendWithSender(client, req,
566		azure.DoRetryWithRegistration(client.Client))
567	if err != nil {
568		return
569	}
570	err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
571	if err != nil {
572		return
573	}
574	future.Future, err = azure.NewFutureFromResponse(resp)
575	return
576}
577
578// UpdateResponder handles the response to the Update request. The method always
579// closes the http.Response Body.
580func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) {
581	err = autorest.Respond(
582		resp,
583		client.ByInspecting(),
584		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
585		autorest.ByUnmarshallingJSON(&result),
586		autorest.ByClosing())
587	result.Response = autorest.Response{Response: resp}
588	return
589}
590