1 package devices
2
3
4
5
6
7
8
9 import (
10 "context"
11 "encoding/json"
12 "github.com/Azure/go-autorest/autorest"
13 "github.com/Azure/go-autorest/autorest/azure"
14 "github.com/Azure/go-autorest/autorest/date"
15 "github.com/Azure/go-autorest/autorest/to"
16 "github.com/Azure/go-autorest/tracing"
17 "net/http"
18 )
19
20
21 const fqdn = "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2018-01-22/devices"
22
23
24 type CertificateBodyDescription struct {
25
26 Certificate *string `json:"certificate,omitempty"`
27 }
28
29
30 type CertificateDescription struct {
31 autorest.Response `json:"-"`
32 Properties *CertificateProperties `json:"properties,omitempty"`
33
34 ID *string `json:"id,omitempty"`
35
36 Name *string `json:"name,omitempty"`
37
38 Etag *string `json:"etag,omitempty"`
39
40 Type *string `json:"type,omitempty"`
41 }
42
43
44 func (cd CertificateDescription) MarshalJSON() ([]byte, error) {
45 objectMap := make(map[string]interface{})
46 if cd.Properties != nil {
47 objectMap["properties"] = cd.Properties
48 }
49 return json.Marshal(objectMap)
50 }
51
52
53 type CertificateListDescription struct {
54 autorest.Response `json:"-"`
55
56 Value *[]CertificateDescription `json:"value,omitempty"`
57 }
58
59
60 type CertificateProperties struct {
61
62 Subject *string `json:"subject,omitempty"`
63
64 Expiry *date.TimeRFC1123 `json:"expiry,omitempty"`
65
66 Thumbprint *string `json:"thumbprint,omitempty"`
67
68 IsVerified *bool `json:"isVerified,omitempty"`
69
70 Created *date.TimeRFC1123 `json:"created,omitempty"`
71
72 Updated *date.TimeRFC1123 `json:"updated,omitempty"`
73 }
74
75
76 func (cp CertificateProperties) MarshalJSON() ([]byte, error) {
77 objectMap := make(map[string]interface{})
78 return json.Marshal(objectMap)
79 }
80
81
82
83 type CertificatePropertiesWithNonce struct {
84
85 Subject *string `json:"subject,omitempty"`
86
87 Expiry *date.TimeRFC1123 `json:"expiry,omitempty"`
88
89 Thumbprint *string `json:"thumbprint,omitempty"`
90
91 IsVerified *bool `json:"isVerified,omitempty"`
92
93 Created *date.TimeRFC1123 `json:"created,omitempty"`
94
95 Updated *date.TimeRFC1123 `json:"updated,omitempty"`
96
97 VerificationCode *string `json:"verificationCode,omitempty"`
98 }
99
100
101 func (cpwn CertificatePropertiesWithNonce) MarshalJSON() ([]byte, error) {
102 objectMap := make(map[string]interface{})
103 return json.Marshal(objectMap)
104 }
105
106
107 type CertificateVerificationDescription struct {
108
109 Certificate *string `json:"certificate,omitempty"`
110 }
111
112
113 type CertificateWithNonceDescription struct {
114 autorest.Response `json:"-"`
115 Properties *CertificatePropertiesWithNonce `json:"properties,omitempty"`
116
117 ID *string `json:"id,omitempty"`
118
119 Name *string `json:"name,omitempty"`
120
121 Etag *string `json:"etag,omitempty"`
122
123 Type *string `json:"type,omitempty"`
124 }
125
126
127 func (cwnd CertificateWithNonceDescription) MarshalJSON() ([]byte, error) {
128 objectMap := make(map[string]interface{})
129 if cwnd.Properties != nil {
130 objectMap["properties"] = cwnd.Properties
131 }
132 return json.Marshal(objectMap)
133 }
134
135
136 type CloudToDeviceProperties struct {
137
138 MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
139
140 DefaultTTLAsIso8601 *string `json:"defaultTtlAsIso8601,omitempty"`
141 Feedback *FeedbackProperties `json:"feedback,omitempty"`
142 }
143
144
145 type ErrorDetails struct {
146
147 Code *string `json:"code,omitempty"`
148
149 HTTPStatusCode *string `json:"httpStatusCode,omitempty"`
150
151 Message *string `json:"message,omitempty"`
152
153 Details *string `json:"details,omitempty"`
154 }
155
156
157 func (ed ErrorDetails) MarshalJSON() ([]byte, error) {
158 objectMap := make(map[string]interface{})
159 return json.Marshal(objectMap)
160 }
161
162
163 type EventHubConsumerGroupInfo struct {
164 autorest.Response `json:"-"`
165
166 Properties map[string]*string `json:"properties"`
167
168 ID *string `json:"id,omitempty"`
169
170 Name *string `json:"name,omitempty"`
171
172 Type *string `json:"type,omitempty"`
173
174 Etag *string `json:"etag,omitempty"`
175 }
176
177
178 func (ehcgi EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) {
179 objectMap := make(map[string]interface{})
180 if ehcgi.Properties != nil {
181 objectMap["properties"] = ehcgi.Properties
182 }
183 return json.Marshal(objectMap)
184 }
185
186
187
188 type EventHubConsumerGroupsListResult struct {
189 autorest.Response `json:"-"`
190
191 Value *[]EventHubConsumerGroupInfo `json:"value,omitempty"`
192
193 NextLink *string `json:"nextLink,omitempty"`
194 }
195
196
197 func (ehcglr EventHubConsumerGroupsListResult) MarshalJSON() ([]byte, error) {
198 objectMap := make(map[string]interface{})
199 if ehcglr.Value != nil {
200 objectMap["value"] = ehcglr.Value
201 }
202 return json.Marshal(objectMap)
203 }
204
205
206
207 type EventHubConsumerGroupsListResultIterator struct {
208 i int
209 page EventHubConsumerGroupsListResultPage
210 }
211
212
213
214 func (iter *EventHubConsumerGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) {
215 if tracing.IsEnabled() {
216 ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultIterator.NextWithContext")
217 defer func() {
218 sc := -1
219 if iter.Response().Response.Response != nil {
220 sc = iter.Response().Response.Response.StatusCode
221 }
222 tracing.EndSpan(ctx, sc, err)
223 }()
224 }
225 iter.i++
226 if iter.i < len(iter.page.Values()) {
227 return nil
228 }
229 err = iter.page.NextWithContext(ctx)
230 if err != nil {
231 iter.i--
232 return err
233 }
234 iter.i = 0
235 return nil
236 }
237
238
239
240
241 func (iter *EventHubConsumerGroupsListResultIterator) Next() error {
242 return iter.NextWithContext(context.Background())
243 }
244
245
246 func (iter EventHubConsumerGroupsListResultIterator) NotDone() bool {
247 return iter.page.NotDone() && iter.i < len(iter.page.Values())
248 }
249
250
251 func (iter EventHubConsumerGroupsListResultIterator) Response() EventHubConsumerGroupsListResult {
252 return iter.page.Response()
253 }
254
255
256
257 func (iter EventHubConsumerGroupsListResultIterator) Value() EventHubConsumerGroupInfo {
258 if !iter.page.NotDone() {
259 return EventHubConsumerGroupInfo{}
260 }
261 return iter.page.Values()[iter.i]
262 }
263
264
265 func NewEventHubConsumerGroupsListResultIterator(page EventHubConsumerGroupsListResultPage) EventHubConsumerGroupsListResultIterator {
266 return EventHubConsumerGroupsListResultIterator{page: page}
267 }
268
269
270 func (ehcglr EventHubConsumerGroupsListResult) IsEmpty() bool {
271 return ehcglr.Value == nil || len(*ehcglr.Value) == 0
272 }
273
274
275 func (ehcglr EventHubConsumerGroupsListResult) hasNextLink() bool {
276 return ehcglr.NextLink != nil && len(*ehcglr.NextLink) != 0
277 }
278
279
280
281 func (ehcglr EventHubConsumerGroupsListResult) eventHubConsumerGroupsListResultPreparer(ctx context.Context) (*http.Request, error) {
282 if !ehcglr.hasNextLink() {
283 return nil, nil
284 }
285 return autorest.Prepare((&http.Request{}).WithContext(ctx),
286 autorest.AsJSON(),
287 autorest.AsGet(),
288 autorest.WithBaseURL(to.String(ehcglr.NextLink)))
289 }
290
291
292 type EventHubConsumerGroupsListResultPage struct {
293 fn func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)
294 ehcglr EventHubConsumerGroupsListResult
295 }
296
297
298
299 func (page *EventHubConsumerGroupsListResultPage) NextWithContext(ctx context.Context) (err error) {
300 if tracing.IsEnabled() {
301 ctx = tracing.StartSpan(ctx, fqdn+"/EventHubConsumerGroupsListResultPage.NextWithContext")
302 defer func() {
303 sc := -1
304 if page.Response().Response.Response != nil {
305 sc = page.Response().Response.Response.StatusCode
306 }
307 tracing.EndSpan(ctx, sc, err)
308 }()
309 }
310 for {
311 next, err := page.fn(ctx, page.ehcglr)
312 if err != nil {
313 return err
314 }
315 page.ehcglr = next
316 if !next.hasNextLink() || !next.IsEmpty() {
317 break
318 }
319 }
320 return nil
321 }
322
323
324
325
326 func (page *EventHubConsumerGroupsListResultPage) Next() error {
327 return page.NextWithContext(context.Background())
328 }
329
330
331 func (page EventHubConsumerGroupsListResultPage) NotDone() bool {
332 return !page.ehcglr.IsEmpty()
333 }
334
335
336 func (page EventHubConsumerGroupsListResultPage) Response() EventHubConsumerGroupsListResult {
337 return page.ehcglr
338 }
339
340
341 func (page EventHubConsumerGroupsListResultPage) Values() []EventHubConsumerGroupInfo {
342 if page.ehcglr.IsEmpty() {
343 return nil
344 }
345 return *page.ehcglr.Value
346 }
347
348
349 func NewEventHubConsumerGroupsListResultPage(cur EventHubConsumerGroupsListResult, getNextPage func(context.Context, EventHubConsumerGroupsListResult) (EventHubConsumerGroupsListResult, error)) EventHubConsumerGroupsListResultPage {
350 return EventHubConsumerGroupsListResultPage{
351 fn: getNextPage,
352 ehcglr: cur,
353 }
354 }
355
356
357 type EventHubProperties struct {
358
359 RetentionTimeInDays *int64 `json:"retentionTimeInDays,omitempty"`
360
361 PartitionCount *int32 `json:"partitionCount,omitempty"`
362
363 PartitionIds *[]string `json:"partitionIds,omitempty"`
364
365 Path *string `json:"path,omitempty"`
366
367 Endpoint *string `json:"endpoint,omitempty"`
368 }
369
370
371 func (ehp EventHubProperties) MarshalJSON() ([]byte, error) {
372 objectMap := make(map[string]interface{})
373 if ehp.RetentionTimeInDays != nil {
374 objectMap["retentionTimeInDays"] = ehp.RetentionTimeInDays
375 }
376 if ehp.PartitionCount != nil {
377 objectMap["partitionCount"] = ehp.PartitionCount
378 }
379 return json.Marshal(objectMap)
380 }
381
382
383 type ExportDevicesRequest struct {
384
385 ExportBlobContainerURI *string `json:"exportBlobContainerUri,omitempty"`
386
387 ExcludeKeys *bool `json:"excludeKeys,omitempty"`
388 }
389
390
391
392 type FallbackRouteProperties struct {
393
394 Name *string `json:"name,omitempty"`
395
396 Source *string `json:"source,omitempty"`
397
398 Condition *string `json:"condition,omitempty"`
399
400 EndpointNames *[]string `json:"endpointNames,omitempty"`
401
402 IsEnabled *bool `json:"isEnabled,omitempty"`
403 }
404
405
406 type FeedbackProperties struct {
407
408 LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
409
410 TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
411
412 MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
413 }
414
415
416 type ImportDevicesRequest struct {
417
418 InputBlobContainerURI *string `json:"inputBlobContainerUri,omitempty"`
419
420 OutputBlobContainerURI *string `json:"outputBlobContainerUri,omitempty"`
421 }
422
423
424 type IotHubCapacity struct {
425
426 Minimum *int64 `json:"minimum,omitempty"`
427
428 Maximum *int64 `json:"maximum,omitempty"`
429
430 Default *int64 `json:"default,omitempty"`
431
432 ScaleType IotHubScaleType `json:"scaleType,omitempty"`
433 }
434
435
436 func (ihc IotHubCapacity) MarshalJSON() ([]byte, error) {
437 objectMap := make(map[string]interface{})
438 return json.Marshal(objectMap)
439 }
440
441
442 type IotHubDescription struct {
443 autorest.Response `json:"-"`
444
445 Etag *string `json:"etag,omitempty"`
446 Properties *IotHubProperties `json:"properties,omitempty"`
447 Sku *IotHubSkuInfo `json:"sku,omitempty"`
448
449 ID *string `json:"id,omitempty"`
450
451 Name *string `json:"name,omitempty"`
452
453 Type *string `json:"type,omitempty"`
454
455 Location *string `json:"location,omitempty"`
456
457 Tags map[string]*string `json:"tags"`
458 }
459
460
461 func (ihd IotHubDescription) MarshalJSON() ([]byte, error) {
462 objectMap := make(map[string]interface{})
463 if ihd.Etag != nil {
464 objectMap["etag"] = ihd.Etag
465 }
466 if ihd.Properties != nil {
467 objectMap["properties"] = ihd.Properties
468 }
469 if ihd.Sku != nil {
470 objectMap["sku"] = ihd.Sku
471 }
472 if ihd.Location != nil {
473 objectMap["location"] = ihd.Location
474 }
475 if ihd.Tags != nil {
476 objectMap["tags"] = ihd.Tags
477 }
478 return json.Marshal(objectMap)
479 }
480
481
482 type IotHubDescriptionListResult struct {
483 autorest.Response `json:"-"`
484
485 Value *[]IotHubDescription `json:"value,omitempty"`
486
487 NextLink *string `json:"nextLink,omitempty"`
488 }
489
490
491 func (ihdlr IotHubDescriptionListResult) MarshalJSON() ([]byte, error) {
492 objectMap := make(map[string]interface{})
493 if ihdlr.Value != nil {
494 objectMap["value"] = ihdlr.Value
495 }
496 return json.Marshal(objectMap)
497 }
498
499
500 type IotHubDescriptionListResultIterator struct {
501 i int
502 page IotHubDescriptionListResultPage
503 }
504
505
506
507 func (iter *IotHubDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
508 if tracing.IsEnabled() {
509 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultIterator.NextWithContext")
510 defer func() {
511 sc := -1
512 if iter.Response().Response.Response != nil {
513 sc = iter.Response().Response.Response.StatusCode
514 }
515 tracing.EndSpan(ctx, sc, err)
516 }()
517 }
518 iter.i++
519 if iter.i < len(iter.page.Values()) {
520 return nil
521 }
522 err = iter.page.NextWithContext(ctx)
523 if err != nil {
524 iter.i--
525 return err
526 }
527 iter.i = 0
528 return nil
529 }
530
531
532
533
534 func (iter *IotHubDescriptionListResultIterator) Next() error {
535 return iter.NextWithContext(context.Background())
536 }
537
538
539 func (iter IotHubDescriptionListResultIterator) NotDone() bool {
540 return iter.page.NotDone() && iter.i < len(iter.page.Values())
541 }
542
543
544 func (iter IotHubDescriptionListResultIterator) Response() IotHubDescriptionListResult {
545 return iter.page.Response()
546 }
547
548
549
550 func (iter IotHubDescriptionListResultIterator) Value() IotHubDescription {
551 if !iter.page.NotDone() {
552 return IotHubDescription{}
553 }
554 return iter.page.Values()[iter.i]
555 }
556
557
558 func NewIotHubDescriptionListResultIterator(page IotHubDescriptionListResultPage) IotHubDescriptionListResultIterator {
559 return IotHubDescriptionListResultIterator{page: page}
560 }
561
562
563 func (ihdlr IotHubDescriptionListResult) IsEmpty() bool {
564 return ihdlr.Value == nil || len(*ihdlr.Value) == 0
565 }
566
567
568 func (ihdlr IotHubDescriptionListResult) hasNextLink() bool {
569 return ihdlr.NextLink != nil && len(*ihdlr.NextLink) != 0
570 }
571
572
573
574 func (ihdlr IotHubDescriptionListResult) iotHubDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
575 if !ihdlr.hasNextLink() {
576 return nil, nil
577 }
578 return autorest.Prepare((&http.Request{}).WithContext(ctx),
579 autorest.AsJSON(),
580 autorest.AsGet(),
581 autorest.WithBaseURL(to.String(ihdlr.NextLink)))
582 }
583
584
585 type IotHubDescriptionListResultPage struct {
586 fn func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)
587 ihdlr IotHubDescriptionListResult
588 }
589
590
591
592 func (page *IotHubDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
593 if tracing.IsEnabled() {
594 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubDescriptionListResultPage.NextWithContext")
595 defer func() {
596 sc := -1
597 if page.Response().Response.Response != nil {
598 sc = page.Response().Response.Response.StatusCode
599 }
600 tracing.EndSpan(ctx, sc, err)
601 }()
602 }
603 for {
604 next, err := page.fn(ctx, page.ihdlr)
605 if err != nil {
606 return err
607 }
608 page.ihdlr = next
609 if !next.hasNextLink() || !next.IsEmpty() {
610 break
611 }
612 }
613 return nil
614 }
615
616
617
618
619 func (page *IotHubDescriptionListResultPage) Next() error {
620 return page.NextWithContext(context.Background())
621 }
622
623
624 func (page IotHubDescriptionListResultPage) NotDone() bool {
625 return !page.ihdlr.IsEmpty()
626 }
627
628
629 func (page IotHubDescriptionListResultPage) Response() IotHubDescriptionListResult {
630 return page.ihdlr
631 }
632
633
634 func (page IotHubDescriptionListResultPage) Values() []IotHubDescription {
635 if page.ihdlr.IsEmpty() {
636 return nil
637 }
638 return *page.ihdlr.Value
639 }
640
641
642 func NewIotHubDescriptionListResultPage(cur IotHubDescriptionListResult, getNextPage func(context.Context, IotHubDescriptionListResult) (IotHubDescriptionListResult, error)) IotHubDescriptionListResultPage {
643 return IotHubDescriptionListResultPage{
644 fn: getNextPage,
645 ihdlr: cur,
646 }
647 }
648
649
650 type IotHubNameAvailabilityInfo struct {
651 autorest.Response `json:"-"`
652
653 NameAvailable *bool `json:"nameAvailable,omitempty"`
654
655 Reason IotHubNameUnavailabilityReason `json:"reason,omitempty"`
656
657 Message *string `json:"message,omitempty"`
658 }
659
660
661 func (ihnai IotHubNameAvailabilityInfo) MarshalJSON() ([]byte, error) {
662 objectMap := make(map[string]interface{})
663 if ihnai.Message != nil {
664 objectMap["message"] = ihnai.Message
665 }
666 return json.Marshal(objectMap)
667 }
668
669
670 type IotHubProperties struct {
671
672 AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"`
673
674 IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"`
675
676 ProvisioningState *string `json:"provisioningState,omitempty"`
677
678 State *string `json:"state,omitempty"`
679
680 HostName *string `json:"hostName,omitempty"`
681
682 EventHubEndpoints map[string]*EventHubProperties `json:"eventHubEndpoints"`
683 Routing *RoutingProperties `json:"routing,omitempty"`
684
685 StorageEndpoints map[string]*StorageEndpointProperties `json:"storageEndpoints"`
686
687 MessagingEndpoints map[string]*MessagingEndpointProperties `json:"messagingEndpoints"`
688
689 EnableFileUploadNotifications *bool `json:"enableFileUploadNotifications,omitempty"`
690 CloudToDevice *CloudToDeviceProperties `json:"cloudToDevice,omitempty"`
691
692 Comments *string `json:"comments,omitempty"`
693 OperationsMonitoringProperties *OperationsMonitoringProperties `json:"operationsMonitoringProperties,omitempty"`
694
695 Features Capabilities `json:"features,omitempty"`
696 }
697
698
699 func (ihp IotHubProperties) MarshalJSON() ([]byte, error) {
700 objectMap := make(map[string]interface{})
701 if ihp.AuthorizationPolicies != nil {
702 objectMap["authorizationPolicies"] = ihp.AuthorizationPolicies
703 }
704 if ihp.IPFilterRules != nil {
705 objectMap["ipFilterRules"] = ihp.IPFilterRules
706 }
707 if ihp.EventHubEndpoints != nil {
708 objectMap["eventHubEndpoints"] = ihp.EventHubEndpoints
709 }
710 if ihp.Routing != nil {
711 objectMap["routing"] = ihp.Routing
712 }
713 if ihp.StorageEndpoints != nil {
714 objectMap["storageEndpoints"] = ihp.StorageEndpoints
715 }
716 if ihp.MessagingEndpoints != nil {
717 objectMap["messagingEndpoints"] = ihp.MessagingEndpoints
718 }
719 if ihp.EnableFileUploadNotifications != nil {
720 objectMap["enableFileUploadNotifications"] = ihp.EnableFileUploadNotifications
721 }
722 if ihp.CloudToDevice != nil {
723 objectMap["cloudToDevice"] = ihp.CloudToDevice
724 }
725 if ihp.Comments != nil {
726 objectMap["comments"] = ihp.Comments
727 }
728 if ihp.OperationsMonitoringProperties != nil {
729 objectMap["operationsMonitoringProperties"] = ihp.OperationsMonitoringProperties
730 }
731 if ihp.Features != "" {
732 objectMap["features"] = ihp.Features
733 }
734 return json.Marshal(objectMap)
735 }
736
737
738 type IotHubQuotaMetricInfo struct {
739
740 Name *string `json:"name,omitempty"`
741
742 CurrentValue *int64 `json:"currentValue,omitempty"`
743
744 MaxValue *int64 `json:"maxValue,omitempty"`
745 }
746
747
748 func (ihqmi IotHubQuotaMetricInfo) MarshalJSON() ([]byte, error) {
749 objectMap := make(map[string]interface{})
750 return json.Marshal(objectMap)
751 }
752
753
754
755 type IotHubQuotaMetricInfoListResult struct {
756 autorest.Response `json:"-"`
757
758 Value *[]IotHubQuotaMetricInfo `json:"value,omitempty"`
759
760 NextLink *string `json:"nextLink,omitempty"`
761 }
762
763
764 func (ihqmilr IotHubQuotaMetricInfoListResult) MarshalJSON() ([]byte, error) {
765 objectMap := make(map[string]interface{})
766 if ihqmilr.Value != nil {
767 objectMap["value"] = ihqmilr.Value
768 }
769 return json.Marshal(objectMap)
770 }
771
772
773
774 type IotHubQuotaMetricInfoListResultIterator struct {
775 i int
776 page IotHubQuotaMetricInfoListResultPage
777 }
778
779
780
781 func (iter *IotHubQuotaMetricInfoListResultIterator) NextWithContext(ctx context.Context) (err error) {
782 if tracing.IsEnabled() {
783 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultIterator.NextWithContext")
784 defer func() {
785 sc := -1
786 if iter.Response().Response.Response != nil {
787 sc = iter.Response().Response.Response.StatusCode
788 }
789 tracing.EndSpan(ctx, sc, err)
790 }()
791 }
792 iter.i++
793 if iter.i < len(iter.page.Values()) {
794 return nil
795 }
796 err = iter.page.NextWithContext(ctx)
797 if err != nil {
798 iter.i--
799 return err
800 }
801 iter.i = 0
802 return nil
803 }
804
805
806
807
808 func (iter *IotHubQuotaMetricInfoListResultIterator) Next() error {
809 return iter.NextWithContext(context.Background())
810 }
811
812
813 func (iter IotHubQuotaMetricInfoListResultIterator) NotDone() bool {
814 return iter.page.NotDone() && iter.i < len(iter.page.Values())
815 }
816
817
818 func (iter IotHubQuotaMetricInfoListResultIterator) Response() IotHubQuotaMetricInfoListResult {
819 return iter.page.Response()
820 }
821
822
823
824 func (iter IotHubQuotaMetricInfoListResultIterator) Value() IotHubQuotaMetricInfo {
825 if !iter.page.NotDone() {
826 return IotHubQuotaMetricInfo{}
827 }
828 return iter.page.Values()[iter.i]
829 }
830
831
832 func NewIotHubQuotaMetricInfoListResultIterator(page IotHubQuotaMetricInfoListResultPage) IotHubQuotaMetricInfoListResultIterator {
833 return IotHubQuotaMetricInfoListResultIterator{page: page}
834 }
835
836
837 func (ihqmilr IotHubQuotaMetricInfoListResult) IsEmpty() bool {
838 return ihqmilr.Value == nil || len(*ihqmilr.Value) == 0
839 }
840
841
842 func (ihqmilr IotHubQuotaMetricInfoListResult) hasNextLink() bool {
843 return ihqmilr.NextLink != nil && len(*ihqmilr.NextLink) != 0
844 }
845
846
847
848 func (ihqmilr IotHubQuotaMetricInfoListResult) iotHubQuotaMetricInfoListResultPreparer(ctx context.Context) (*http.Request, error) {
849 if !ihqmilr.hasNextLink() {
850 return nil, nil
851 }
852 return autorest.Prepare((&http.Request{}).WithContext(ctx),
853 autorest.AsJSON(),
854 autorest.AsGet(),
855 autorest.WithBaseURL(to.String(ihqmilr.NextLink)))
856 }
857
858
859 type IotHubQuotaMetricInfoListResultPage struct {
860 fn func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)
861 ihqmilr IotHubQuotaMetricInfoListResult
862 }
863
864
865
866 func (page *IotHubQuotaMetricInfoListResultPage) NextWithContext(ctx context.Context) (err error) {
867 if tracing.IsEnabled() {
868 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubQuotaMetricInfoListResultPage.NextWithContext")
869 defer func() {
870 sc := -1
871 if page.Response().Response.Response != nil {
872 sc = page.Response().Response.Response.StatusCode
873 }
874 tracing.EndSpan(ctx, sc, err)
875 }()
876 }
877 for {
878 next, err := page.fn(ctx, page.ihqmilr)
879 if err != nil {
880 return err
881 }
882 page.ihqmilr = next
883 if !next.hasNextLink() || !next.IsEmpty() {
884 break
885 }
886 }
887 return nil
888 }
889
890
891
892
893 func (page *IotHubQuotaMetricInfoListResultPage) Next() error {
894 return page.NextWithContext(context.Background())
895 }
896
897
898 func (page IotHubQuotaMetricInfoListResultPage) NotDone() bool {
899 return !page.ihqmilr.IsEmpty()
900 }
901
902
903 func (page IotHubQuotaMetricInfoListResultPage) Response() IotHubQuotaMetricInfoListResult {
904 return page.ihqmilr
905 }
906
907
908 func (page IotHubQuotaMetricInfoListResultPage) Values() []IotHubQuotaMetricInfo {
909 if page.ihqmilr.IsEmpty() {
910 return nil
911 }
912 return *page.ihqmilr.Value
913 }
914
915
916 func NewIotHubQuotaMetricInfoListResultPage(cur IotHubQuotaMetricInfoListResult, getNextPage func(context.Context, IotHubQuotaMetricInfoListResult) (IotHubQuotaMetricInfoListResult, error)) IotHubQuotaMetricInfoListResultPage {
917 return IotHubQuotaMetricInfoListResultPage{
918 fn: getNextPage,
919 ihqmilr: cur,
920 }
921 }
922
923
924
925 type IotHubResourceCreateOrUpdateFuture struct {
926 azure.FutureAPI
927
928
929 Result func(IotHubResourceClient) (IotHubDescription, error)
930 }
931
932
933 func (future *IotHubResourceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
934 var azFuture azure.Future
935 if err := json.Unmarshal(body, &azFuture); err != nil {
936 return err
937 }
938 future.FutureAPI = &azFuture
939 future.Result = future.result
940 return nil
941 }
942
943
944 func (future *IotHubResourceCreateOrUpdateFuture) result(client IotHubResourceClient) (ihd IotHubDescription, err error) {
945 var done bool
946 done, err = future.DoneWithContext(context.Background(), client)
947 if err != nil {
948 err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
949 return
950 }
951 if !done {
952 ihd.Response.Response = future.Response()
953 err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceCreateOrUpdateFuture")
954 return
955 }
956 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
957 if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent {
958 ihd, err = client.CreateOrUpdateResponder(ihd.Response.Response)
959 if err != nil {
960 err = autorest.NewErrorWithError(err, "devices.IotHubResourceCreateOrUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request")
961 }
962 }
963 return
964 }
965
966
967
968 type IotHubResourceDeleteFuture struct {
969 azure.FutureAPI
970
971
972 Result func(IotHubResourceClient) (SetObject, error)
973 }
974
975
976 func (future *IotHubResourceDeleteFuture) UnmarshalJSON(body []byte) error {
977 var azFuture azure.Future
978 if err := json.Unmarshal(body, &azFuture); err != nil {
979 return err
980 }
981 future.FutureAPI = &azFuture
982 future.Result = future.result
983 return nil
984 }
985
986
987 func (future *IotHubResourceDeleteFuture) result(client IotHubResourceClient) (so SetObject, err error) {
988 var done bool
989 done, err = future.DoneWithContext(context.Background(), client)
990 if err != nil {
991 err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", future.Response(), "Polling failure")
992 return
993 }
994 if !done {
995 so.Response.Response = future.Response()
996 err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceDeleteFuture")
997 return
998 }
999 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1000 if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent {
1001 so, err = client.DeleteResponder(so.Response.Response)
1002 if err != nil {
1003 err = autorest.NewErrorWithError(err, "devices.IotHubResourceDeleteFuture", "Result", so.Response.Response, "Failure responding to request")
1004 }
1005 }
1006 return
1007 }
1008
1009
1010
1011 type IotHubResourceUpdateFuture struct {
1012 azure.FutureAPI
1013
1014
1015 Result func(IotHubResourceClient) (IotHubDescription, error)
1016 }
1017
1018
1019 func (future *IotHubResourceUpdateFuture) UnmarshalJSON(body []byte) error {
1020 var azFuture azure.Future
1021 if err := json.Unmarshal(body, &azFuture); err != nil {
1022 return err
1023 }
1024 future.FutureAPI = &azFuture
1025 future.Result = future.result
1026 return nil
1027 }
1028
1029
1030 func (future *IotHubResourceUpdateFuture) result(client IotHubResourceClient) (ihd IotHubDescription, err error) {
1031 var done bool
1032 done, err = future.DoneWithContext(context.Background(), client)
1033 if err != nil {
1034 err = autorest.NewErrorWithError(err, "devices.IotHubResourceUpdateFuture", "Result", future.Response(), "Polling failure")
1035 return
1036 }
1037 if !done {
1038 ihd.Response.Response = future.Response()
1039 err = azure.NewAsyncOpIncompleteError("devices.IotHubResourceUpdateFuture")
1040 return
1041 }
1042 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1043 if ihd.Response.Response, err = future.GetResult(sender); err == nil && ihd.Response.Response.StatusCode != http.StatusNoContent {
1044 ihd, err = client.UpdateResponder(ihd.Response.Response)
1045 if err != nil {
1046 err = autorest.NewErrorWithError(err, "devices.IotHubResourceUpdateFuture", "Result", ihd.Response.Response, "Failure responding to request")
1047 }
1048 }
1049 return
1050 }
1051
1052
1053 type IotHubSkuDescription struct {
1054
1055 ResourceType *string `json:"resourceType,omitempty"`
1056
1057 Sku *IotHubSkuInfo `json:"sku,omitempty"`
1058 Capacity *IotHubCapacity `json:"capacity,omitempty"`
1059 }
1060
1061
1062 func (ihsd IotHubSkuDescription) MarshalJSON() ([]byte, error) {
1063 objectMap := make(map[string]interface{})
1064 if ihsd.Sku != nil {
1065 objectMap["sku"] = ihsd.Sku
1066 }
1067 if ihsd.Capacity != nil {
1068 objectMap["capacity"] = ihsd.Capacity
1069 }
1070 return json.Marshal(objectMap)
1071 }
1072
1073
1074
1075 type IotHubSkuDescriptionListResult struct {
1076 autorest.Response `json:"-"`
1077
1078 Value *[]IotHubSkuDescription `json:"value,omitempty"`
1079
1080 NextLink *string `json:"nextLink,omitempty"`
1081 }
1082
1083
1084 func (ihsdlr IotHubSkuDescriptionListResult) MarshalJSON() ([]byte, error) {
1085 objectMap := make(map[string]interface{})
1086 if ihsdlr.Value != nil {
1087 objectMap["value"] = ihsdlr.Value
1088 }
1089 return json.Marshal(objectMap)
1090 }
1091
1092
1093
1094 type IotHubSkuDescriptionListResultIterator struct {
1095 i int
1096 page IotHubSkuDescriptionListResultPage
1097 }
1098
1099
1100
1101 func (iter *IotHubSkuDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
1102 if tracing.IsEnabled() {
1103 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultIterator.NextWithContext")
1104 defer func() {
1105 sc := -1
1106 if iter.Response().Response.Response != nil {
1107 sc = iter.Response().Response.Response.StatusCode
1108 }
1109 tracing.EndSpan(ctx, sc, err)
1110 }()
1111 }
1112 iter.i++
1113 if iter.i < len(iter.page.Values()) {
1114 return nil
1115 }
1116 err = iter.page.NextWithContext(ctx)
1117 if err != nil {
1118 iter.i--
1119 return err
1120 }
1121 iter.i = 0
1122 return nil
1123 }
1124
1125
1126
1127
1128 func (iter *IotHubSkuDescriptionListResultIterator) Next() error {
1129 return iter.NextWithContext(context.Background())
1130 }
1131
1132
1133 func (iter IotHubSkuDescriptionListResultIterator) NotDone() bool {
1134 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1135 }
1136
1137
1138 func (iter IotHubSkuDescriptionListResultIterator) Response() IotHubSkuDescriptionListResult {
1139 return iter.page.Response()
1140 }
1141
1142
1143
1144 func (iter IotHubSkuDescriptionListResultIterator) Value() IotHubSkuDescription {
1145 if !iter.page.NotDone() {
1146 return IotHubSkuDescription{}
1147 }
1148 return iter.page.Values()[iter.i]
1149 }
1150
1151
1152 func NewIotHubSkuDescriptionListResultIterator(page IotHubSkuDescriptionListResultPage) IotHubSkuDescriptionListResultIterator {
1153 return IotHubSkuDescriptionListResultIterator{page: page}
1154 }
1155
1156
1157 func (ihsdlr IotHubSkuDescriptionListResult) IsEmpty() bool {
1158 return ihsdlr.Value == nil || len(*ihsdlr.Value) == 0
1159 }
1160
1161
1162 func (ihsdlr IotHubSkuDescriptionListResult) hasNextLink() bool {
1163 return ihsdlr.NextLink != nil && len(*ihsdlr.NextLink) != 0
1164 }
1165
1166
1167
1168 func (ihsdlr IotHubSkuDescriptionListResult) iotHubSkuDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
1169 if !ihsdlr.hasNextLink() {
1170 return nil, nil
1171 }
1172 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1173 autorest.AsJSON(),
1174 autorest.AsGet(),
1175 autorest.WithBaseURL(to.String(ihsdlr.NextLink)))
1176 }
1177
1178
1179 type IotHubSkuDescriptionListResultPage struct {
1180 fn func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)
1181 ihsdlr IotHubSkuDescriptionListResult
1182 }
1183
1184
1185
1186 func (page *IotHubSkuDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
1187 if tracing.IsEnabled() {
1188 ctx = tracing.StartSpan(ctx, fqdn+"/IotHubSkuDescriptionListResultPage.NextWithContext")
1189 defer func() {
1190 sc := -1
1191 if page.Response().Response.Response != nil {
1192 sc = page.Response().Response.Response.StatusCode
1193 }
1194 tracing.EndSpan(ctx, sc, err)
1195 }()
1196 }
1197 for {
1198 next, err := page.fn(ctx, page.ihsdlr)
1199 if err != nil {
1200 return err
1201 }
1202 page.ihsdlr = next
1203 if !next.hasNextLink() || !next.IsEmpty() {
1204 break
1205 }
1206 }
1207 return nil
1208 }
1209
1210
1211
1212
1213 func (page *IotHubSkuDescriptionListResultPage) Next() error {
1214 return page.NextWithContext(context.Background())
1215 }
1216
1217
1218 func (page IotHubSkuDescriptionListResultPage) NotDone() bool {
1219 return !page.ihsdlr.IsEmpty()
1220 }
1221
1222
1223 func (page IotHubSkuDescriptionListResultPage) Response() IotHubSkuDescriptionListResult {
1224 return page.ihsdlr
1225 }
1226
1227
1228 func (page IotHubSkuDescriptionListResultPage) Values() []IotHubSkuDescription {
1229 if page.ihsdlr.IsEmpty() {
1230 return nil
1231 }
1232 return *page.ihsdlr.Value
1233 }
1234
1235
1236 func NewIotHubSkuDescriptionListResultPage(cur IotHubSkuDescriptionListResult, getNextPage func(context.Context, IotHubSkuDescriptionListResult) (IotHubSkuDescriptionListResult, error)) IotHubSkuDescriptionListResultPage {
1237 return IotHubSkuDescriptionListResultPage{
1238 fn: getNextPage,
1239 ihsdlr: cur,
1240 }
1241 }
1242
1243
1244 type IotHubSkuInfo struct {
1245
1246 Name IotHubSku `json:"name,omitempty"`
1247
1248 Tier IotHubSkuTier `json:"tier,omitempty"`
1249
1250 Capacity *int64 `json:"capacity,omitempty"`
1251 }
1252
1253
1254 func (ihsi IotHubSkuInfo) MarshalJSON() ([]byte, error) {
1255 objectMap := make(map[string]interface{})
1256 if ihsi.Name != "" {
1257 objectMap["name"] = ihsi.Name
1258 }
1259 if ihsi.Capacity != nil {
1260 objectMap["capacity"] = ihsi.Capacity
1261 }
1262 return json.Marshal(objectMap)
1263 }
1264
1265
1266 type IPFilterRule struct {
1267
1268 FilterName *string `json:"filterName,omitempty"`
1269
1270 Action IPFilterActionType `json:"action,omitempty"`
1271
1272 IPMask *string `json:"ipMask,omitempty"`
1273 }
1274
1275
1276 type JobResponse struct {
1277 autorest.Response `json:"-"`
1278
1279 JobID *string `json:"jobId,omitempty"`
1280
1281 StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"`
1282
1283 EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"`
1284
1285 Type JobType `json:"type,omitempty"`
1286
1287 Status JobStatus `json:"status,omitempty"`
1288
1289 FailureReason *string `json:"failureReason,omitempty"`
1290
1291 StatusMessage *string `json:"statusMessage,omitempty"`
1292
1293 ParentJobID *string `json:"parentJobId,omitempty"`
1294 }
1295
1296
1297 func (jr JobResponse) MarshalJSON() ([]byte, error) {
1298 objectMap := make(map[string]interface{})
1299 return json.Marshal(objectMap)
1300 }
1301
1302
1303 type JobResponseListResult struct {
1304 autorest.Response `json:"-"`
1305
1306 Value *[]JobResponse `json:"value,omitempty"`
1307
1308 NextLink *string `json:"nextLink,omitempty"`
1309 }
1310
1311
1312 func (jrlr JobResponseListResult) MarshalJSON() ([]byte, error) {
1313 objectMap := make(map[string]interface{})
1314 if jrlr.Value != nil {
1315 objectMap["value"] = jrlr.Value
1316 }
1317 return json.Marshal(objectMap)
1318 }
1319
1320
1321 type JobResponseListResultIterator struct {
1322 i int
1323 page JobResponseListResultPage
1324 }
1325
1326
1327
1328 func (iter *JobResponseListResultIterator) NextWithContext(ctx context.Context) (err error) {
1329 if tracing.IsEnabled() {
1330 ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultIterator.NextWithContext")
1331 defer func() {
1332 sc := -1
1333 if iter.Response().Response.Response != nil {
1334 sc = iter.Response().Response.Response.StatusCode
1335 }
1336 tracing.EndSpan(ctx, sc, err)
1337 }()
1338 }
1339 iter.i++
1340 if iter.i < len(iter.page.Values()) {
1341 return nil
1342 }
1343 err = iter.page.NextWithContext(ctx)
1344 if err != nil {
1345 iter.i--
1346 return err
1347 }
1348 iter.i = 0
1349 return nil
1350 }
1351
1352
1353
1354
1355 func (iter *JobResponseListResultIterator) Next() error {
1356 return iter.NextWithContext(context.Background())
1357 }
1358
1359
1360 func (iter JobResponseListResultIterator) NotDone() bool {
1361 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1362 }
1363
1364
1365 func (iter JobResponseListResultIterator) Response() JobResponseListResult {
1366 return iter.page.Response()
1367 }
1368
1369
1370
1371 func (iter JobResponseListResultIterator) Value() JobResponse {
1372 if !iter.page.NotDone() {
1373 return JobResponse{}
1374 }
1375 return iter.page.Values()[iter.i]
1376 }
1377
1378
1379 func NewJobResponseListResultIterator(page JobResponseListResultPage) JobResponseListResultIterator {
1380 return JobResponseListResultIterator{page: page}
1381 }
1382
1383
1384 func (jrlr JobResponseListResult) IsEmpty() bool {
1385 return jrlr.Value == nil || len(*jrlr.Value) == 0
1386 }
1387
1388
1389 func (jrlr JobResponseListResult) hasNextLink() bool {
1390 return jrlr.NextLink != nil && len(*jrlr.NextLink) != 0
1391 }
1392
1393
1394
1395 func (jrlr JobResponseListResult) jobResponseListResultPreparer(ctx context.Context) (*http.Request, error) {
1396 if !jrlr.hasNextLink() {
1397 return nil, nil
1398 }
1399 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1400 autorest.AsJSON(),
1401 autorest.AsGet(),
1402 autorest.WithBaseURL(to.String(jrlr.NextLink)))
1403 }
1404
1405
1406 type JobResponseListResultPage struct {
1407 fn func(context.Context, JobResponseListResult) (JobResponseListResult, error)
1408 jrlr JobResponseListResult
1409 }
1410
1411
1412
1413 func (page *JobResponseListResultPage) NextWithContext(ctx context.Context) (err error) {
1414 if tracing.IsEnabled() {
1415 ctx = tracing.StartSpan(ctx, fqdn+"/JobResponseListResultPage.NextWithContext")
1416 defer func() {
1417 sc := -1
1418 if page.Response().Response.Response != nil {
1419 sc = page.Response().Response.Response.StatusCode
1420 }
1421 tracing.EndSpan(ctx, sc, err)
1422 }()
1423 }
1424 for {
1425 next, err := page.fn(ctx, page.jrlr)
1426 if err != nil {
1427 return err
1428 }
1429 page.jrlr = next
1430 if !next.hasNextLink() || !next.IsEmpty() {
1431 break
1432 }
1433 }
1434 return nil
1435 }
1436
1437
1438
1439
1440 func (page *JobResponseListResultPage) Next() error {
1441 return page.NextWithContext(context.Background())
1442 }
1443
1444
1445 func (page JobResponseListResultPage) NotDone() bool {
1446 return !page.jrlr.IsEmpty()
1447 }
1448
1449
1450 func (page JobResponseListResultPage) Response() JobResponseListResult {
1451 return page.jrlr
1452 }
1453
1454
1455 func (page JobResponseListResultPage) Values() []JobResponse {
1456 if page.jrlr.IsEmpty() {
1457 return nil
1458 }
1459 return *page.jrlr.Value
1460 }
1461
1462
1463 func NewJobResponseListResultPage(cur JobResponseListResult, getNextPage func(context.Context, JobResponseListResult) (JobResponseListResult, error)) JobResponseListResultPage {
1464 return JobResponseListResultPage{
1465 fn: getNextPage,
1466 jrlr: cur,
1467 }
1468 }
1469
1470
1471 type MessagingEndpointProperties struct {
1472
1473 LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"`
1474
1475 TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"`
1476
1477 MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"`
1478 }
1479
1480
1481 type Operation struct {
1482
1483 Name *string `json:"name,omitempty"`
1484
1485 Display *OperationDisplay `json:"display,omitempty"`
1486 }
1487
1488
1489 func (o Operation) MarshalJSON() ([]byte, error) {
1490 objectMap := make(map[string]interface{})
1491 if o.Display != nil {
1492 objectMap["display"] = o.Display
1493 }
1494 return json.Marshal(objectMap)
1495 }
1496
1497
1498 type OperationDisplay struct {
1499
1500 Provider *string `json:"provider,omitempty"`
1501
1502 Resource *string `json:"resource,omitempty"`
1503
1504 Operation *string `json:"operation,omitempty"`
1505 }
1506
1507
1508 func (o OperationDisplay) MarshalJSON() ([]byte, error) {
1509 objectMap := make(map[string]interface{})
1510 return json.Marshal(objectMap)
1511 }
1512
1513
1514 type OperationInputs struct {
1515
1516 Name *string `json:"name,omitempty"`
1517 }
1518
1519
1520
1521 type OperationListResult struct {
1522 autorest.Response `json:"-"`
1523
1524 Value *[]Operation `json:"value,omitempty"`
1525
1526 NextLink *string `json:"nextLink,omitempty"`
1527 }
1528
1529
1530 func (olr OperationListResult) MarshalJSON() ([]byte, error) {
1531 objectMap := make(map[string]interface{})
1532 return json.Marshal(objectMap)
1533 }
1534
1535
1536 type OperationListResultIterator struct {
1537 i int
1538 page OperationListResultPage
1539 }
1540
1541
1542
1543 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1544 if tracing.IsEnabled() {
1545 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
1546 defer func() {
1547 sc := -1
1548 if iter.Response().Response.Response != nil {
1549 sc = iter.Response().Response.Response.StatusCode
1550 }
1551 tracing.EndSpan(ctx, sc, err)
1552 }()
1553 }
1554 iter.i++
1555 if iter.i < len(iter.page.Values()) {
1556 return nil
1557 }
1558 err = iter.page.NextWithContext(ctx)
1559 if err != nil {
1560 iter.i--
1561 return err
1562 }
1563 iter.i = 0
1564 return nil
1565 }
1566
1567
1568
1569
1570 func (iter *OperationListResultIterator) Next() error {
1571 return iter.NextWithContext(context.Background())
1572 }
1573
1574
1575 func (iter OperationListResultIterator) NotDone() bool {
1576 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1577 }
1578
1579
1580 func (iter OperationListResultIterator) Response() OperationListResult {
1581 return iter.page.Response()
1582 }
1583
1584
1585
1586 func (iter OperationListResultIterator) Value() Operation {
1587 if !iter.page.NotDone() {
1588 return Operation{}
1589 }
1590 return iter.page.Values()[iter.i]
1591 }
1592
1593
1594 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
1595 return OperationListResultIterator{page: page}
1596 }
1597
1598
1599 func (olr OperationListResult) IsEmpty() bool {
1600 return olr.Value == nil || len(*olr.Value) == 0
1601 }
1602
1603
1604 func (olr OperationListResult) hasNextLink() bool {
1605 return olr.NextLink != nil && len(*olr.NextLink) != 0
1606 }
1607
1608
1609
1610 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
1611 if !olr.hasNextLink() {
1612 return nil, nil
1613 }
1614 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1615 autorest.AsJSON(),
1616 autorest.AsGet(),
1617 autorest.WithBaseURL(to.String(olr.NextLink)))
1618 }
1619
1620
1621 type OperationListResultPage struct {
1622 fn func(context.Context, OperationListResult) (OperationListResult, error)
1623 olr OperationListResult
1624 }
1625
1626
1627
1628 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
1629 if tracing.IsEnabled() {
1630 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
1631 defer func() {
1632 sc := -1
1633 if page.Response().Response.Response != nil {
1634 sc = page.Response().Response.Response.StatusCode
1635 }
1636 tracing.EndSpan(ctx, sc, err)
1637 }()
1638 }
1639 for {
1640 next, err := page.fn(ctx, page.olr)
1641 if err != nil {
1642 return err
1643 }
1644 page.olr = next
1645 if !next.hasNextLink() || !next.IsEmpty() {
1646 break
1647 }
1648 }
1649 return nil
1650 }
1651
1652
1653
1654
1655 func (page *OperationListResultPage) Next() error {
1656 return page.NextWithContext(context.Background())
1657 }
1658
1659
1660 func (page OperationListResultPage) NotDone() bool {
1661 return !page.olr.IsEmpty()
1662 }
1663
1664
1665 func (page OperationListResultPage) Response() OperationListResult {
1666 return page.olr
1667 }
1668
1669
1670 func (page OperationListResultPage) Values() []Operation {
1671 if page.olr.IsEmpty() {
1672 return nil
1673 }
1674 return *page.olr.Value
1675 }
1676
1677
1678 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1679 return OperationListResultPage{
1680 fn: getNextPage,
1681 olr: cur,
1682 }
1683 }
1684
1685
1686
1687
1688
1689 type OperationsMonitoringProperties struct {
1690 Events map[string]*OperationMonitoringLevel `json:"events"`
1691 }
1692
1693
1694 func (omp OperationsMonitoringProperties) MarshalJSON() ([]byte, error) {
1695 objectMap := make(map[string]interface{})
1696 if omp.Events != nil {
1697 objectMap["events"] = omp.Events
1698 }
1699 return json.Marshal(objectMap)
1700 }
1701
1702
1703 type RegistryStatistics struct {
1704 autorest.Response `json:"-"`
1705
1706 TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"`
1707
1708 EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"`
1709
1710 DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"`
1711 }
1712
1713
1714 func (rs RegistryStatistics) MarshalJSON() ([]byte, error) {
1715 objectMap := make(map[string]interface{})
1716 return json.Marshal(objectMap)
1717 }
1718
1719
1720 type Resource struct {
1721
1722 ID *string `json:"id,omitempty"`
1723
1724 Name *string `json:"name,omitempty"`
1725
1726 Type *string `json:"type,omitempty"`
1727
1728 Location *string `json:"location,omitempty"`
1729
1730 Tags map[string]*string `json:"tags"`
1731 }
1732
1733
1734 func (r Resource) MarshalJSON() ([]byte, error) {
1735 objectMap := make(map[string]interface{})
1736 if r.Location != nil {
1737 objectMap["location"] = r.Location
1738 }
1739 if r.Tags != nil {
1740 objectMap["tags"] = r.Tags
1741 }
1742 return json.Marshal(objectMap)
1743 }
1744
1745
1746 type RouteProperties struct {
1747
1748 Name *string `json:"name,omitempty"`
1749
1750 Source RoutingSource `json:"source,omitempty"`
1751
1752 Condition *string `json:"condition,omitempty"`
1753
1754 EndpointNames *[]string `json:"endpointNames,omitempty"`
1755
1756 IsEnabled *bool `json:"isEnabled,omitempty"`
1757 }
1758
1759
1760
1761
1762 type RoutingEndpoints struct {
1763
1764 ServiceBusQueues *[]RoutingServiceBusQueueEndpointProperties `json:"serviceBusQueues,omitempty"`
1765
1766 ServiceBusTopics *[]RoutingServiceBusTopicEndpointProperties `json:"serviceBusTopics,omitempty"`
1767
1768 EventHubs *[]RoutingEventHubProperties `json:"eventHubs,omitempty"`
1769
1770 StorageContainers *[]RoutingStorageContainerProperties `json:"storageContainers,omitempty"`
1771 }
1772
1773
1774 type RoutingEventHubProperties struct {
1775
1776 ConnectionString *string `json:"connectionString,omitempty"`
1777
1778 Name *string `json:"name,omitempty"`
1779
1780 SubscriptionID *string `json:"subscriptionId,omitempty"`
1781
1782 ResourceGroup *string `json:"resourceGroup,omitempty"`
1783 }
1784
1785
1786
1787 type RoutingProperties struct {
1788 Endpoints *RoutingEndpoints `json:"endpoints,omitempty"`
1789
1790 Routes *[]RouteProperties `json:"routes,omitempty"`
1791
1792 FallbackRoute *FallbackRouteProperties `json:"fallbackRoute,omitempty"`
1793 }
1794
1795
1796 type RoutingServiceBusQueueEndpointProperties struct {
1797
1798 ConnectionString *string `json:"connectionString,omitempty"`
1799
1800 Name *string `json:"name,omitempty"`
1801
1802 SubscriptionID *string `json:"subscriptionId,omitempty"`
1803
1804 ResourceGroup *string `json:"resourceGroup,omitempty"`
1805 }
1806
1807
1808 type RoutingServiceBusTopicEndpointProperties struct {
1809
1810 ConnectionString *string `json:"connectionString,omitempty"`
1811
1812 Name *string `json:"name,omitempty"`
1813
1814 SubscriptionID *string `json:"subscriptionId,omitempty"`
1815
1816 ResourceGroup *string `json:"resourceGroup,omitempty"`
1817 }
1818
1819
1820 type RoutingStorageContainerProperties struct {
1821
1822 ConnectionString *string `json:"connectionString,omitempty"`
1823
1824 Name *string `json:"name,omitempty"`
1825
1826 SubscriptionID *string `json:"subscriptionId,omitempty"`
1827
1828 ResourceGroup *string `json:"resourceGroup,omitempty"`
1829
1830 ContainerName *string `json:"containerName,omitempty"`
1831
1832 FileNameFormat *string `json:"fileNameFormat,omitempty"`
1833
1834 BatchFrequencyInSeconds *int32 `json:"batchFrequencyInSeconds,omitempty"`
1835
1836 MaxChunkSizeInBytes *int32 `json:"maxChunkSizeInBytes,omitempty"`
1837
1838 Encoding *string `json:"encoding,omitempty"`
1839 }
1840
1841
1842 type SetObject struct {
1843 autorest.Response `json:"-"`
1844 Value interface{} `json:"value,omitempty"`
1845 }
1846
1847
1848 type SharedAccessSignatureAuthorizationRule struct {
1849 autorest.Response `json:"-"`
1850
1851 KeyName *string `json:"keyName,omitempty"`
1852
1853 PrimaryKey *string `json:"primaryKey,omitempty"`
1854
1855 SecondaryKey *string `json:"secondaryKey,omitempty"`
1856
1857 Rights AccessRights `json:"rights,omitempty"`
1858 }
1859
1860
1861 type SharedAccessSignatureAuthorizationRuleListResult struct {
1862 autorest.Response `json:"-"`
1863
1864 Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"`
1865
1866 NextLink *string `json:"nextLink,omitempty"`
1867 }
1868
1869
1870 func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) MarshalJSON() ([]byte, error) {
1871 objectMap := make(map[string]interface{})
1872 if sasarlr.Value != nil {
1873 objectMap["value"] = sasarlr.Value
1874 }
1875 return json.Marshal(objectMap)
1876 }
1877
1878
1879
1880 type SharedAccessSignatureAuthorizationRuleListResultIterator struct {
1881 i int
1882 page SharedAccessSignatureAuthorizationRuleListResultPage
1883 }
1884
1885
1886
1887 func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
1888 if tracing.IsEnabled() {
1889 ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext")
1890 defer func() {
1891 sc := -1
1892 if iter.Response().Response.Response != nil {
1893 sc = iter.Response().Response.Response.StatusCode
1894 }
1895 tracing.EndSpan(ctx, sc, err)
1896 }()
1897 }
1898 iter.i++
1899 if iter.i < len(iter.page.Values()) {
1900 return nil
1901 }
1902 err = iter.page.NextWithContext(ctx)
1903 if err != nil {
1904 iter.i--
1905 return err
1906 }
1907 iter.i = 0
1908 return nil
1909 }
1910
1911
1912
1913
1914 func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error {
1915 return iter.NextWithContext(context.Background())
1916 }
1917
1918
1919 func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool {
1920 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1921 }
1922
1923
1924 func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult {
1925 return iter.page.Response()
1926 }
1927
1928
1929
1930 func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRule {
1931 if !iter.page.NotDone() {
1932 return SharedAccessSignatureAuthorizationRule{}
1933 }
1934 return iter.page.Values()[iter.i]
1935 }
1936
1937
1938 func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator {
1939 return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page}
1940 }
1941
1942
1943 func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {
1944 return sasarlr.Value == nil || len(*sasarlr.Value) == 0
1945 }
1946
1947
1948 func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) hasNextLink() bool {
1949 return sasarlr.NextLink != nil && len(*sasarlr.NextLink) != 0
1950 }
1951
1952
1953
1954 func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
1955 if !sasarlr.hasNextLink() {
1956 return nil, nil
1957 }
1958 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1959 autorest.AsJSON(),
1960 autorest.AsGet(),
1961 autorest.WithBaseURL(to.String(sasarlr.NextLink)))
1962 }
1963
1964
1965
1966 type SharedAccessSignatureAuthorizationRuleListResultPage struct {
1967 fn func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)
1968 sasarlr SharedAccessSignatureAuthorizationRuleListResult
1969 }
1970
1971
1972
1973 func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
1974 if tracing.IsEnabled() {
1975 ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext")
1976 defer func() {
1977 sc := -1
1978 if page.Response().Response.Response != nil {
1979 sc = page.Response().Response.Response.StatusCode
1980 }
1981 tracing.EndSpan(ctx, sc, err)
1982 }()
1983 }
1984 for {
1985 next, err := page.fn(ctx, page.sasarlr)
1986 if err != nil {
1987 return err
1988 }
1989 page.sasarlr = next
1990 if !next.hasNextLink() || !next.IsEmpty() {
1991 break
1992 }
1993 }
1994 return nil
1995 }
1996
1997
1998
1999
2000 func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error {
2001 return page.NextWithContext(context.Background())
2002 }
2003
2004
2005 func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {
2006 return !page.sasarlr.IsEmpty()
2007 }
2008
2009
2010 func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult {
2011 return page.sasarlr
2012 }
2013
2014
2015 func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRule {
2016 if page.sasarlr.IsEmpty() {
2017 return nil
2018 }
2019 return *page.sasarlr.Value
2020 }
2021
2022
2023 func NewSharedAccessSignatureAuthorizationRuleListResultPage(cur SharedAccessSignatureAuthorizationRuleListResult, getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage {
2024 return SharedAccessSignatureAuthorizationRuleListResultPage{
2025 fn: getNextPage,
2026 sasarlr: cur,
2027 }
2028 }
2029
2030
2031 type StorageEndpointProperties struct {
2032
2033 SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"`
2034
2035 ConnectionString *string `json:"connectionString,omitempty"`
2036
2037 ContainerName *string `json:"containerName,omitempty"`
2038 }
2039
2040
2041
2042 type TagsResource struct {
2043
2044 Tags map[string]*string `json:"tags"`
2045 }
2046
2047
2048 func (tr TagsResource) MarshalJSON() ([]byte, error) {
2049 objectMap := make(map[string]interface{})
2050 if tr.Tags != nil {
2051 objectMap["tags"] = tr.Tags
2052 }
2053 return json.Marshal(objectMap)
2054 }
2055
View as plain text