1 package iothub
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/provisioningservices/mgmt/2018-01-22/iothub"
22
23
24 type AsyncOperationResult struct {
25 autorest.Response `json:"-"`
26
27 Status *string `json:"status,omitempty"`
28
29 Error *ErrorMesssage `json:"error,omitempty"`
30 }
31
32
33 type CertificateBodyDescription struct {
34
35 Certificate *string `json:"certificate,omitempty"`
36 }
37
38
39 type CertificateListDescription struct {
40 autorest.Response `json:"-"`
41
42 Value *[]CertificateResponse `json:"value,omitempty"`
43 }
44
45
46 type CertificateProperties struct {
47
48 Subject *string `json:"subject,omitempty"`
49
50 Expiry *date.TimeRFC1123 `json:"expiry,omitempty"`
51
52 Thumbprint *string `json:"thumbprint,omitempty"`
53
54 IsVerified *bool `json:"isVerified,omitempty"`
55
56 Created *date.TimeRFC1123 `json:"created,omitempty"`
57
58 Updated *date.TimeRFC1123 `json:"updated,omitempty"`
59 }
60
61
62 func (cp CertificateProperties) MarshalJSON() ([]byte, error) {
63 objectMap := make(map[string]interface{})
64 return json.Marshal(objectMap)
65 }
66
67
68 type CertificateResponse struct {
69 autorest.Response `json:"-"`
70
71 Properties *CertificateProperties `json:"properties,omitempty"`
72
73 ID *string `json:"id,omitempty"`
74
75 Name *string `json:"name,omitempty"`
76
77 Etag *string `json:"etag,omitempty"`
78
79 Type *string `json:"type,omitempty"`
80 }
81
82
83 func (cr CertificateResponse) MarshalJSON() ([]byte, error) {
84 objectMap := make(map[string]interface{})
85 if cr.Properties != nil {
86 objectMap["properties"] = cr.Properties
87 }
88 return json.Marshal(objectMap)
89 }
90
91
92 type DefinitionDescription struct {
93
94 ApplyAllocationPolicy *bool `json:"applyAllocationPolicy,omitempty"`
95
96 AllocationWeight *int32 `json:"allocationWeight,omitempty"`
97
98 Name *string `json:"name,omitempty"`
99
100 ConnectionString *string `json:"connectionString,omitempty"`
101
102 Location *string `json:"location,omitempty"`
103 }
104
105
106 func (dd DefinitionDescription) MarshalJSON() ([]byte, error) {
107 objectMap := make(map[string]interface{})
108 if dd.ApplyAllocationPolicy != nil {
109 objectMap["applyAllocationPolicy"] = dd.ApplyAllocationPolicy
110 }
111 if dd.AllocationWeight != nil {
112 objectMap["allocationWeight"] = dd.AllocationWeight
113 }
114 if dd.ConnectionString != nil {
115 objectMap["connectionString"] = dd.ConnectionString
116 }
117 if dd.Location != nil {
118 objectMap["location"] = dd.Location
119 }
120 return json.Marshal(objectMap)
121 }
122
123
124 type ErrorDetails struct {
125
126 Code *string `json:"code,omitempty"`
127
128 HTTPStatusCode *string `json:"httpStatusCode,omitempty"`
129
130 Message *string `json:"message,omitempty"`
131
132 Details *string `json:"details,omitempty"`
133 }
134
135
136 func (ed ErrorDetails) MarshalJSON() ([]byte, error) {
137 objectMap := make(map[string]interface{})
138 return json.Marshal(objectMap)
139 }
140
141
142 type ErrorMesssage struct {
143
144 Code *string `json:"code,omitempty"`
145
146 Message *string `json:"message,omitempty"`
147
148 Details *string `json:"details,omitempty"`
149 }
150
151
152
153 type IotDpsPropertiesDescription struct {
154
155 State State `json:"state,omitempty"`
156
157 ProvisioningState *string `json:"provisioningState,omitempty"`
158
159 IotHubs *[]DefinitionDescription `json:"iotHubs,omitempty"`
160
161 AllocationPolicy AllocationPolicy `json:"allocationPolicy,omitempty"`
162
163 ServiceOperationsHostName *string `json:"serviceOperationsHostName,omitempty"`
164
165 DeviceProvisioningHostName *string `json:"deviceProvisioningHostName,omitempty"`
166
167 IDScope *string `json:"idScope,omitempty"`
168
169 AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRuleAccessRightsDescription `json:"authorizationPolicies,omitempty"`
170 }
171
172
173 func (idpd IotDpsPropertiesDescription) MarshalJSON() ([]byte, error) {
174 objectMap := make(map[string]interface{})
175 if idpd.State != "" {
176 objectMap["state"] = idpd.State
177 }
178 if idpd.ProvisioningState != nil {
179 objectMap["provisioningState"] = idpd.ProvisioningState
180 }
181 if idpd.IotHubs != nil {
182 objectMap["iotHubs"] = idpd.IotHubs
183 }
184 if idpd.AllocationPolicy != "" {
185 objectMap["allocationPolicy"] = idpd.AllocationPolicy
186 }
187 if idpd.AuthorizationPolicies != nil {
188 objectMap["authorizationPolicies"] = idpd.AuthorizationPolicies
189 }
190 return json.Marshal(objectMap)
191 }
192
193
194
195 type IotDpsResourceCreateOrUpdateFuture struct {
196 azure.FutureAPI
197
198
199 Result func(IotDpsResourceClient) (ProvisioningServiceDescription, error)
200 }
201
202
203 func (future *IotDpsResourceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
204 var azFuture azure.Future
205 if err := json.Unmarshal(body, &azFuture); err != nil {
206 return err
207 }
208 future.FutureAPI = &azFuture
209 future.Result = future.result
210 return nil
211 }
212
213
214 func (future *IotDpsResourceCreateOrUpdateFuture) result(client IotDpsResourceClient) (psd ProvisioningServiceDescription, err error) {
215 var done bool
216 done, err = future.DoneWithContext(context.Background(), client)
217 if err != nil {
218 err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
219 return
220 }
221 if !done {
222 psd.Response.Response = future.Response()
223 err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceCreateOrUpdateFuture")
224 return
225 }
226 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
227 if psd.Response.Response, err = future.GetResult(sender); err == nil && psd.Response.Response.StatusCode != http.StatusNoContent {
228 psd, err = client.CreateOrUpdateResponder(psd.Response.Response)
229 if err != nil {
230 err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceCreateOrUpdateFuture", "Result", psd.Response.Response, "Failure responding to request")
231 }
232 }
233 return
234 }
235
236
237
238 type IotDpsResourceDeleteFuture struct {
239 azure.FutureAPI
240
241
242 Result func(IotDpsResourceClient) (autorest.Response, error)
243 }
244
245
246 func (future *IotDpsResourceDeleteFuture) UnmarshalJSON(body []byte) error {
247 var azFuture azure.Future
248 if err := json.Unmarshal(body, &azFuture); err != nil {
249 return err
250 }
251 future.FutureAPI = &azFuture
252 future.Result = future.result
253 return nil
254 }
255
256
257 func (future *IotDpsResourceDeleteFuture) result(client IotDpsResourceClient) (ar autorest.Response, err error) {
258 var done bool
259 done, err = future.DoneWithContext(context.Background(), client)
260 if err != nil {
261 err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceDeleteFuture", "Result", future.Response(), "Polling failure")
262 return
263 }
264 if !done {
265 ar.Response = future.Response()
266 err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceDeleteFuture")
267 return
268 }
269 ar.Response = future.Response()
270 return
271 }
272
273
274
275 type IotDpsResourceUpdateFuture struct {
276 azure.FutureAPI
277
278
279 Result func(IotDpsResourceClient) (ProvisioningServiceDescription, error)
280 }
281
282
283 func (future *IotDpsResourceUpdateFuture) UnmarshalJSON(body []byte) error {
284 var azFuture azure.Future
285 if err := json.Unmarshal(body, &azFuture); err != nil {
286 return err
287 }
288 future.FutureAPI = &azFuture
289 future.Result = future.result
290 return nil
291 }
292
293
294 func (future *IotDpsResourceUpdateFuture) result(client IotDpsResourceClient) (psd ProvisioningServiceDescription, err error) {
295 var done bool
296 done, err = future.DoneWithContext(context.Background(), client)
297 if err != nil {
298 err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceUpdateFuture", "Result", future.Response(), "Polling failure")
299 return
300 }
301 if !done {
302 psd.Response.Response = future.Response()
303 err = azure.NewAsyncOpIncompleteError("iothub.IotDpsResourceUpdateFuture")
304 return
305 }
306 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
307 if psd.Response.Response, err = future.GetResult(sender); err == nil && psd.Response.Response.StatusCode != http.StatusNoContent {
308 psd, err = client.UpdateResponder(psd.Response.Response)
309 if err != nil {
310 err = autorest.NewErrorWithError(err, "iothub.IotDpsResourceUpdateFuture", "Result", psd.Response.Response, "Failure responding to request")
311 }
312 }
313 return
314 }
315
316
317 type IotDpsSkuDefinition struct {
318
319 Name IotDpsSku `json:"name,omitempty"`
320 }
321
322
323 type IotDpsSkuDefinitionListResult struct {
324 autorest.Response `json:"-"`
325
326 Value *[]IotDpsSkuDefinition `json:"value,omitempty"`
327
328 NextLink *string `json:"nextLink,omitempty"`
329 }
330
331
332 func (idsdlr IotDpsSkuDefinitionListResult) MarshalJSON() ([]byte, error) {
333 objectMap := make(map[string]interface{})
334 if idsdlr.Value != nil {
335 objectMap["value"] = idsdlr.Value
336 }
337 return json.Marshal(objectMap)
338 }
339
340
341
342 type IotDpsSkuDefinitionListResultIterator struct {
343 i int
344 page IotDpsSkuDefinitionListResultPage
345 }
346
347
348
349 func (iter *IotDpsSkuDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
350 if tracing.IsEnabled() {
351 ctx = tracing.StartSpan(ctx, fqdn+"/IotDpsSkuDefinitionListResultIterator.NextWithContext")
352 defer func() {
353 sc := -1
354 if iter.Response().Response.Response != nil {
355 sc = iter.Response().Response.Response.StatusCode
356 }
357 tracing.EndSpan(ctx, sc, err)
358 }()
359 }
360 iter.i++
361 if iter.i < len(iter.page.Values()) {
362 return nil
363 }
364 err = iter.page.NextWithContext(ctx)
365 if err != nil {
366 iter.i--
367 return err
368 }
369 iter.i = 0
370 return nil
371 }
372
373
374
375
376 func (iter *IotDpsSkuDefinitionListResultIterator) Next() error {
377 return iter.NextWithContext(context.Background())
378 }
379
380
381 func (iter IotDpsSkuDefinitionListResultIterator) NotDone() bool {
382 return iter.page.NotDone() && iter.i < len(iter.page.Values())
383 }
384
385
386 func (iter IotDpsSkuDefinitionListResultIterator) Response() IotDpsSkuDefinitionListResult {
387 return iter.page.Response()
388 }
389
390
391
392 func (iter IotDpsSkuDefinitionListResultIterator) Value() IotDpsSkuDefinition {
393 if !iter.page.NotDone() {
394 return IotDpsSkuDefinition{}
395 }
396 return iter.page.Values()[iter.i]
397 }
398
399
400 func NewIotDpsSkuDefinitionListResultIterator(page IotDpsSkuDefinitionListResultPage) IotDpsSkuDefinitionListResultIterator {
401 return IotDpsSkuDefinitionListResultIterator{page: page}
402 }
403
404
405 func (idsdlr IotDpsSkuDefinitionListResult) IsEmpty() bool {
406 return idsdlr.Value == nil || len(*idsdlr.Value) == 0
407 }
408
409
410 func (idsdlr IotDpsSkuDefinitionListResult) hasNextLink() bool {
411 return idsdlr.NextLink != nil && len(*idsdlr.NextLink) != 0
412 }
413
414
415
416 func (idsdlr IotDpsSkuDefinitionListResult) iotDpsSkuDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
417 if !idsdlr.hasNextLink() {
418 return nil, nil
419 }
420 return autorest.Prepare((&http.Request{}).WithContext(ctx),
421 autorest.AsJSON(),
422 autorest.AsGet(),
423 autorest.WithBaseURL(to.String(idsdlr.NextLink)))
424 }
425
426
427 type IotDpsSkuDefinitionListResultPage struct {
428 fn func(context.Context, IotDpsSkuDefinitionListResult) (IotDpsSkuDefinitionListResult, error)
429 idsdlr IotDpsSkuDefinitionListResult
430 }
431
432
433
434 func (page *IotDpsSkuDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
435 if tracing.IsEnabled() {
436 ctx = tracing.StartSpan(ctx, fqdn+"/IotDpsSkuDefinitionListResultPage.NextWithContext")
437 defer func() {
438 sc := -1
439 if page.Response().Response.Response != nil {
440 sc = page.Response().Response.Response.StatusCode
441 }
442 tracing.EndSpan(ctx, sc, err)
443 }()
444 }
445 for {
446 next, err := page.fn(ctx, page.idsdlr)
447 if err != nil {
448 return err
449 }
450 page.idsdlr = next
451 if !next.hasNextLink() || !next.IsEmpty() {
452 break
453 }
454 }
455 return nil
456 }
457
458
459
460
461 func (page *IotDpsSkuDefinitionListResultPage) Next() error {
462 return page.NextWithContext(context.Background())
463 }
464
465
466 func (page IotDpsSkuDefinitionListResultPage) NotDone() bool {
467 return !page.idsdlr.IsEmpty()
468 }
469
470
471 func (page IotDpsSkuDefinitionListResultPage) Response() IotDpsSkuDefinitionListResult {
472 return page.idsdlr
473 }
474
475
476 func (page IotDpsSkuDefinitionListResultPage) Values() []IotDpsSkuDefinition {
477 if page.idsdlr.IsEmpty() {
478 return nil
479 }
480 return *page.idsdlr.Value
481 }
482
483
484 func NewIotDpsSkuDefinitionListResultPage(cur IotDpsSkuDefinitionListResult, getNextPage func(context.Context, IotDpsSkuDefinitionListResult) (IotDpsSkuDefinitionListResult, error)) IotDpsSkuDefinitionListResultPage {
485 return IotDpsSkuDefinitionListResultPage{
486 fn: getNextPage,
487 idsdlr: cur,
488 }
489 }
490
491
492 type IotDpsSkuInfo struct {
493
494 Name IotDpsSku `json:"name,omitempty"`
495
496 Tier *string `json:"tier,omitempty"`
497
498 Capacity *int64 `json:"capacity,omitempty"`
499 }
500
501
502 func (idsi IotDpsSkuInfo) MarshalJSON() ([]byte, error) {
503 objectMap := make(map[string]interface{})
504 if idsi.Name != "" {
505 objectMap["name"] = idsi.Name
506 }
507 if idsi.Capacity != nil {
508 objectMap["capacity"] = idsi.Capacity
509 }
510 return json.Marshal(objectMap)
511 }
512
513
514 type NameAvailabilityInfo struct {
515 autorest.Response `json:"-"`
516
517 NameAvailable *bool `json:"nameAvailable,omitempty"`
518
519 Reason NameUnavailabilityReason `json:"reason,omitempty"`
520
521 Message *string `json:"message,omitempty"`
522 }
523
524
525 type Operation struct {
526
527 Name *string `json:"name,omitempty"`
528
529 Display *OperationDisplay `json:"display,omitempty"`
530 }
531
532
533 func (o Operation) MarshalJSON() ([]byte, error) {
534 objectMap := make(map[string]interface{})
535 if o.Display != nil {
536 objectMap["display"] = o.Display
537 }
538 return json.Marshal(objectMap)
539 }
540
541
542 type OperationDisplay struct {
543
544 Provider *string `json:"provider,omitempty"`
545
546 Resource *string `json:"resource,omitempty"`
547
548 Operation *string `json:"operation,omitempty"`
549 }
550
551
552 func (o OperationDisplay) MarshalJSON() ([]byte, error) {
553 objectMap := make(map[string]interface{})
554 return json.Marshal(objectMap)
555 }
556
557
558 type OperationInputs struct {
559
560 Name *string `json:"name,omitempty"`
561 }
562
563
564
565 type OperationListResult struct {
566 autorest.Response `json:"-"`
567
568 Value *[]Operation `json:"value,omitempty"`
569
570 NextLink *string `json:"nextLink,omitempty"`
571 }
572
573
574 func (olr OperationListResult) MarshalJSON() ([]byte, error) {
575 objectMap := make(map[string]interface{})
576 return json.Marshal(objectMap)
577 }
578
579
580 type OperationListResultIterator struct {
581 i int
582 page OperationListResultPage
583 }
584
585
586
587 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
588 if tracing.IsEnabled() {
589 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
590 defer func() {
591 sc := -1
592 if iter.Response().Response.Response != nil {
593 sc = iter.Response().Response.Response.StatusCode
594 }
595 tracing.EndSpan(ctx, sc, err)
596 }()
597 }
598 iter.i++
599 if iter.i < len(iter.page.Values()) {
600 return nil
601 }
602 err = iter.page.NextWithContext(ctx)
603 if err != nil {
604 iter.i--
605 return err
606 }
607 iter.i = 0
608 return nil
609 }
610
611
612
613
614 func (iter *OperationListResultIterator) Next() error {
615 return iter.NextWithContext(context.Background())
616 }
617
618
619 func (iter OperationListResultIterator) NotDone() bool {
620 return iter.page.NotDone() && iter.i < len(iter.page.Values())
621 }
622
623
624 func (iter OperationListResultIterator) Response() OperationListResult {
625 return iter.page.Response()
626 }
627
628
629
630 func (iter OperationListResultIterator) Value() Operation {
631 if !iter.page.NotDone() {
632 return Operation{}
633 }
634 return iter.page.Values()[iter.i]
635 }
636
637
638 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
639 return OperationListResultIterator{page: page}
640 }
641
642
643 func (olr OperationListResult) IsEmpty() bool {
644 return olr.Value == nil || len(*olr.Value) == 0
645 }
646
647
648 func (olr OperationListResult) hasNextLink() bool {
649 return olr.NextLink != nil && len(*olr.NextLink) != 0
650 }
651
652
653
654 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
655 if !olr.hasNextLink() {
656 return nil, nil
657 }
658 return autorest.Prepare((&http.Request{}).WithContext(ctx),
659 autorest.AsJSON(),
660 autorest.AsGet(),
661 autorest.WithBaseURL(to.String(olr.NextLink)))
662 }
663
664
665 type OperationListResultPage struct {
666 fn func(context.Context, OperationListResult) (OperationListResult, error)
667 olr OperationListResult
668 }
669
670
671
672 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
673 if tracing.IsEnabled() {
674 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
675 defer func() {
676 sc := -1
677 if page.Response().Response.Response != nil {
678 sc = page.Response().Response.Response.StatusCode
679 }
680 tracing.EndSpan(ctx, sc, err)
681 }()
682 }
683 for {
684 next, err := page.fn(ctx, page.olr)
685 if err != nil {
686 return err
687 }
688 page.olr = next
689 if !next.hasNextLink() || !next.IsEmpty() {
690 break
691 }
692 }
693 return nil
694 }
695
696
697
698
699 func (page *OperationListResultPage) Next() error {
700 return page.NextWithContext(context.Background())
701 }
702
703
704 func (page OperationListResultPage) NotDone() bool {
705 return !page.olr.IsEmpty()
706 }
707
708
709 func (page OperationListResultPage) Response() OperationListResult {
710 return page.olr
711 }
712
713
714 func (page OperationListResultPage) Values() []Operation {
715 if page.olr.IsEmpty() {
716 return nil
717 }
718 return *page.olr.Value
719 }
720
721
722 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
723 return OperationListResultPage{
724 fn: getNextPage,
725 olr: cur,
726 }
727 }
728
729
730 type ProvisioningServiceDescription struct {
731 autorest.Response `json:"-"`
732
733 Etag *string `json:"etag,omitempty"`
734
735 Properties *IotDpsPropertiesDescription `json:"properties,omitempty"`
736
737 Sku *IotDpsSkuInfo `json:"sku,omitempty"`
738
739 ID *string `json:"id,omitempty"`
740
741 Name *string `json:"name,omitempty"`
742
743 Type *string `json:"type,omitempty"`
744
745 Location *string `json:"location,omitempty"`
746
747 Tags map[string]*string `json:"tags"`
748 }
749
750
751 func (psd ProvisioningServiceDescription) MarshalJSON() ([]byte, error) {
752 objectMap := make(map[string]interface{})
753 if psd.Etag != nil {
754 objectMap["etag"] = psd.Etag
755 }
756 if psd.Properties != nil {
757 objectMap["properties"] = psd.Properties
758 }
759 if psd.Sku != nil {
760 objectMap["sku"] = psd.Sku
761 }
762 if psd.Location != nil {
763 objectMap["location"] = psd.Location
764 }
765 if psd.Tags != nil {
766 objectMap["tags"] = psd.Tags
767 }
768 return json.Marshal(objectMap)
769 }
770
771
772 type ProvisioningServiceDescriptionListResult struct {
773 autorest.Response `json:"-"`
774
775 Value *[]ProvisioningServiceDescription `json:"value,omitempty"`
776
777 NextLink *string `json:"nextLink,omitempty"`
778 }
779
780
781 func (psdlr ProvisioningServiceDescriptionListResult) MarshalJSON() ([]byte, error) {
782 objectMap := make(map[string]interface{})
783 if psdlr.Value != nil {
784 objectMap["value"] = psdlr.Value
785 }
786 return json.Marshal(objectMap)
787 }
788
789
790
791 type ProvisioningServiceDescriptionListResultIterator struct {
792 i int
793 page ProvisioningServiceDescriptionListResultPage
794 }
795
796
797
798 func (iter *ProvisioningServiceDescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) {
799 if tracing.IsEnabled() {
800 ctx = tracing.StartSpan(ctx, fqdn+"/ProvisioningServiceDescriptionListResultIterator.NextWithContext")
801 defer func() {
802 sc := -1
803 if iter.Response().Response.Response != nil {
804 sc = iter.Response().Response.Response.StatusCode
805 }
806 tracing.EndSpan(ctx, sc, err)
807 }()
808 }
809 iter.i++
810 if iter.i < len(iter.page.Values()) {
811 return nil
812 }
813 err = iter.page.NextWithContext(ctx)
814 if err != nil {
815 iter.i--
816 return err
817 }
818 iter.i = 0
819 return nil
820 }
821
822
823
824
825 func (iter *ProvisioningServiceDescriptionListResultIterator) Next() error {
826 return iter.NextWithContext(context.Background())
827 }
828
829
830 func (iter ProvisioningServiceDescriptionListResultIterator) NotDone() bool {
831 return iter.page.NotDone() && iter.i < len(iter.page.Values())
832 }
833
834
835 func (iter ProvisioningServiceDescriptionListResultIterator) Response() ProvisioningServiceDescriptionListResult {
836 return iter.page.Response()
837 }
838
839
840
841 func (iter ProvisioningServiceDescriptionListResultIterator) Value() ProvisioningServiceDescription {
842 if !iter.page.NotDone() {
843 return ProvisioningServiceDescription{}
844 }
845 return iter.page.Values()[iter.i]
846 }
847
848
849 func NewProvisioningServiceDescriptionListResultIterator(page ProvisioningServiceDescriptionListResultPage) ProvisioningServiceDescriptionListResultIterator {
850 return ProvisioningServiceDescriptionListResultIterator{page: page}
851 }
852
853
854 func (psdlr ProvisioningServiceDescriptionListResult) IsEmpty() bool {
855 return psdlr.Value == nil || len(*psdlr.Value) == 0
856 }
857
858
859 func (psdlr ProvisioningServiceDescriptionListResult) hasNextLink() bool {
860 return psdlr.NextLink != nil && len(*psdlr.NextLink) != 0
861 }
862
863
864
865 func (psdlr ProvisioningServiceDescriptionListResult) provisioningServiceDescriptionListResultPreparer(ctx context.Context) (*http.Request, error) {
866 if !psdlr.hasNextLink() {
867 return nil, nil
868 }
869 return autorest.Prepare((&http.Request{}).WithContext(ctx),
870 autorest.AsJSON(),
871 autorest.AsGet(),
872 autorest.WithBaseURL(to.String(psdlr.NextLink)))
873 }
874
875
876 type ProvisioningServiceDescriptionListResultPage struct {
877 fn func(context.Context, ProvisioningServiceDescriptionListResult) (ProvisioningServiceDescriptionListResult, error)
878 psdlr ProvisioningServiceDescriptionListResult
879 }
880
881
882
883 func (page *ProvisioningServiceDescriptionListResultPage) NextWithContext(ctx context.Context) (err error) {
884 if tracing.IsEnabled() {
885 ctx = tracing.StartSpan(ctx, fqdn+"/ProvisioningServiceDescriptionListResultPage.NextWithContext")
886 defer func() {
887 sc := -1
888 if page.Response().Response.Response != nil {
889 sc = page.Response().Response.Response.StatusCode
890 }
891 tracing.EndSpan(ctx, sc, err)
892 }()
893 }
894 for {
895 next, err := page.fn(ctx, page.psdlr)
896 if err != nil {
897 return err
898 }
899 page.psdlr = next
900 if !next.hasNextLink() || !next.IsEmpty() {
901 break
902 }
903 }
904 return nil
905 }
906
907
908
909
910 func (page *ProvisioningServiceDescriptionListResultPage) Next() error {
911 return page.NextWithContext(context.Background())
912 }
913
914
915 func (page ProvisioningServiceDescriptionListResultPage) NotDone() bool {
916 return !page.psdlr.IsEmpty()
917 }
918
919
920 func (page ProvisioningServiceDescriptionListResultPage) Response() ProvisioningServiceDescriptionListResult {
921 return page.psdlr
922 }
923
924
925 func (page ProvisioningServiceDescriptionListResultPage) Values() []ProvisioningServiceDescription {
926 if page.psdlr.IsEmpty() {
927 return nil
928 }
929 return *page.psdlr.Value
930 }
931
932
933 func NewProvisioningServiceDescriptionListResultPage(cur ProvisioningServiceDescriptionListResult, getNextPage func(context.Context, ProvisioningServiceDescriptionListResult) (ProvisioningServiceDescriptionListResult, error)) ProvisioningServiceDescriptionListResultPage {
934 return ProvisioningServiceDescriptionListResultPage{
935 fn: getNextPage,
936 psdlr: cur,
937 }
938 }
939
940
941 type Resource struct {
942
943 ID *string `json:"id,omitempty"`
944
945 Name *string `json:"name,omitempty"`
946
947 Type *string `json:"type,omitempty"`
948
949 Location *string `json:"location,omitempty"`
950
951 Tags map[string]*string `json:"tags"`
952 }
953
954
955 func (r Resource) MarshalJSON() ([]byte, error) {
956 objectMap := make(map[string]interface{})
957 if r.Location != nil {
958 objectMap["location"] = r.Location
959 }
960 if r.Tags != nil {
961 objectMap["tags"] = r.Tags
962 }
963 return json.Marshal(objectMap)
964 }
965
966
967 type SharedAccessSignatureAuthorizationRuleAccessRightsDescription struct {
968 autorest.Response `json:"-"`
969
970 KeyName *string `json:"keyName,omitempty"`
971
972 PrimaryKey *string `json:"primaryKey,omitempty"`
973
974 SecondaryKey *string `json:"secondaryKey,omitempty"`
975
976 Rights AccessRightsDescription `json:"rights,omitempty"`
977 }
978
979
980 type SharedAccessSignatureAuthorizationRuleListResult struct {
981 autorest.Response `json:"-"`
982
983 Value *[]SharedAccessSignatureAuthorizationRuleAccessRightsDescription `json:"value,omitempty"`
984
985 NextLink *string `json:"nextLink,omitempty"`
986 }
987
988
989 func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) MarshalJSON() ([]byte, error) {
990 objectMap := make(map[string]interface{})
991 if sasarlr.Value != nil {
992 objectMap["value"] = sasarlr.Value
993 }
994 return json.Marshal(objectMap)
995 }
996
997
998
999 type SharedAccessSignatureAuthorizationRuleListResultIterator struct {
1000 i int
1001 page SharedAccessSignatureAuthorizationRuleListResultPage
1002 }
1003
1004
1005
1006 func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
1007 if tracing.IsEnabled() {
1008 ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultIterator.NextWithContext")
1009 defer func() {
1010 sc := -1
1011 if iter.Response().Response.Response != nil {
1012 sc = iter.Response().Response.Response.StatusCode
1013 }
1014 tracing.EndSpan(ctx, sc, err)
1015 }()
1016 }
1017 iter.i++
1018 if iter.i < len(iter.page.Values()) {
1019 return nil
1020 }
1021 err = iter.page.NextWithContext(ctx)
1022 if err != nil {
1023 iter.i--
1024 return err
1025 }
1026 iter.i = 0
1027 return nil
1028 }
1029
1030
1031
1032
1033 func (iter *SharedAccessSignatureAuthorizationRuleListResultIterator) Next() error {
1034 return iter.NextWithContext(context.Background())
1035 }
1036
1037
1038 func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) NotDone() bool {
1039 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1040 }
1041
1042
1043 func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Response() SharedAccessSignatureAuthorizationRuleListResult {
1044 return iter.page.Response()
1045 }
1046
1047
1048
1049 func (iter SharedAccessSignatureAuthorizationRuleListResultIterator) Value() SharedAccessSignatureAuthorizationRuleAccessRightsDescription {
1050 if !iter.page.NotDone() {
1051 return SharedAccessSignatureAuthorizationRuleAccessRightsDescription{}
1052 }
1053 return iter.page.Values()[iter.i]
1054 }
1055
1056
1057 func NewSharedAccessSignatureAuthorizationRuleListResultIterator(page SharedAccessSignatureAuthorizationRuleListResultPage) SharedAccessSignatureAuthorizationRuleListResultIterator {
1058 return SharedAccessSignatureAuthorizationRuleListResultIterator{page: page}
1059 }
1060
1061
1062 func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) IsEmpty() bool {
1063 return sasarlr.Value == nil || len(*sasarlr.Value) == 0
1064 }
1065
1066
1067 func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) hasNextLink() bool {
1068 return sasarlr.NextLink != nil && len(*sasarlr.NextLink) != 0
1069 }
1070
1071
1072
1073 func (sasarlr SharedAccessSignatureAuthorizationRuleListResult) sharedAccessSignatureAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
1074 if !sasarlr.hasNextLink() {
1075 return nil, nil
1076 }
1077 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1078 autorest.AsJSON(),
1079 autorest.AsGet(),
1080 autorest.WithBaseURL(to.String(sasarlr.NextLink)))
1081 }
1082
1083
1084
1085 type SharedAccessSignatureAuthorizationRuleListResultPage struct {
1086 fn func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)
1087 sasarlr SharedAccessSignatureAuthorizationRuleListResult
1088 }
1089
1090
1091
1092 func (page *SharedAccessSignatureAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
1093 if tracing.IsEnabled() {
1094 ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessSignatureAuthorizationRuleListResultPage.NextWithContext")
1095 defer func() {
1096 sc := -1
1097 if page.Response().Response.Response != nil {
1098 sc = page.Response().Response.Response.StatusCode
1099 }
1100 tracing.EndSpan(ctx, sc, err)
1101 }()
1102 }
1103 for {
1104 next, err := page.fn(ctx, page.sasarlr)
1105 if err != nil {
1106 return err
1107 }
1108 page.sasarlr = next
1109 if !next.hasNextLink() || !next.IsEmpty() {
1110 break
1111 }
1112 }
1113 return nil
1114 }
1115
1116
1117
1118
1119 func (page *SharedAccessSignatureAuthorizationRuleListResultPage) Next() error {
1120 return page.NextWithContext(context.Background())
1121 }
1122
1123
1124 func (page SharedAccessSignatureAuthorizationRuleListResultPage) NotDone() bool {
1125 return !page.sasarlr.IsEmpty()
1126 }
1127
1128
1129 func (page SharedAccessSignatureAuthorizationRuleListResultPage) Response() SharedAccessSignatureAuthorizationRuleListResult {
1130 return page.sasarlr
1131 }
1132
1133
1134 func (page SharedAccessSignatureAuthorizationRuleListResultPage) Values() []SharedAccessSignatureAuthorizationRuleAccessRightsDescription {
1135 if page.sasarlr.IsEmpty() {
1136 return nil
1137 }
1138 return *page.sasarlr.Value
1139 }
1140
1141
1142 func NewSharedAccessSignatureAuthorizationRuleListResultPage(cur SharedAccessSignatureAuthorizationRuleListResult, getNextPage func(context.Context, SharedAccessSignatureAuthorizationRuleListResult) (SharedAccessSignatureAuthorizationRuleListResult, error)) SharedAccessSignatureAuthorizationRuleListResultPage {
1143 return SharedAccessSignatureAuthorizationRuleListResultPage{
1144 fn: getNextPage,
1145 sasarlr: cur,
1146 }
1147 }
1148
1149
1150
1151 type TagsResource struct {
1152
1153 Tags map[string]*string `json:"tags"`
1154 }
1155
1156
1157 func (tr TagsResource) MarshalJSON() ([]byte, error) {
1158 objectMap := make(map[string]interface{})
1159 if tr.Tags != nil {
1160 objectMap["tags"] = tr.Tags
1161 }
1162 return json.Marshal(objectMap)
1163 }
1164
1165
1166 type VerificationCodeRequest struct {
1167
1168 Certificate *string `json:"certificate,omitempty"`
1169 }
1170
1171
1172 type VerificationCodeResponse struct {
1173 autorest.Response `json:"-"`
1174
1175 Name *string `json:"name,omitempty"`
1176
1177 Etag *string `json:"etag,omitempty"`
1178
1179 ID *string `json:"id,omitempty"`
1180
1181 Type *string `json:"type,omitempty"`
1182 Properties *VerificationCodeResponseProperties `json:"properties,omitempty"`
1183 }
1184
1185
1186 func (vcr VerificationCodeResponse) MarshalJSON() ([]byte, error) {
1187 objectMap := make(map[string]interface{})
1188 if vcr.Properties != nil {
1189 objectMap["properties"] = vcr.Properties
1190 }
1191 return json.Marshal(objectMap)
1192 }
1193
1194
1195 type VerificationCodeResponseProperties struct {
1196
1197 VerificationCode *string `json:"verificationCode,omitempty"`
1198
1199 Subject *string `json:"subject,omitempty"`
1200
1201 Expiry *string `json:"expiry,omitempty"`
1202
1203 Thumbprint *string `json:"thumbprint,omitempty"`
1204
1205 IsVerified *bool `json:"isVerified,omitempty"`
1206
1207 Created *string `json:"created,omitempty"`
1208
1209 Updated *string `json:"updated,omitempty"`
1210 }
1211
View as plain text