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