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-01-01/aad"
22
23
24 type DomainSecuritySettings struct {
25
26 NtlmV1 NtlmV1 `json:"ntlmV1,omitempty"`
27
28 TLSV1 TLSV1 `json:"tlsV1,omitempty"`
29
30 SyncNtlmPasswords SyncNtlmPasswords `json:"syncNtlmPasswords,omitempty"`
31 }
32
33
34 type DomainService struct {
35 autorest.Response `json:"-"`
36
37 *DomainServiceProperties `json:"properties,omitempty"`
38
39 ID *string `json:"id,omitempty"`
40
41 Name *string `json:"name,omitempty"`
42
43 Type *string `json:"type,omitempty"`
44
45 Location *string `json:"location,omitempty"`
46
47 Tags map[string]*string `json:"tags"`
48
49 Etag *string `json:"etag,omitempty"`
50 }
51
52
53 func (ds DomainService) MarshalJSON() ([]byte, error) {
54 objectMap := make(map[string]interface{})
55 if ds.DomainServiceProperties != nil {
56 objectMap["properties"] = ds.DomainServiceProperties
57 }
58 if ds.Location != nil {
59 objectMap["location"] = ds.Location
60 }
61 if ds.Tags != nil {
62 objectMap["tags"] = ds.Tags
63 }
64 if ds.Etag != nil {
65 objectMap["etag"] = ds.Etag
66 }
67 return json.Marshal(objectMap)
68 }
69
70
71 func (ds *DomainService) UnmarshalJSON(body []byte) error {
72 var m map[string]*json.RawMessage
73 err := json.Unmarshal(body, &m)
74 if err != nil {
75 return err
76 }
77 for k, v := range m {
78 switch k {
79 case "properties":
80 if v != nil {
81 var domainServiceProperties DomainServiceProperties
82 err = json.Unmarshal(*v, &domainServiceProperties)
83 if err != nil {
84 return err
85 }
86 ds.DomainServiceProperties = &domainServiceProperties
87 }
88 case "id":
89 if v != nil {
90 var ID string
91 err = json.Unmarshal(*v, &ID)
92 if err != nil {
93 return err
94 }
95 ds.ID = &ID
96 }
97 case "name":
98 if v != nil {
99 var name string
100 err = json.Unmarshal(*v, &name)
101 if err != nil {
102 return err
103 }
104 ds.Name = &name
105 }
106 case "type":
107 if v != nil {
108 var typeVar string
109 err = json.Unmarshal(*v, &typeVar)
110 if err != nil {
111 return err
112 }
113 ds.Type = &typeVar
114 }
115 case "location":
116 if v != nil {
117 var location string
118 err = json.Unmarshal(*v, &location)
119 if err != nil {
120 return err
121 }
122 ds.Location = &location
123 }
124 case "tags":
125 if v != nil {
126 var tags map[string]*string
127 err = json.Unmarshal(*v, &tags)
128 if err != nil {
129 return err
130 }
131 ds.Tags = tags
132 }
133 case "etag":
134 if v != nil {
135 var etag string
136 err = json.Unmarshal(*v, &etag)
137 if err != nil {
138 return err
139 }
140 ds.Etag = &etag
141 }
142 }
143 }
144
145 return nil
146 }
147
148
149 type DomainServiceListResult struct {
150 autorest.Response `json:"-"`
151
152 Value *[]DomainService `json:"value,omitempty"`
153
154 NextLink *string `json:"nextLink,omitempty"`
155 }
156
157
158 func (dslr DomainServiceListResult) MarshalJSON() ([]byte, error) {
159 objectMap := make(map[string]interface{})
160 if dslr.Value != nil {
161 objectMap["value"] = dslr.Value
162 }
163 return json.Marshal(objectMap)
164 }
165
166
167 type DomainServiceListResultIterator struct {
168 i int
169 page DomainServiceListResultPage
170 }
171
172
173
174 func (iter *DomainServiceListResultIterator) NextWithContext(ctx context.Context) (err error) {
175 if tracing.IsEnabled() {
176 ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultIterator.NextWithContext")
177 defer func() {
178 sc := -1
179 if iter.Response().Response.Response != nil {
180 sc = iter.Response().Response.Response.StatusCode
181 }
182 tracing.EndSpan(ctx, sc, err)
183 }()
184 }
185 iter.i++
186 if iter.i < len(iter.page.Values()) {
187 return nil
188 }
189 err = iter.page.NextWithContext(ctx)
190 if err != nil {
191 iter.i--
192 return err
193 }
194 iter.i = 0
195 return nil
196 }
197
198
199
200
201 func (iter *DomainServiceListResultIterator) Next() error {
202 return iter.NextWithContext(context.Background())
203 }
204
205
206 func (iter DomainServiceListResultIterator) NotDone() bool {
207 return iter.page.NotDone() && iter.i < len(iter.page.Values())
208 }
209
210
211 func (iter DomainServiceListResultIterator) Response() DomainServiceListResult {
212 return iter.page.Response()
213 }
214
215
216
217 func (iter DomainServiceListResultIterator) Value() DomainService {
218 if !iter.page.NotDone() {
219 return DomainService{}
220 }
221 return iter.page.Values()[iter.i]
222 }
223
224
225 func NewDomainServiceListResultIterator(page DomainServiceListResultPage) DomainServiceListResultIterator {
226 return DomainServiceListResultIterator{page: page}
227 }
228
229
230 func (dslr DomainServiceListResult) IsEmpty() bool {
231 return dslr.Value == nil || len(*dslr.Value) == 0
232 }
233
234
235 func (dslr DomainServiceListResult) hasNextLink() bool {
236 return dslr.NextLink != nil && len(*dslr.NextLink) != 0
237 }
238
239
240
241 func (dslr DomainServiceListResult) domainServiceListResultPreparer(ctx context.Context) (*http.Request, error) {
242 if !dslr.hasNextLink() {
243 return nil, nil
244 }
245 return autorest.Prepare((&http.Request{}).WithContext(ctx),
246 autorest.AsJSON(),
247 autorest.AsGet(),
248 autorest.WithBaseURL(to.String(dslr.NextLink)))
249 }
250
251
252 type DomainServiceListResultPage struct {
253 fn func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)
254 dslr DomainServiceListResult
255 }
256
257
258
259 func (page *DomainServiceListResultPage) NextWithContext(ctx context.Context) (err error) {
260 if tracing.IsEnabled() {
261 ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultPage.NextWithContext")
262 defer func() {
263 sc := -1
264 if page.Response().Response.Response != nil {
265 sc = page.Response().Response.Response.StatusCode
266 }
267 tracing.EndSpan(ctx, sc, err)
268 }()
269 }
270 for {
271 next, err := page.fn(ctx, page.dslr)
272 if err != nil {
273 return err
274 }
275 page.dslr = next
276 if !next.hasNextLink() || !next.IsEmpty() {
277 break
278 }
279 }
280 return nil
281 }
282
283
284
285
286 func (page *DomainServiceListResultPage) Next() error {
287 return page.NextWithContext(context.Background())
288 }
289
290
291 func (page DomainServiceListResultPage) NotDone() bool {
292 return !page.dslr.IsEmpty()
293 }
294
295
296 func (page DomainServiceListResultPage) Response() DomainServiceListResult {
297 return page.dslr
298 }
299
300
301 func (page DomainServiceListResultPage) Values() []DomainService {
302 if page.dslr.IsEmpty() {
303 return nil
304 }
305 return *page.dslr.Value
306 }
307
308
309 func NewDomainServiceListResultPage(cur DomainServiceListResult, getNextPage func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)) DomainServiceListResultPage {
310 return DomainServiceListResultPage{
311 fn: getNextPage,
312 dslr: cur,
313 }
314 }
315
316
317 type DomainServiceProperties struct {
318
319 TenantID *string `json:"tenantId,omitempty"`
320
321 DomainName *string `json:"domainName,omitempty"`
322
323 DeploymentID *string `json:"deploymentId,omitempty"`
324
325 VnetSiteID *string `json:"vnetSiteId,omitempty"`
326
327 SubnetID *string `json:"subnetId,omitempty"`
328
329 LdapsSettings *LdapsSettings `json:"ldapsSettings,omitempty"`
330
331 HealthLastEvaluated *date.TimeRFC1123 `json:"healthLastEvaluated,omitempty"`
332
333 HealthMonitors *[]HealthMonitor `json:"healthMonitors,omitempty"`
334
335 HealthAlerts *[]HealthAlert `json:"healthAlerts,omitempty"`
336
337 NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"`
338
339 DomainSecuritySettings *DomainSecuritySettings `json:"domainSecuritySettings,omitempty"`
340
341 FilteredSync FilteredSync `json:"filteredSync,omitempty"`
342
343 DomainControllerIPAddress *[]string `json:"domainControllerIpAddress,omitempty"`
344
345 ServiceStatus *string `json:"serviceStatus,omitempty"`
346
347 ProvisioningState *string `json:"provisioningState,omitempty"`
348 }
349
350
351 func (dsp DomainServiceProperties) MarshalJSON() ([]byte, error) {
352 objectMap := make(map[string]interface{})
353 if dsp.DomainName != nil {
354 objectMap["domainName"] = dsp.DomainName
355 }
356 if dsp.SubnetID != nil {
357 objectMap["subnetId"] = dsp.SubnetID
358 }
359 if dsp.LdapsSettings != nil {
360 objectMap["ldapsSettings"] = dsp.LdapsSettings
361 }
362 if dsp.NotificationSettings != nil {
363 objectMap["notificationSettings"] = dsp.NotificationSettings
364 }
365 if dsp.DomainSecuritySettings != nil {
366 objectMap["domainSecuritySettings"] = dsp.DomainSecuritySettings
367 }
368 if dsp.FilteredSync != "" {
369 objectMap["filteredSync"] = dsp.FilteredSync
370 }
371 return json.Marshal(objectMap)
372 }
373
374
375
376 type DomainServicesCreateOrUpdateFuture struct {
377 azure.FutureAPI
378
379
380 Result func(DomainServicesClient) (DomainService, error)
381 }
382
383
384 func (future *DomainServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
385 var azFuture azure.Future
386 if err := json.Unmarshal(body, &azFuture); err != nil {
387 return err
388 }
389 future.FutureAPI = &azFuture
390 future.Result = future.result
391 return nil
392 }
393
394
395 func (future *DomainServicesCreateOrUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) {
396 var done bool
397 done, err = future.DoneWithContext(context.Background(), client)
398 if err != nil {
399 err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
400 return
401 }
402 if !done {
403 ds.Response.Response = future.Response()
404 err = azure.NewAsyncOpIncompleteError("aad.DomainServicesCreateOrUpdateFuture")
405 return
406 }
407 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
408 if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent {
409 ds, err = client.CreateOrUpdateResponder(ds.Response.Response)
410 if err != nil {
411 err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", ds.Response.Response, "Failure responding to request")
412 }
413 }
414 return
415 }
416
417
418
419 type DomainServicesDeleteFuture struct {
420 azure.FutureAPI
421
422
423 Result func(DomainServicesClient) (autorest.Response, error)
424 }
425
426
427 func (future *DomainServicesDeleteFuture) UnmarshalJSON(body []byte) error {
428 var azFuture azure.Future
429 if err := json.Unmarshal(body, &azFuture); err != nil {
430 return err
431 }
432 future.FutureAPI = &azFuture
433 future.Result = future.result
434 return nil
435 }
436
437
438 func (future *DomainServicesDeleteFuture) result(client DomainServicesClient) (ar autorest.Response, err error) {
439 var done bool
440 done, err = future.DoneWithContext(context.Background(), client)
441 if err != nil {
442 err = autorest.NewErrorWithError(err, "aad.DomainServicesDeleteFuture", "Result", future.Response(), "Polling failure")
443 return
444 }
445 if !done {
446 ar.Response = future.Response()
447 err = azure.NewAsyncOpIncompleteError("aad.DomainServicesDeleteFuture")
448 return
449 }
450 ar.Response = future.Response()
451 return
452 }
453
454
455
456 type DomainServicesUpdateFuture struct {
457 azure.FutureAPI
458
459
460 Result func(DomainServicesClient) (DomainService, error)
461 }
462
463
464 func (future *DomainServicesUpdateFuture) UnmarshalJSON(body []byte) error {
465 var azFuture azure.Future
466 if err := json.Unmarshal(body, &azFuture); err != nil {
467 return err
468 }
469 future.FutureAPI = &azFuture
470 future.Result = future.result
471 return nil
472 }
473
474
475 func (future *DomainServicesUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) {
476 var done bool
477 done, err = future.DoneWithContext(context.Background(), client)
478 if err != nil {
479 err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", future.Response(), "Polling failure")
480 return
481 }
482 if !done {
483 ds.Response.Response = future.Response()
484 err = azure.NewAsyncOpIncompleteError("aad.DomainServicesUpdateFuture")
485 return
486 }
487 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
488 if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent {
489 ds, err = client.UpdateResponder(ds.Response.Response)
490 if err != nil {
491 err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", ds.Response.Response, "Failure responding to request")
492 }
493 }
494 return
495 }
496
497
498 type HealthAlert struct {
499
500 ID *string `json:"id,omitempty"`
501
502 Name *string `json:"name,omitempty"`
503
504 Issue *string `json:"issue,omitempty"`
505
506 Severity *string `json:"severity,omitempty"`
507
508 Raised *date.Time `json:"raised,omitempty"`
509
510 LastDetected *date.Time `json:"lastDetected,omitempty"`
511
512 ResolutionURI *string `json:"resolutionUri,omitempty"`
513 }
514
515
516 func (ha HealthAlert) MarshalJSON() ([]byte, error) {
517 objectMap := make(map[string]interface{})
518 return json.Marshal(objectMap)
519 }
520
521
522 type HealthMonitor struct {
523
524 ID *string `json:"id,omitempty"`
525
526 Name *string `json:"name,omitempty"`
527
528 Details *string `json:"details,omitempty"`
529 }
530
531
532 func (hm HealthMonitor) MarshalJSON() ([]byte, error) {
533 objectMap := make(map[string]interface{})
534 return json.Marshal(objectMap)
535 }
536
537
538 type LdapsSettings struct {
539
540 Ldaps Ldaps `json:"ldaps,omitempty"`
541
542 PfxCertificate *string `json:"pfxCertificate,omitempty"`
543
544 PfxCertificatePassword *string `json:"pfxCertificatePassword,omitempty"`
545
546 PublicCertificate *string `json:"publicCertificate,omitempty"`
547
548 CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
549
550 CertificateNotAfter *date.Time `json:"certificateNotAfter,omitempty"`
551
552 ExternalAccess ExternalAccess `json:"externalAccess,omitempty"`
553
554 ExternalAccessIPAddress *string `json:"externalAccessIpAddress,omitempty"`
555 }
556
557
558 func (ls LdapsSettings) MarshalJSON() ([]byte, error) {
559 objectMap := make(map[string]interface{})
560 if ls.Ldaps != "" {
561 objectMap["ldaps"] = ls.Ldaps
562 }
563 if ls.PfxCertificate != nil {
564 objectMap["pfxCertificate"] = ls.PfxCertificate
565 }
566 if ls.PfxCertificatePassword != nil {
567 objectMap["pfxCertificatePassword"] = ls.PfxCertificatePassword
568 }
569 if ls.ExternalAccess != "" {
570 objectMap["externalAccess"] = ls.ExternalAccess
571 }
572 return json.Marshal(objectMap)
573 }
574
575
576 type NotificationSettings struct {
577
578 NotifyGlobalAdmins NotifyGlobalAdmins `json:"notifyGlobalAdmins,omitempty"`
579
580 NotifyDcAdmins NotifyDcAdmins `json:"notifyDcAdmins,omitempty"`
581
582 AdditionalRecipients *[]string `json:"additionalRecipients,omitempty"`
583 }
584
585
586 type OperationDisplayInfo struct {
587
588 Description *string `json:"description,omitempty"`
589
590 Operation *string `json:"operation,omitempty"`
591
592 Provider *string `json:"provider,omitempty"`
593
594 Resource *string `json:"resource,omitempty"`
595 }
596
597
598 type OperationEntity struct {
599
600 Name *string `json:"name,omitempty"`
601
602 Display *OperationDisplayInfo `json:"display,omitempty"`
603
604 Origin *string `json:"origin,omitempty"`
605 }
606
607
608 type OperationEntityListResult struct {
609 autorest.Response `json:"-"`
610
611 Value *[]OperationEntity `json:"value,omitempty"`
612
613 NextLink *string `json:"nextLink,omitempty"`
614 }
615
616
617 func (oelr OperationEntityListResult) MarshalJSON() ([]byte, error) {
618 objectMap := make(map[string]interface{})
619 if oelr.Value != nil {
620 objectMap["value"] = oelr.Value
621 }
622 return json.Marshal(objectMap)
623 }
624
625
626 type OperationEntityListResultIterator struct {
627 i int
628 page OperationEntityListResultPage
629 }
630
631
632
633 func (iter *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) {
634 if tracing.IsEnabled() {
635 ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext")
636 defer func() {
637 sc := -1
638 if iter.Response().Response.Response != nil {
639 sc = iter.Response().Response.Response.StatusCode
640 }
641 tracing.EndSpan(ctx, sc, err)
642 }()
643 }
644 iter.i++
645 if iter.i < len(iter.page.Values()) {
646 return nil
647 }
648 err = iter.page.NextWithContext(ctx)
649 if err != nil {
650 iter.i--
651 return err
652 }
653 iter.i = 0
654 return nil
655 }
656
657
658
659
660 func (iter *OperationEntityListResultIterator) Next() error {
661 return iter.NextWithContext(context.Background())
662 }
663
664
665 func (iter OperationEntityListResultIterator) NotDone() bool {
666 return iter.page.NotDone() && iter.i < len(iter.page.Values())
667 }
668
669
670 func (iter OperationEntityListResultIterator) Response() OperationEntityListResult {
671 return iter.page.Response()
672 }
673
674
675
676 func (iter OperationEntityListResultIterator) Value() OperationEntity {
677 if !iter.page.NotDone() {
678 return OperationEntity{}
679 }
680 return iter.page.Values()[iter.i]
681 }
682
683
684 func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator {
685 return OperationEntityListResultIterator{page: page}
686 }
687
688
689 func (oelr OperationEntityListResult) IsEmpty() bool {
690 return oelr.Value == nil || len(*oelr.Value) == 0
691 }
692
693
694 func (oelr OperationEntityListResult) hasNextLink() bool {
695 return oelr.NextLink != nil && len(*oelr.NextLink) != 0
696 }
697
698
699
700 func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) {
701 if !oelr.hasNextLink() {
702 return nil, nil
703 }
704 return autorest.Prepare((&http.Request{}).WithContext(ctx),
705 autorest.AsJSON(),
706 autorest.AsGet(),
707 autorest.WithBaseURL(to.String(oelr.NextLink)))
708 }
709
710
711 type OperationEntityListResultPage struct {
712 fn func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)
713 oelr OperationEntityListResult
714 }
715
716
717
718 func (page *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) {
719 if tracing.IsEnabled() {
720 ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext")
721 defer func() {
722 sc := -1
723 if page.Response().Response.Response != nil {
724 sc = page.Response().Response.Response.StatusCode
725 }
726 tracing.EndSpan(ctx, sc, err)
727 }()
728 }
729 for {
730 next, err := page.fn(ctx, page.oelr)
731 if err != nil {
732 return err
733 }
734 page.oelr = next
735 if !next.hasNextLink() || !next.IsEmpty() {
736 break
737 }
738 }
739 return nil
740 }
741
742
743
744
745 func (page *OperationEntityListResultPage) Next() error {
746 return page.NextWithContext(context.Background())
747 }
748
749
750 func (page OperationEntityListResultPage) NotDone() bool {
751 return !page.oelr.IsEmpty()
752 }
753
754
755 func (page OperationEntityListResultPage) Response() OperationEntityListResult {
756 return page.oelr
757 }
758
759
760 func (page OperationEntityListResultPage) Values() []OperationEntity {
761 if page.oelr.IsEmpty() {
762 return nil
763 }
764 return *page.oelr.Value
765 }
766
767
768 func NewOperationEntityListResultPage(cur OperationEntityListResult, getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage {
769 return OperationEntityListResultPage{
770 fn: getNextPage,
771 oelr: cur,
772 }
773 }
774
775
776 type Resource struct {
777
778 ID *string `json:"id,omitempty"`
779
780 Name *string `json:"name,omitempty"`
781
782 Type *string `json:"type,omitempty"`
783
784 Location *string `json:"location,omitempty"`
785
786 Tags map[string]*string `json:"tags"`
787
788 Etag *string `json:"etag,omitempty"`
789 }
790
791
792 func (r Resource) MarshalJSON() ([]byte, error) {
793 objectMap := make(map[string]interface{})
794 if r.Location != nil {
795 objectMap["location"] = r.Location
796 }
797 if r.Tags != nil {
798 objectMap["tags"] = r.Tags
799 }
800 if r.Etag != nil {
801 objectMap["etag"] = r.Etag
802 }
803 return json.Marshal(objectMap)
804 }
805
View as plain text