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