1 package aad
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/domainservices/mgmt/2017-06-01/aad"
22
23
24 type CloudError struct {
25
26 Error *CloudErrorBody `json:"error,omitempty"`
27 }
28
29
30 type CloudErrorBody struct {
31
32 Code *string `json:"code,omitempty"`
33
34 Message *string `json:"message,omitempty"`
35
36 Target *string `json:"target,omitempty"`
37
38 Details *[]CloudErrorBody `json:"details,omitempty"`
39 }
40
41
42 type ContainerAccount struct {
43
44 AccountName *string `json:"accountName,omitempty"`
45
46 Spn *string `json:"spn,omitempty"`
47
48 Password *string `json:"password,omitempty"`
49 }
50
51
52 type DefaultErrorResponse struct {
53
54 Error *DefaultErrorResponseError `json:"error,omitempty"`
55 }
56
57
58 func (der DefaultErrorResponse) MarshalJSON() ([]byte, error) {
59 objectMap := make(map[string]interface{})
60 return json.Marshal(objectMap)
61 }
62
63
64 type DefaultErrorResponseError struct {
65
66 Code *string `json:"code,omitempty"`
67
68 Message *string `json:"message,omitempty"`
69
70 Target *string `json:"target,omitempty"`
71
72 Details *[]DefaultErrorResponseErrorDetailsItem `json:"details,omitempty"`
73
74 Innererror *string `json:"innererror,omitempty"`
75 }
76
77
78 func (der DefaultErrorResponseError) MarshalJSON() ([]byte, error) {
79 objectMap := make(map[string]interface{})
80 if der.Details != nil {
81 objectMap["details"] = der.Details
82 }
83 return json.Marshal(objectMap)
84 }
85
86
87 type DefaultErrorResponseErrorDetailsItem struct {
88
89 Code *string `json:"code,omitempty"`
90
91 Message *string `json:"message,omitempty"`
92
93 Target *string `json:"target,omitempty"`
94 }
95
96
97 func (derI DefaultErrorResponseErrorDetailsItem) MarshalJSON() ([]byte, error) {
98 objectMap := make(map[string]interface{})
99 return json.Marshal(objectMap)
100 }
101
102
103 type DomainSecuritySettings struct {
104
105 NtlmV1 NtlmV1 `json:"ntlmV1,omitempty"`
106
107 TLSV1 TLSV1 `json:"tlsV1,omitempty"`
108
109 SyncNtlmPasswords SyncNtlmPasswords `json:"syncNtlmPasswords,omitempty"`
110
111 SyncKerberosPasswords SyncKerberosPasswords `json:"syncKerberosPasswords,omitempty"`
112
113 SyncOnPremPasswords SyncOnPremPasswords `json:"syncOnPremPasswords,omitempty"`
114 }
115
116
117 type DomainService struct {
118 autorest.Response `json:"-"`
119
120 *DomainServiceProperties `json:"properties,omitempty"`
121
122 ID *string `json:"id,omitempty"`
123
124 Name *string `json:"name,omitempty"`
125
126 Type *string `json:"type,omitempty"`
127
128 Location *string `json:"location,omitempty"`
129
130 Tags map[string]*string `json:"tags"`
131
132 Etag *string `json:"etag,omitempty"`
133 }
134
135
136 func (ds DomainService) MarshalJSON() ([]byte, error) {
137 objectMap := make(map[string]interface{})
138 if ds.DomainServiceProperties != nil {
139 objectMap["properties"] = ds.DomainServiceProperties
140 }
141 if ds.Location != nil {
142 objectMap["location"] = ds.Location
143 }
144 if ds.Tags != nil {
145 objectMap["tags"] = ds.Tags
146 }
147 if ds.Etag != nil {
148 objectMap["etag"] = ds.Etag
149 }
150 return json.Marshal(objectMap)
151 }
152
153
154 func (ds *DomainService) UnmarshalJSON(body []byte) error {
155 var m map[string]*json.RawMessage
156 err := json.Unmarshal(body, &m)
157 if err != nil {
158 return err
159 }
160 for k, v := range m {
161 switch k {
162 case "properties":
163 if v != nil {
164 var domainServiceProperties DomainServiceProperties
165 err = json.Unmarshal(*v, &domainServiceProperties)
166 if err != nil {
167 return err
168 }
169 ds.DomainServiceProperties = &domainServiceProperties
170 }
171 case "id":
172 if v != nil {
173 var ID string
174 err = json.Unmarshal(*v, &ID)
175 if err != nil {
176 return err
177 }
178 ds.ID = &ID
179 }
180 case "name":
181 if v != nil {
182 var name string
183 err = json.Unmarshal(*v, &name)
184 if err != nil {
185 return err
186 }
187 ds.Name = &name
188 }
189 case "type":
190 if v != nil {
191 var typeVar string
192 err = json.Unmarshal(*v, &typeVar)
193 if err != nil {
194 return err
195 }
196 ds.Type = &typeVar
197 }
198 case "location":
199 if v != nil {
200 var location string
201 err = json.Unmarshal(*v, &location)
202 if err != nil {
203 return err
204 }
205 ds.Location = &location
206 }
207 case "tags":
208 if v != nil {
209 var tags map[string]*string
210 err = json.Unmarshal(*v, &tags)
211 if err != nil {
212 return err
213 }
214 ds.Tags = tags
215 }
216 case "etag":
217 if v != nil {
218 var etag string
219 err = json.Unmarshal(*v, &etag)
220 if err != nil {
221 return err
222 }
223 ds.Etag = &etag
224 }
225 }
226 }
227
228 return nil
229 }
230
231
232 type DomainServiceListResult struct {
233 autorest.Response `json:"-"`
234
235 Value *[]DomainService `json:"value,omitempty"`
236
237 NextLink *string `json:"nextLink,omitempty"`
238 }
239
240
241 func (dslr DomainServiceListResult) MarshalJSON() ([]byte, error) {
242 objectMap := make(map[string]interface{})
243 if dslr.Value != nil {
244 objectMap["value"] = dslr.Value
245 }
246 return json.Marshal(objectMap)
247 }
248
249
250 type DomainServiceListResultIterator struct {
251 i int
252 page DomainServiceListResultPage
253 }
254
255
256
257 func (iter *DomainServiceListResultIterator) NextWithContext(ctx context.Context) (err error) {
258 if tracing.IsEnabled() {
259 ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultIterator.NextWithContext")
260 defer func() {
261 sc := -1
262 if iter.Response().Response.Response != nil {
263 sc = iter.Response().Response.Response.StatusCode
264 }
265 tracing.EndSpan(ctx, sc, err)
266 }()
267 }
268 iter.i++
269 if iter.i < len(iter.page.Values()) {
270 return nil
271 }
272 err = iter.page.NextWithContext(ctx)
273 if err != nil {
274 iter.i--
275 return err
276 }
277 iter.i = 0
278 return nil
279 }
280
281
282
283
284 func (iter *DomainServiceListResultIterator) Next() error {
285 return iter.NextWithContext(context.Background())
286 }
287
288
289 func (iter DomainServiceListResultIterator) NotDone() bool {
290 return iter.page.NotDone() && iter.i < len(iter.page.Values())
291 }
292
293
294 func (iter DomainServiceListResultIterator) Response() DomainServiceListResult {
295 return iter.page.Response()
296 }
297
298
299
300 func (iter DomainServiceListResultIterator) Value() DomainService {
301 if !iter.page.NotDone() {
302 return DomainService{}
303 }
304 return iter.page.Values()[iter.i]
305 }
306
307
308 func NewDomainServiceListResultIterator(page DomainServiceListResultPage) DomainServiceListResultIterator {
309 return DomainServiceListResultIterator{page: page}
310 }
311
312
313 func (dslr DomainServiceListResult) IsEmpty() bool {
314 return dslr.Value == nil || len(*dslr.Value) == 0
315 }
316
317
318 func (dslr DomainServiceListResult) hasNextLink() bool {
319 return dslr.NextLink != nil && len(*dslr.NextLink) != 0
320 }
321
322
323
324 func (dslr DomainServiceListResult) domainServiceListResultPreparer(ctx context.Context) (*http.Request, error) {
325 if !dslr.hasNextLink() {
326 return nil, nil
327 }
328 return autorest.Prepare((&http.Request{}).WithContext(ctx),
329 autorest.AsJSON(),
330 autorest.AsGet(),
331 autorest.WithBaseURL(to.String(dslr.NextLink)))
332 }
333
334
335 type DomainServiceListResultPage struct {
336 fn func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)
337 dslr DomainServiceListResult
338 }
339
340
341
342 func (page *DomainServiceListResultPage) NextWithContext(ctx context.Context) (err error) {
343 if tracing.IsEnabled() {
344 ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultPage.NextWithContext")
345 defer func() {
346 sc := -1
347 if page.Response().Response.Response != nil {
348 sc = page.Response().Response.Response.StatusCode
349 }
350 tracing.EndSpan(ctx, sc, err)
351 }()
352 }
353 for {
354 next, err := page.fn(ctx, page.dslr)
355 if err != nil {
356 return err
357 }
358 page.dslr = next
359 if !next.hasNextLink() || !next.IsEmpty() {
360 break
361 }
362 }
363 return nil
364 }
365
366
367
368
369 func (page *DomainServiceListResultPage) Next() error {
370 return page.NextWithContext(context.Background())
371 }
372
373
374 func (page DomainServiceListResultPage) NotDone() bool {
375 return !page.dslr.IsEmpty()
376 }
377
378
379 func (page DomainServiceListResultPage) Response() DomainServiceListResult {
380 return page.dslr
381 }
382
383
384 func (page DomainServiceListResultPage) Values() []DomainService {
385 if page.dslr.IsEmpty() {
386 return nil
387 }
388 return *page.dslr.Value
389 }
390
391
392 func NewDomainServiceListResultPage(cur DomainServiceListResult, getNextPage func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)) DomainServiceListResultPage {
393 return DomainServiceListResultPage{
394 fn: getNextPage,
395 dslr: cur,
396 }
397 }
398
399
400 type DomainServiceProperties struct {
401
402 Version *int32 `json:"version,omitempty"`
403
404 TenantID *string `json:"tenantId,omitempty"`
405
406 DomainName *string `json:"domainName,omitempty"`
407
408 DeploymentID *string `json:"deploymentId,omitempty"`
409
410 VnetSiteID *string `json:"vnetSiteId,omitempty"`
411
412 SubnetID *string `json:"subnetId,omitempty"`
413
414 LdapsSettings *LdapsSettings `json:"ldapsSettings,omitempty"`
415
416 DomainSecuritySettings *DomainSecuritySettings `json:"domainSecuritySettings,omitempty"`
417
418 ResourceForestSettings *ResourceForestSettings `json:"resourceForestSettings,omitempty"`
419
420 DomainConfigurationType *string `json:"domainConfigurationType,omitempty"`
421
422 Sku *string `json:"sku,omitempty"`
423
424 HealthLastEvaluated *date.TimeRFC1123 `json:"healthLastEvaluated,omitempty"`
425
426 HealthMonitors *[]HealthMonitor `json:"healthMonitors,omitempty"`
427
428 HealthAlerts *[]HealthAlert `json:"healthAlerts,omitempty"`
429
430 NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"`
431
432 FilteredSync FilteredSync `json:"filteredSync,omitempty"`
433
434 DomainControllerIPAddress *[]string `json:"domainControllerIpAddress,omitempty"`
435
436 ServiceStatus *string `json:"serviceStatus,omitempty"`
437
438 ProvisioningState *string `json:"provisioningState,omitempty"`
439 }
440
441
442 func (dsp DomainServiceProperties) MarshalJSON() ([]byte, error) {
443 objectMap := make(map[string]interface{})
444 if dsp.DomainName != nil {
445 objectMap["domainName"] = dsp.DomainName
446 }
447 if dsp.SubnetID != nil {
448 objectMap["subnetId"] = dsp.SubnetID
449 }
450 if dsp.LdapsSettings != nil {
451 objectMap["ldapsSettings"] = dsp.LdapsSettings
452 }
453 if dsp.DomainSecuritySettings != nil {
454 objectMap["domainSecuritySettings"] = dsp.DomainSecuritySettings
455 }
456 if dsp.ResourceForestSettings != nil {
457 objectMap["resourceForestSettings"] = dsp.ResourceForestSettings
458 }
459 if dsp.DomainConfigurationType != nil {
460 objectMap["domainConfigurationType"] = dsp.DomainConfigurationType
461 }
462 if dsp.Sku != nil {
463 objectMap["sku"] = dsp.Sku
464 }
465 if dsp.NotificationSettings != nil {
466 objectMap["notificationSettings"] = dsp.NotificationSettings
467 }
468 if dsp.FilteredSync != "" {
469 objectMap["filteredSync"] = dsp.FilteredSync
470 }
471 return json.Marshal(objectMap)
472 }
473
474
475
476 type DomainServicesCreateOrUpdateFuture struct {
477 azure.FutureAPI
478
479
480 Result func(DomainServicesClient) (DomainService, error)
481 }
482
483
484 func (future *DomainServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
485 var azFuture azure.Future
486 if err := json.Unmarshal(body, &azFuture); err != nil {
487 return err
488 }
489 future.FutureAPI = &azFuture
490 future.Result = future.result
491 return nil
492 }
493
494
495 func (future *DomainServicesCreateOrUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) {
496 var done bool
497 done, err = future.DoneWithContext(context.Background(), client)
498 if err != nil {
499 err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
500 return
501 }
502 if !done {
503 ds.Response.Response = future.Response()
504 err = azure.NewAsyncOpIncompleteError("aad.DomainServicesCreateOrUpdateFuture")
505 return
506 }
507 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
508 if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent {
509 ds, err = client.CreateOrUpdateResponder(ds.Response.Response)
510 if err != nil {
511 err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", ds.Response.Response, "Failure responding to request")
512 }
513 }
514 return
515 }
516
517
518
519 type DomainServicesDeleteFuture struct {
520 azure.FutureAPI
521
522
523 Result func(DomainServicesClient) (autorest.Response, error)
524 }
525
526
527 func (future *DomainServicesDeleteFuture) UnmarshalJSON(body []byte) error {
528 var azFuture azure.Future
529 if err := json.Unmarshal(body, &azFuture); err != nil {
530 return err
531 }
532 future.FutureAPI = &azFuture
533 future.Result = future.result
534 return nil
535 }
536
537
538 func (future *DomainServicesDeleteFuture) result(client DomainServicesClient) (ar autorest.Response, err error) {
539 var done bool
540 done, err = future.DoneWithContext(context.Background(), client)
541 if err != nil {
542 err = autorest.NewErrorWithError(err, "aad.DomainServicesDeleteFuture", "Result", future.Response(), "Polling failure")
543 return
544 }
545 if !done {
546 ar.Response = future.Response()
547 err = azure.NewAsyncOpIncompleteError("aad.DomainServicesDeleteFuture")
548 return
549 }
550 ar.Response = future.Response()
551 return
552 }
553
554
555
556 type DomainServicesUpdateFuture struct {
557 azure.FutureAPI
558
559
560 Result func(DomainServicesClient) (DomainService, error)
561 }
562
563
564 func (future *DomainServicesUpdateFuture) UnmarshalJSON(body []byte) error {
565 var azFuture azure.Future
566 if err := json.Unmarshal(body, &azFuture); err != nil {
567 return err
568 }
569 future.FutureAPI = &azFuture
570 future.Result = future.result
571 return nil
572 }
573
574
575 func (future *DomainServicesUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) {
576 var done bool
577 done, err = future.DoneWithContext(context.Background(), client)
578 if err != nil {
579 err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", future.Response(), "Polling failure")
580 return
581 }
582 if !done {
583 ds.Response.Response = future.Response()
584 err = azure.NewAsyncOpIncompleteError("aad.DomainServicesUpdateFuture")
585 return
586 }
587 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
588 if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent {
589 ds, err = client.UpdateResponder(ds.Response.Response)
590 if err != nil {
591 err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", ds.Response.Response, "Failure responding to request")
592 }
593 }
594 return
595 }
596
597
598 type ForestTrust struct {
599
600 TrustedDomainFqdn *string `json:"trustedDomainFqdn,omitempty"`
601
602 TrustDirection *string `json:"trustDirection,omitempty"`
603
604 FriendlyName *string `json:"friendlyName,omitempty"`
605
606 RemoteDNSIps *string `json:"remoteDnsIps,omitempty"`
607
608 TrustPassword *string `json:"trustPassword,omitempty"`
609 }
610
611
612 type HealthAlert struct {
613
614 ID *string `json:"id,omitempty"`
615
616 Name *string `json:"name,omitempty"`
617
618 Issue *string `json:"issue,omitempty"`
619
620 Severity *string `json:"severity,omitempty"`
621
622 Raised *date.Time `json:"raised,omitempty"`
623
624 LastDetected *date.Time `json:"lastDetected,omitempty"`
625
626 ResolutionURI *string `json:"resolutionUri,omitempty"`
627 }
628
629
630 func (ha HealthAlert) MarshalJSON() ([]byte, error) {
631 objectMap := make(map[string]interface{})
632 return json.Marshal(objectMap)
633 }
634
635
636 type HealthMonitor struct {
637
638 ID *string `json:"id,omitempty"`
639
640 Name *string `json:"name,omitempty"`
641
642 Details *string `json:"details,omitempty"`
643 }
644
645
646 func (hm HealthMonitor) MarshalJSON() ([]byte, error) {
647 objectMap := make(map[string]interface{})
648 return json.Marshal(objectMap)
649 }
650
651
652 type LdapsSettings struct {
653
654 Ldaps Ldaps `json:"ldaps,omitempty"`
655
656 PfxCertificate *string `json:"pfxCertificate,omitempty"`
657
658 PfxCertificatePassword *string `json:"pfxCertificatePassword,omitempty"`
659
660 PublicCertificate *string `json:"publicCertificate,omitempty"`
661
662 CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
663
664 CertificateNotAfter *date.Time `json:"certificateNotAfter,omitempty"`
665
666 ExternalAccess ExternalAccess `json:"externalAccess,omitempty"`
667
668 ExternalAccessIPAddress *string `json:"externalAccessIpAddress,omitempty"`
669 }
670
671
672 func (ls LdapsSettings) MarshalJSON() ([]byte, error) {
673 objectMap := make(map[string]interface{})
674 if ls.Ldaps != "" {
675 objectMap["ldaps"] = ls.Ldaps
676 }
677 if ls.PfxCertificate != nil {
678 objectMap["pfxCertificate"] = ls.PfxCertificate
679 }
680 if ls.PfxCertificatePassword != nil {
681 objectMap["pfxCertificatePassword"] = ls.PfxCertificatePassword
682 }
683 if ls.ExternalAccess != "" {
684 objectMap["externalAccess"] = ls.ExternalAccess
685 }
686 return json.Marshal(objectMap)
687 }
688
689
690 type NotificationSettings struct {
691
692 NotifyGlobalAdmins NotifyGlobalAdmins `json:"notifyGlobalAdmins,omitempty"`
693
694 NotifyDcAdmins NotifyDcAdmins `json:"notifyDcAdmins,omitempty"`
695
696 AdditionalRecipients *[]string `json:"additionalRecipients,omitempty"`
697 }
698
699
700 type OperationDisplayInfo struct {
701
702 Description *string `json:"description,omitempty"`
703
704 Operation *string `json:"operation,omitempty"`
705
706 Provider *string `json:"provider,omitempty"`
707
708 Resource *string `json:"resource,omitempty"`
709 }
710
711
712 type OperationEntity struct {
713
714 Name *string `json:"name,omitempty"`
715
716 Display *OperationDisplayInfo `json:"display,omitempty"`
717
718 Origin *string `json:"origin,omitempty"`
719 }
720
721
722 type OperationEntityListResult struct {
723 autorest.Response `json:"-"`
724
725 Value *[]OperationEntity `json:"value,omitempty"`
726
727 NextLink *string `json:"nextLink,omitempty"`
728 }
729
730
731 func (oelr OperationEntityListResult) MarshalJSON() ([]byte, error) {
732 objectMap := make(map[string]interface{})
733 if oelr.Value != nil {
734 objectMap["value"] = oelr.Value
735 }
736 return json.Marshal(objectMap)
737 }
738
739
740 type OperationEntityListResultIterator struct {
741 i int
742 page OperationEntityListResultPage
743 }
744
745
746
747 func (iter *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) {
748 if tracing.IsEnabled() {
749 ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext")
750 defer func() {
751 sc := -1
752 if iter.Response().Response.Response != nil {
753 sc = iter.Response().Response.Response.StatusCode
754 }
755 tracing.EndSpan(ctx, sc, err)
756 }()
757 }
758 iter.i++
759 if iter.i < len(iter.page.Values()) {
760 return nil
761 }
762 err = iter.page.NextWithContext(ctx)
763 if err != nil {
764 iter.i--
765 return err
766 }
767 iter.i = 0
768 return nil
769 }
770
771
772
773
774 func (iter *OperationEntityListResultIterator) Next() error {
775 return iter.NextWithContext(context.Background())
776 }
777
778
779 func (iter OperationEntityListResultIterator) NotDone() bool {
780 return iter.page.NotDone() && iter.i < len(iter.page.Values())
781 }
782
783
784 func (iter OperationEntityListResultIterator) Response() OperationEntityListResult {
785 return iter.page.Response()
786 }
787
788
789
790 func (iter OperationEntityListResultIterator) Value() OperationEntity {
791 if !iter.page.NotDone() {
792 return OperationEntity{}
793 }
794 return iter.page.Values()[iter.i]
795 }
796
797
798 func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator {
799 return OperationEntityListResultIterator{page: page}
800 }
801
802
803 func (oelr OperationEntityListResult) IsEmpty() bool {
804 return oelr.Value == nil || len(*oelr.Value) == 0
805 }
806
807
808 func (oelr OperationEntityListResult) hasNextLink() bool {
809 return oelr.NextLink != nil && len(*oelr.NextLink) != 0
810 }
811
812
813
814 func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) {
815 if !oelr.hasNextLink() {
816 return nil, nil
817 }
818 return autorest.Prepare((&http.Request{}).WithContext(ctx),
819 autorest.AsJSON(),
820 autorest.AsGet(),
821 autorest.WithBaseURL(to.String(oelr.NextLink)))
822 }
823
824
825 type OperationEntityListResultPage struct {
826 fn func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)
827 oelr OperationEntityListResult
828 }
829
830
831
832 func (page *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) {
833 if tracing.IsEnabled() {
834 ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext")
835 defer func() {
836 sc := -1
837 if page.Response().Response.Response != nil {
838 sc = page.Response().Response.Response.StatusCode
839 }
840 tracing.EndSpan(ctx, sc, err)
841 }()
842 }
843 for {
844 next, err := page.fn(ctx, page.oelr)
845 if err != nil {
846 return err
847 }
848 page.oelr = next
849 if !next.hasNextLink() || !next.IsEmpty() {
850 break
851 }
852 }
853 return nil
854 }
855
856
857
858
859 func (page *OperationEntityListResultPage) Next() error {
860 return page.NextWithContext(context.Background())
861 }
862
863
864 func (page OperationEntityListResultPage) NotDone() bool {
865 return !page.oelr.IsEmpty()
866 }
867
868
869 func (page OperationEntityListResultPage) Response() OperationEntityListResult {
870 return page.oelr
871 }
872
873
874 func (page OperationEntityListResultPage) Values() []OperationEntity {
875 if page.oelr.IsEmpty() {
876 return nil
877 }
878 return *page.oelr.Value
879 }
880
881
882 func NewOperationEntityListResultPage(cur OperationEntityListResult, getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage {
883 return OperationEntityListResultPage{
884 fn: getNextPage,
885 oelr: cur,
886 }
887 }
888
889
890 type OuContainer struct {
891 autorest.Response `json:"-"`
892
893 *OuContainerProperties `json:"properties,omitempty"`
894
895 ID *string `json:"id,omitempty"`
896
897 Name *string `json:"name,omitempty"`
898
899 Type *string `json:"type,omitempty"`
900
901 Location *string `json:"location,omitempty"`
902
903 Tags map[string]*string `json:"tags"`
904
905 Etag *string `json:"etag,omitempty"`
906 }
907
908
909 func (oc OuContainer) MarshalJSON() ([]byte, error) {
910 objectMap := make(map[string]interface{})
911 if oc.OuContainerProperties != nil {
912 objectMap["properties"] = oc.OuContainerProperties
913 }
914 if oc.Location != nil {
915 objectMap["location"] = oc.Location
916 }
917 if oc.Tags != nil {
918 objectMap["tags"] = oc.Tags
919 }
920 if oc.Etag != nil {
921 objectMap["etag"] = oc.Etag
922 }
923 return json.Marshal(objectMap)
924 }
925
926
927 func (oc *OuContainer) UnmarshalJSON(body []byte) error {
928 var m map[string]*json.RawMessage
929 err := json.Unmarshal(body, &m)
930 if err != nil {
931 return err
932 }
933 for k, v := range m {
934 switch k {
935 case "properties":
936 if v != nil {
937 var ouContainerProperties OuContainerProperties
938 err = json.Unmarshal(*v, &ouContainerProperties)
939 if err != nil {
940 return err
941 }
942 oc.OuContainerProperties = &ouContainerProperties
943 }
944 case "id":
945 if v != nil {
946 var ID string
947 err = json.Unmarshal(*v, &ID)
948 if err != nil {
949 return err
950 }
951 oc.ID = &ID
952 }
953 case "name":
954 if v != nil {
955 var name string
956 err = json.Unmarshal(*v, &name)
957 if err != nil {
958 return err
959 }
960 oc.Name = &name
961 }
962 case "type":
963 if v != nil {
964 var typeVar string
965 err = json.Unmarshal(*v, &typeVar)
966 if err != nil {
967 return err
968 }
969 oc.Type = &typeVar
970 }
971 case "location":
972 if v != nil {
973 var location string
974 err = json.Unmarshal(*v, &location)
975 if err != nil {
976 return err
977 }
978 oc.Location = &location
979 }
980 case "tags":
981 if v != nil {
982 var tags map[string]*string
983 err = json.Unmarshal(*v, &tags)
984 if err != nil {
985 return err
986 }
987 oc.Tags = tags
988 }
989 case "etag":
990 if v != nil {
991 var etag string
992 err = json.Unmarshal(*v, &etag)
993 if err != nil {
994 return err
995 }
996 oc.Etag = &etag
997 }
998 }
999 }
1000
1001 return nil
1002 }
1003
1004
1005
1006 type OuContainerCreateFuture struct {
1007 azure.FutureAPI
1008
1009
1010 Result func(OuContainerClient) (OuContainer, error)
1011 }
1012
1013
1014 func (future *OuContainerCreateFuture) UnmarshalJSON(body []byte) error {
1015 var azFuture azure.Future
1016 if err := json.Unmarshal(body, &azFuture); err != nil {
1017 return err
1018 }
1019 future.FutureAPI = &azFuture
1020 future.Result = future.result
1021 return nil
1022 }
1023
1024
1025 func (future *OuContainerCreateFuture) result(client OuContainerClient) (oc OuContainer, err error) {
1026 var done bool
1027 done, err = future.DoneWithContext(context.Background(), client)
1028 if err != nil {
1029 err = autorest.NewErrorWithError(err, "aad.OuContainerCreateFuture", "Result", future.Response(), "Polling failure")
1030 return
1031 }
1032 if !done {
1033 oc.Response.Response = future.Response()
1034 err = azure.NewAsyncOpIncompleteError("aad.OuContainerCreateFuture")
1035 return
1036 }
1037 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1038 if oc.Response.Response, err = future.GetResult(sender); err == nil && oc.Response.Response.StatusCode != http.StatusNoContent {
1039 oc, err = client.CreateResponder(oc.Response.Response)
1040 if err != nil {
1041 err = autorest.NewErrorWithError(err, "aad.OuContainerCreateFuture", "Result", oc.Response.Response, "Failure responding to request")
1042 }
1043 }
1044 return
1045 }
1046
1047
1048
1049 type OuContainerDeleteFuture struct {
1050 azure.FutureAPI
1051
1052
1053 Result func(OuContainerClient) (autorest.Response, error)
1054 }
1055
1056
1057 func (future *OuContainerDeleteFuture) UnmarshalJSON(body []byte) error {
1058 var azFuture azure.Future
1059 if err := json.Unmarshal(body, &azFuture); err != nil {
1060 return err
1061 }
1062 future.FutureAPI = &azFuture
1063 future.Result = future.result
1064 return nil
1065 }
1066
1067
1068 func (future *OuContainerDeleteFuture) result(client OuContainerClient) (ar autorest.Response, err error) {
1069 var done bool
1070 done, err = future.DoneWithContext(context.Background(), client)
1071 if err != nil {
1072 err = autorest.NewErrorWithError(err, "aad.OuContainerDeleteFuture", "Result", future.Response(), "Polling failure")
1073 return
1074 }
1075 if !done {
1076 ar.Response = future.Response()
1077 err = azure.NewAsyncOpIncompleteError("aad.OuContainerDeleteFuture")
1078 return
1079 }
1080 ar.Response = future.Response()
1081 return
1082 }
1083
1084
1085 type OuContainerListResult struct {
1086 autorest.Response `json:"-"`
1087
1088 Value *[]OuContainer `json:"value,omitempty"`
1089
1090 NextLink *string `json:"nextLink,omitempty"`
1091 }
1092
1093
1094 func (oclr OuContainerListResult) MarshalJSON() ([]byte, error) {
1095 objectMap := make(map[string]interface{})
1096 if oclr.Value != nil {
1097 objectMap["value"] = oclr.Value
1098 }
1099 return json.Marshal(objectMap)
1100 }
1101
1102
1103 type OuContainerListResultIterator struct {
1104 i int
1105 page OuContainerListResultPage
1106 }
1107
1108
1109
1110 func (iter *OuContainerListResultIterator) NextWithContext(ctx context.Context) (err error) {
1111 if tracing.IsEnabled() {
1112 ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerListResultIterator.NextWithContext")
1113 defer func() {
1114 sc := -1
1115 if iter.Response().Response.Response != nil {
1116 sc = iter.Response().Response.Response.StatusCode
1117 }
1118 tracing.EndSpan(ctx, sc, err)
1119 }()
1120 }
1121 iter.i++
1122 if iter.i < len(iter.page.Values()) {
1123 return nil
1124 }
1125 err = iter.page.NextWithContext(ctx)
1126 if err != nil {
1127 iter.i--
1128 return err
1129 }
1130 iter.i = 0
1131 return nil
1132 }
1133
1134
1135
1136
1137 func (iter *OuContainerListResultIterator) Next() error {
1138 return iter.NextWithContext(context.Background())
1139 }
1140
1141
1142 func (iter OuContainerListResultIterator) NotDone() bool {
1143 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1144 }
1145
1146
1147 func (iter OuContainerListResultIterator) Response() OuContainerListResult {
1148 return iter.page.Response()
1149 }
1150
1151
1152
1153 func (iter OuContainerListResultIterator) Value() OuContainer {
1154 if !iter.page.NotDone() {
1155 return OuContainer{}
1156 }
1157 return iter.page.Values()[iter.i]
1158 }
1159
1160
1161 func NewOuContainerListResultIterator(page OuContainerListResultPage) OuContainerListResultIterator {
1162 return OuContainerListResultIterator{page: page}
1163 }
1164
1165
1166 func (oclr OuContainerListResult) IsEmpty() bool {
1167 return oclr.Value == nil || len(*oclr.Value) == 0
1168 }
1169
1170
1171 func (oclr OuContainerListResult) hasNextLink() bool {
1172 return oclr.NextLink != nil && len(*oclr.NextLink) != 0
1173 }
1174
1175
1176
1177 func (oclr OuContainerListResult) ouContainerListResultPreparer(ctx context.Context) (*http.Request, error) {
1178 if !oclr.hasNextLink() {
1179 return nil, nil
1180 }
1181 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1182 autorest.AsJSON(),
1183 autorest.AsGet(),
1184 autorest.WithBaseURL(to.String(oclr.NextLink)))
1185 }
1186
1187
1188 type OuContainerListResultPage struct {
1189 fn func(context.Context, OuContainerListResult) (OuContainerListResult, error)
1190 oclr OuContainerListResult
1191 }
1192
1193
1194
1195 func (page *OuContainerListResultPage) NextWithContext(ctx context.Context) (err error) {
1196 if tracing.IsEnabled() {
1197 ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerListResultPage.NextWithContext")
1198 defer func() {
1199 sc := -1
1200 if page.Response().Response.Response != nil {
1201 sc = page.Response().Response.Response.StatusCode
1202 }
1203 tracing.EndSpan(ctx, sc, err)
1204 }()
1205 }
1206 for {
1207 next, err := page.fn(ctx, page.oclr)
1208 if err != nil {
1209 return err
1210 }
1211 page.oclr = next
1212 if !next.hasNextLink() || !next.IsEmpty() {
1213 break
1214 }
1215 }
1216 return nil
1217 }
1218
1219
1220
1221
1222 func (page *OuContainerListResultPage) Next() error {
1223 return page.NextWithContext(context.Background())
1224 }
1225
1226
1227 func (page OuContainerListResultPage) NotDone() bool {
1228 return !page.oclr.IsEmpty()
1229 }
1230
1231
1232 func (page OuContainerListResultPage) Response() OuContainerListResult {
1233 return page.oclr
1234 }
1235
1236
1237 func (page OuContainerListResultPage) Values() []OuContainer {
1238 if page.oclr.IsEmpty() {
1239 return nil
1240 }
1241 return *page.oclr.Value
1242 }
1243
1244
1245 func NewOuContainerListResultPage(cur OuContainerListResult, getNextPage func(context.Context, OuContainerListResult) (OuContainerListResult, error)) OuContainerListResultPage {
1246 return OuContainerListResultPage{
1247 fn: getNextPage,
1248 oclr: cur,
1249 }
1250 }
1251
1252
1253 type OuContainerProperties struct {
1254
1255 TenantID *string `json:"tenantId,omitempty"`
1256
1257 DomainName *string `json:"domainName,omitempty"`
1258
1259 DeploymentID *string `json:"deploymentId,omitempty"`
1260
1261 ContainerID *string `json:"containerId,omitempty"`
1262
1263 Accounts *[]ContainerAccount `json:"accounts,omitempty"`
1264
1265 ServiceStatus *string `json:"serviceStatus,omitempty"`
1266
1267 DistinguishedName *string `json:"distinguishedName,omitempty"`
1268
1269 ProvisioningState *string `json:"provisioningState,omitempty"`
1270 }
1271
1272
1273 func (ocp OuContainerProperties) MarshalJSON() ([]byte, error) {
1274 objectMap := make(map[string]interface{})
1275 if ocp.Accounts != nil {
1276 objectMap["accounts"] = ocp.Accounts
1277 }
1278 return json.Marshal(objectMap)
1279 }
1280
1281
1282
1283 type OuContainerUpdateFuture struct {
1284 azure.FutureAPI
1285
1286
1287 Result func(OuContainerClient) (OuContainer, error)
1288 }
1289
1290
1291 func (future *OuContainerUpdateFuture) UnmarshalJSON(body []byte) error {
1292 var azFuture azure.Future
1293 if err := json.Unmarshal(body, &azFuture); err != nil {
1294 return err
1295 }
1296 future.FutureAPI = &azFuture
1297 future.Result = future.result
1298 return nil
1299 }
1300
1301
1302 func (future *OuContainerUpdateFuture) result(client OuContainerClient) (oc OuContainer, err error) {
1303 var done bool
1304 done, err = future.DoneWithContext(context.Background(), client)
1305 if err != nil {
1306 err = autorest.NewErrorWithError(err, "aad.OuContainerUpdateFuture", "Result", future.Response(), "Polling failure")
1307 return
1308 }
1309 if !done {
1310 oc.Response.Response = future.Response()
1311 err = azure.NewAsyncOpIncompleteError("aad.OuContainerUpdateFuture")
1312 return
1313 }
1314 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1315 if oc.Response.Response, err = future.GetResult(sender); err == nil && oc.Response.Response.StatusCode != http.StatusNoContent {
1316 oc, err = client.UpdateResponder(oc.Response.Response)
1317 if err != nil {
1318 err = autorest.NewErrorWithError(err, "aad.OuContainerUpdateFuture", "Result", oc.Response.Response, "Failure responding to request")
1319 }
1320 }
1321 return
1322 }
1323
1324
1325 type Resource struct {
1326
1327 ID *string `json:"id,omitempty"`
1328
1329 Name *string `json:"name,omitempty"`
1330
1331 Type *string `json:"type,omitempty"`
1332
1333 Location *string `json:"location,omitempty"`
1334
1335 Tags map[string]*string `json:"tags"`
1336
1337 Etag *string `json:"etag,omitempty"`
1338 }
1339
1340
1341 func (r Resource) MarshalJSON() ([]byte, error) {
1342 objectMap := make(map[string]interface{})
1343 if r.Location != nil {
1344 objectMap["location"] = r.Location
1345 }
1346 if r.Tags != nil {
1347 objectMap["tags"] = r.Tags
1348 }
1349 if r.Etag != nil {
1350 objectMap["etag"] = r.Etag
1351 }
1352 return json.Marshal(objectMap)
1353 }
1354
1355
1356 type ResourceForestSettings struct {
1357
1358 Settings *[]ForestTrust `json:"settings,omitempty"`
1359
1360 ResourceForest *string `json:"resourceForest,omitempty"`
1361 }
1362
View as plain text