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