1 package windowsiot
2
3
4
5
6
7
8
9 import (
10 "context"
11 "github.com/Azure/go-autorest/autorest"
12 "github.com/Azure/go-autorest/autorest/azure"
13 "github.com/Azure/go-autorest/autorest/validation"
14 "github.com/Azure/go-autorest/tracing"
15 "net/http"
16 )
17
18
19 type ServicesClient struct {
20 BaseClient
21 }
22
23
24 func NewServicesClient(subscriptionID string) ServicesClient {
25 return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30 func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient {
31 return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)}
32 }
33
34
35
36
37
38
39 func (client ServicesClient) CheckDeviceServiceNameAvailability(ctx context.Context, deviceServiceCheckNameAvailabilityParameters DeviceServiceCheckNameAvailabilityParameters) (result DeviceServiceNameAvailabilityInfo, err error) {
40 if tracing.IsEnabled() {
41 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CheckDeviceServiceNameAvailability")
42 defer func() {
43 sc := -1
44 if result.Response.Response != nil {
45 sc = result.Response.Response.StatusCode
46 }
47 tracing.EndSpan(ctx, sc, err)
48 }()
49 }
50 if err := validation.Validate([]validation.Validation{
51 {TargetValue: deviceServiceCheckNameAvailabilityParameters,
52 Constraints: []validation.Constraint{{Target: "deviceServiceCheckNameAvailabilityParameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
53 return result, validation.NewError("windowsiot.ServicesClient", "CheckDeviceServiceNameAvailability", err.Error())
54 }
55
56 req, err := client.CheckDeviceServiceNameAvailabilityPreparer(ctx, deviceServiceCheckNameAvailabilityParameters)
57 if err != nil {
58 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CheckDeviceServiceNameAvailability", nil, "Failure preparing request")
59 return
60 }
61
62 resp, err := client.CheckDeviceServiceNameAvailabilitySender(req)
63 if err != nil {
64 result.Response = autorest.Response{Response: resp}
65 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CheckDeviceServiceNameAvailability", resp, "Failure sending request")
66 return
67 }
68
69 result, err = client.CheckDeviceServiceNameAvailabilityResponder(resp)
70 if err != nil {
71 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CheckDeviceServiceNameAvailability", resp, "Failure responding to request")
72 return
73 }
74
75 return
76 }
77
78
79 func (client ServicesClient) CheckDeviceServiceNameAvailabilityPreparer(ctx context.Context, deviceServiceCheckNameAvailabilityParameters DeviceServiceCheckNameAvailabilityParameters) (*http.Request, error) {
80 pathParameters := map[string]interface{}{
81 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
82 }
83
84 const APIVersion = "2019-06-01"
85 queryParameters := map[string]interface{}{
86 "api-version": APIVersion,
87 }
88
89 preparer := autorest.CreatePreparer(
90 autorest.AsContentType("application/json; charset=utf-8"),
91 autorest.AsPost(),
92 autorest.WithBaseURL(client.BaseURI),
93 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.WindowsIoT/checkDeviceServiceNameAvailability", pathParameters),
94 autorest.WithJSON(deviceServiceCheckNameAvailabilityParameters),
95 autorest.WithQueryParameters(queryParameters))
96 return preparer.Prepare((&http.Request{}).WithContext(ctx))
97 }
98
99
100
101 func (client ServicesClient) CheckDeviceServiceNameAvailabilitySender(req *http.Request) (*http.Response, error) {
102 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
103 }
104
105
106
107 func (client ServicesClient) CheckDeviceServiceNameAvailabilityResponder(resp *http.Response) (result DeviceServiceNameAvailabilityInfo, err error) {
108 err = autorest.Respond(
109 resp,
110 azure.WithErrorUnlessStatusCode(http.StatusOK),
111 autorest.ByUnmarshallingJSON(&result),
112 autorest.ByClosing())
113 result.Response = autorest.Response{Response: resp}
114 return
115 }
116
117
118
119
120
121
122
123
124
125
126 func (client ServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deviceName string, deviceService DeviceServiceProperties, ifMatch string) (result DeviceService, err error) {
127 if tracing.IsEnabled() {
128 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CreateOrUpdate")
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.CreateOrUpdatePreparer(ctx, resourceGroupName, deviceName, deviceService, ifMatch)
138 if err != nil {
139 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request")
140 return
141 }
142
143 resp, err := client.CreateOrUpdateSender(req)
144 if err != nil {
145 result.Response = autorest.Response{Response: resp}
146 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CreateOrUpdate", resp, "Failure sending request")
147 return
148 }
149
150 result, err = client.CreateOrUpdateResponder(resp)
151 if err != nil {
152 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CreateOrUpdate", resp, "Failure responding to request")
153 return
154 }
155
156 return
157 }
158
159
160 func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, deviceName string, deviceService DeviceServiceProperties, ifMatch string) (*http.Request, error) {
161 pathParameters := map[string]interface{}{
162 "deviceName": autorest.Encode("path", deviceName),
163 "resourceGroupName": autorest.Encode("path", resourceGroupName),
164 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
165 }
166
167 const APIVersion = "2019-06-01"
168 queryParameters := map[string]interface{}{
169 "api-version": APIVersion,
170 }
171
172 deviceService.StartDate = nil
173 preparer := autorest.CreatePreparer(
174 autorest.AsContentType("application/json; charset=utf-8"),
175 autorest.AsPut(),
176 autorest.WithBaseURL(client.BaseURI),
177 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", pathParameters),
178 autorest.WithJSON(deviceService),
179 autorest.WithQueryParameters(queryParameters))
180 if len(ifMatch) > 0 {
181 preparer = autorest.DecoratePreparer(preparer,
182 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
183 }
184 return preparer.Prepare((&http.Request{}).WithContext(ctx))
185 }
186
187
188
189 func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
190 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
191 }
192
193
194
195 func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result DeviceService, err error) {
196 err = autorest.Respond(
197 resp,
198 azure.WithErrorUnlessStatusCode(http.StatusOK),
199 autorest.ByUnmarshallingJSON(&result),
200 autorest.ByClosing())
201 result.Response = autorest.Response{Response: resp}
202 return
203 }
204
205
206
207
208
209 func (client ServicesClient) Delete(ctx context.Context, resourceGroupName string, deviceName string) (result DeviceService, err error) {
210 if tracing.IsEnabled() {
211 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Delete")
212 defer func() {
213 sc := -1
214 if result.Response.Response != nil {
215 sc = result.Response.Response.StatusCode
216 }
217 tracing.EndSpan(ctx, sc, err)
218 }()
219 }
220 req, err := client.DeletePreparer(ctx, resourceGroupName, deviceName)
221 if err != nil {
222 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Delete", nil, "Failure preparing request")
223 return
224 }
225
226 resp, err := client.DeleteSender(req)
227 if err != nil {
228 result.Response = autorest.Response{Response: resp}
229 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Delete", resp, "Failure sending request")
230 return
231 }
232
233 result, err = client.DeleteResponder(resp)
234 if err != nil {
235 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Delete", resp, "Failure responding to request")
236 return
237 }
238
239 return
240 }
241
242
243 func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, deviceName string) (*http.Request, error) {
244 pathParameters := map[string]interface{}{
245 "deviceName": autorest.Encode("path", deviceName),
246 "resourceGroupName": autorest.Encode("path", resourceGroupName),
247 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
248 }
249
250 const APIVersion = "2019-06-01"
251 queryParameters := map[string]interface{}{
252 "api-version": APIVersion,
253 }
254
255 preparer := autorest.CreatePreparer(
256 autorest.AsDelete(),
257 autorest.WithBaseURL(client.BaseURI),
258 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", pathParameters),
259 autorest.WithQueryParameters(queryParameters))
260 return preparer.Prepare((&http.Request{}).WithContext(ctx))
261 }
262
263
264
265 func (client ServicesClient) DeleteSender(req *http.Request) (*http.Response, error) {
266 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
267 }
268
269
270
271 func (client ServicesClient) DeleteResponder(resp *http.Response) (result DeviceService, err error) {
272 err = autorest.Respond(
273 resp,
274 azure.WithErrorUnlessStatusCode(http.StatusOK),
275 autorest.ByUnmarshallingJSON(&result),
276 autorest.ByClosing())
277 result.Response = autorest.Response{Response: resp}
278 return
279 }
280
281
282
283
284
285 func (client ServicesClient) Get(ctx context.Context, resourceGroupName string, deviceName string) (result DeviceService, err error) {
286 if tracing.IsEnabled() {
287 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Get")
288 defer func() {
289 sc := -1
290 if result.Response.Response != nil {
291 sc = result.Response.Response.StatusCode
292 }
293 tracing.EndSpan(ctx, sc, err)
294 }()
295 }
296 req, err := client.GetPreparer(ctx, resourceGroupName, deviceName)
297 if err != nil {
298 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Get", nil, "Failure preparing request")
299 return
300 }
301
302 resp, err := client.GetSender(req)
303 if err != nil {
304 result.Response = autorest.Response{Response: resp}
305 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Get", resp, "Failure sending request")
306 return
307 }
308
309 result, err = client.GetResponder(resp)
310 if err != nil {
311 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Get", resp, "Failure responding to request")
312 return
313 }
314
315 return
316 }
317
318
319 func (client ServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, deviceName string) (*http.Request, error) {
320 pathParameters := map[string]interface{}{
321 "deviceName": autorest.Encode("path", deviceName),
322 "resourceGroupName": autorest.Encode("path", resourceGroupName),
323 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
324 }
325
326 const APIVersion = "2019-06-01"
327 queryParameters := map[string]interface{}{
328 "api-version": APIVersion,
329 }
330
331 preparer := autorest.CreatePreparer(
332 autorest.AsGet(),
333 autorest.WithBaseURL(client.BaseURI),
334 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", pathParameters),
335 autorest.WithQueryParameters(queryParameters))
336 return preparer.Prepare((&http.Request{}).WithContext(ctx))
337 }
338
339
340
341 func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) {
342 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
343 }
344
345
346
347 func (client ServicesClient) GetResponder(resp *http.Response) (result DeviceService, err error) {
348 err = autorest.Respond(
349 resp,
350 azure.WithErrorUnlessStatusCode(http.StatusOK),
351 autorest.ByUnmarshallingJSON(&result),
352 autorest.ByClosing())
353 result.Response = autorest.Response{Response: resp}
354 return
355 }
356
357
358 func (client ServicesClient) List(ctx context.Context) (result DeviceServiceDescriptionListResultPage, err error) {
359 if tracing.IsEnabled() {
360 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List")
361 defer func() {
362 sc := -1
363 if result.dsdlr.Response.Response != nil {
364 sc = result.dsdlr.Response.Response.StatusCode
365 }
366 tracing.EndSpan(ctx, sc, err)
367 }()
368 }
369 result.fn = client.listNextResults
370 req, err := client.ListPreparer(ctx)
371 if err != nil {
372 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "List", nil, "Failure preparing request")
373 return
374 }
375
376 resp, err := client.ListSender(req)
377 if err != nil {
378 result.dsdlr.Response = autorest.Response{Response: resp}
379 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "List", resp, "Failure sending request")
380 return
381 }
382
383 result.dsdlr, err = client.ListResponder(resp)
384 if err != nil {
385 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "List", resp, "Failure responding to request")
386 return
387 }
388 if result.dsdlr.hasNextLink() && result.dsdlr.IsEmpty() {
389 err = result.NextWithContext(ctx)
390 return
391 }
392
393 return
394 }
395
396
397 func (client ServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
398 pathParameters := map[string]interface{}{
399 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
400 }
401
402 const APIVersion = "2019-06-01"
403 queryParameters := map[string]interface{}{
404 "api-version": APIVersion,
405 }
406
407 preparer := autorest.CreatePreparer(
408 autorest.AsGet(),
409 autorest.WithBaseURL(client.BaseURI),
410 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.WindowsIoT/deviceServices", pathParameters),
411 autorest.WithQueryParameters(queryParameters))
412 return preparer.Prepare((&http.Request{}).WithContext(ctx))
413 }
414
415
416
417 func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) {
418 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
419 }
420
421
422
423 func (client ServicesClient) ListResponder(resp *http.Response) (result DeviceServiceDescriptionListResult, err error) {
424 err = autorest.Respond(
425 resp,
426 azure.WithErrorUnlessStatusCode(http.StatusOK),
427 autorest.ByUnmarshallingJSON(&result),
428 autorest.ByClosing())
429 result.Response = autorest.Response{Response: resp}
430 return
431 }
432
433
434 func (client ServicesClient) listNextResults(ctx context.Context, lastResults DeviceServiceDescriptionListResult) (result DeviceServiceDescriptionListResult, err error) {
435 req, err := lastResults.deviceServiceDescriptionListResultPreparer(ctx)
436 if err != nil {
437 return result, autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listNextResults", nil, "Failure preparing next results request")
438 }
439 if req == nil {
440 return
441 }
442 resp, err := client.ListSender(req)
443 if err != nil {
444 result.Response = autorest.Response{Response: resp}
445 return result, autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listNextResults", resp, "Failure sending next results request")
446 }
447 result, err = client.ListResponder(resp)
448 if err != nil {
449 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listNextResults", resp, "Failure responding to next results request")
450 }
451 return
452 }
453
454
455 func (client ServicesClient) ListComplete(ctx context.Context) (result DeviceServiceDescriptionListResultIterator, err error) {
456 if tracing.IsEnabled() {
457 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List")
458 defer func() {
459 sc := -1
460 if result.Response().Response.Response != nil {
461 sc = result.page.Response().Response.Response.StatusCode
462 }
463 tracing.EndSpan(ctx, sc, err)
464 }()
465 }
466 result.page, err = client.List(ctx)
467 return
468 }
469
470
471
472
473 func (client ServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DeviceServiceDescriptionListResultPage, err error) {
474 if tracing.IsEnabled() {
475 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListByResourceGroup")
476 defer func() {
477 sc := -1
478 if result.dsdlr.Response.Response != nil {
479 sc = result.dsdlr.Response.Response.StatusCode
480 }
481 tracing.EndSpan(ctx, sc, err)
482 }()
483 }
484 result.fn = client.listByResourceGroupNextResults
485 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
486 if err != nil {
487 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request")
488 return
489 }
490
491 resp, err := client.ListByResourceGroupSender(req)
492 if err != nil {
493 result.dsdlr.Response = autorest.Response{Response: resp}
494 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "ListByResourceGroup", resp, "Failure sending request")
495 return
496 }
497
498 result.dsdlr, err = client.ListByResourceGroupResponder(resp)
499 if err != nil {
500 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request")
501 return
502 }
503 if result.dsdlr.hasNextLink() && result.dsdlr.IsEmpty() {
504 err = result.NextWithContext(ctx)
505 return
506 }
507
508 return
509 }
510
511
512 func (client ServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
513 pathParameters := map[string]interface{}{
514 "resourceGroupName": autorest.Encode("path", resourceGroupName),
515 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
516 }
517
518 const APIVersion = "2019-06-01"
519 queryParameters := map[string]interface{}{
520 "api-version": APIVersion,
521 }
522
523 preparer := autorest.CreatePreparer(
524 autorest.AsGet(),
525 autorest.WithBaseURL(client.BaseURI),
526 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices", pathParameters),
527 autorest.WithQueryParameters(queryParameters))
528 return preparer.Prepare((&http.Request{}).WithContext(ctx))
529 }
530
531
532
533 func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
534 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
535 }
536
537
538
539 func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result DeviceServiceDescriptionListResult, err error) {
540 err = autorest.Respond(
541 resp,
542 azure.WithErrorUnlessStatusCode(http.StatusOK),
543 autorest.ByUnmarshallingJSON(&result),
544 autorest.ByClosing())
545 result.Response = autorest.Response{Response: resp}
546 return
547 }
548
549
550 func (client ServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DeviceServiceDescriptionListResult) (result DeviceServiceDescriptionListResult, err error) {
551 req, err := lastResults.deviceServiceDescriptionListResultPreparer(ctx)
552 if err != nil {
553 return result, autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
554 }
555 if req == nil {
556 return
557 }
558 resp, err := client.ListByResourceGroupSender(req)
559 if err != nil {
560 result.Response = autorest.Response{Response: resp}
561 return result, autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
562 }
563 result, err = client.ListByResourceGroupResponder(resp)
564 if err != nil {
565 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
566 }
567 return
568 }
569
570
571 func (client ServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DeviceServiceDescriptionListResultIterator, err error) {
572 if tracing.IsEnabled() {
573 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListByResourceGroup")
574 defer func() {
575 sc := -1
576 if result.Response().Response.Response != nil {
577 sc = result.page.Response().Response.Response.StatusCode
578 }
579 tracing.EndSpan(ctx, sc, err)
580 }()
581 }
582 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
583 return
584 }
585
586
587
588
589
590
591
592
593
594
595 func (client ServicesClient) Update(ctx context.Context, resourceGroupName string, deviceName string, deviceService DeviceServiceProperties, ifMatch string) (result DeviceService, err error) {
596 if tracing.IsEnabled() {
597 ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update")
598 defer func() {
599 sc := -1
600 if result.Response.Response != nil {
601 sc = result.Response.Response.StatusCode
602 }
603 tracing.EndSpan(ctx, sc, err)
604 }()
605 }
606 req, err := client.UpdatePreparer(ctx, resourceGroupName, deviceName, deviceService, ifMatch)
607 if err != nil {
608 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Update", nil, "Failure preparing request")
609 return
610 }
611
612 resp, err := client.UpdateSender(req)
613 if err != nil {
614 result.Response = autorest.Response{Response: resp}
615 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Update", resp, "Failure sending request")
616 return
617 }
618
619 result, err = client.UpdateResponder(resp)
620 if err != nil {
621 err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Update", resp, "Failure responding to request")
622 return
623 }
624
625 return
626 }
627
628
629 func (client ServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, deviceName string, deviceService DeviceServiceProperties, ifMatch string) (*http.Request, error) {
630 pathParameters := map[string]interface{}{
631 "deviceName": autorest.Encode("path", deviceName),
632 "resourceGroupName": autorest.Encode("path", resourceGroupName),
633 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
634 }
635
636 const APIVersion = "2019-06-01"
637 queryParameters := map[string]interface{}{
638 "api-version": APIVersion,
639 }
640
641 deviceService.StartDate = nil
642 preparer := autorest.CreatePreparer(
643 autorest.AsContentType("application/json; charset=utf-8"),
644 autorest.AsPatch(),
645 autorest.WithBaseURL(client.BaseURI),
646 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", pathParameters),
647 autorest.WithJSON(deviceService),
648 autorest.WithQueryParameters(queryParameters))
649 if len(ifMatch) > 0 {
650 preparer = autorest.DecoratePreparer(preparer,
651 autorest.WithHeader("If-Match", autorest.String(ifMatch)))
652 }
653 return preparer.Prepare((&http.Request{}).WithContext(ctx))
654 }
655
656
657
658 func (client ServicesClient) UpdateSender(req *http.Request) (*http.Response, error) {
659 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
660 }
661
662
663
664 func (client ServicesClient) UpdateResponder(resp *http.Response) (result DeviceService, err error) {
665 err = autorest.Respond(
666 resp,
667 azure.WithErrorUnlessStatusCode(http.StatusOK),
668 autorest.ByUnmarshallingJSON(&result),
669 autorest.ByClosing())
670 result.Response = autorest.Response{Response: resp}
671 return
672 }
673
View as plain text