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