1 package containerservice
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/to"
15 "github.com/Azure/go-autorest/tracing"
16 "net/http"
17 )
18
19
20 const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2017-08-31/containerservice"
21
22
23 type AccessProfile struct {
24
25 KubeConfig *[]byte `json:"kubeConfig,omitempty"`
26 }
27
28
29 type AgentPoolProfile struct {
30
31 Name *string `json:"name,omitempty"`
32
33 Count *int32 `json:"count,omitempty"`
34
35 VMSize VMSizeTypes `json:"vmSize,omitempty"`
36
37 OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"`
38
39 DNSPrefix *string `json:"dnsPrefix,omitempty"`
40
41 Fqdn *string `json:"fqdn,omitempty"`
42
43 Ports *[]int32 `json:"ports,omitempty"`
44
45 StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"`
46
47 VnetSubnetID *string `json:"vnetSubnetID,omitempty"`
48
49 OsType OSType `json:"osType,omitempty"`
50 }
51
52
53 func (app AgentPoolProfile) MarshalJSON() ([]byte, error) {
54 objectMap := make(map[string]interface{})
55 if app.Name != nil {
56 objectMap["name"] = app.Name
57 }
58 if app.Count != nil {
59 objectMap["count"] = app.Count
60 }
61 if app.VMSize != "" {
62 objectMap["vmSize"] = app.VMSize
63 }
64 if app.OsDiskSizeGB != nil {
65 objectMap["osDiskSizeGB"] = app.OsDiskSizeGB
66 }
67 if app.DNSPrefix != nil {
68 objectMap["dnsPrefix"] = app.DNSPrefix
69 }
70 if app.Ports != nil {
71 objectMap["ports"] = app.Ports
72 }
73 if app.StorageProfile != "" {
74 objectMap["storageProfile"] = app.StorageProfile
75 }
76 if app.VnetSubnetID != nil {
77 objectMap["vnetSubnetID"] = app.VnetSubnetID
78 }
79 if app.OsType != "" {
80 objectMap["osType"] = app.OsType
81 }
82 return json.Marshal(objectMap)
83 }
84
85
86 type ContainerService struct {
87 autorest.Response `json:"-"`
88
89 *Properties `json:"properties,omitempty"`
90
91 ID *string `json:"id,omitempty"`
92
93 Name *string `json:"name,omitempty"`
94
95 Type *string `json:"type,omitempty"`
96
97 Location *string `json:"location,omitempty"`
98
99 Tags map[string]*string `json:"tags"`
100 }
101
102
103 func (cs ContainerService) MarshalJSON() ([]byte, error) {
104 objectMap := make(map[string]interface{})
105 if cs.Properties != nil {
106 objectMap["properties"] = cs.Properties
107 }
108 if cs.Location != nil {
109 objectMap["location"] = cs.Location
110 }
111 if cs.Tags != nil {
112 objectMap["tags"] = cs.Tags
113 }
114 return json.Marshal(objectMap)
115 }
116
117
118 func (cs *ContainerService) UnmarshalJSON(body []byte) error {
119 var m map[string]*json.RawMessage
120 err := json.Unmarshal(body, &m)
121 if err != nil {
122 return err
123 }
124 for k, v := range m {
125 switch k {
126 case "properties":
127 if v != nil {
128 var properties Properties
129 err = json.Unmarshal(*v, &properties)
130 if err != nil {
131 return err
132 }
133 cs.Properties = &properties
134 }
135 case "id":
136 if v != nil {
137 var ID string
138 err = json.Unmarshal(*v, &ID)
139 if err != nil {
140 return err
141 }
142 cs.ID = &ID
143 }
144 case "name":
145 if v != nil {
146 var name string
147 err = json.Unmarshal(*v, &name)
148 if err != nil {
149 return err
150 }
151 cs.Name = &name
152 }
153 case "type":
154 if v != nil {
155 var typeVar string
156 err = json.Unmarshal(*v, &typeVar)
157 if err != nil {
158 return err
159 }
160 cs.Type = &typeVar
161 }
162 case "location":
163 if v != nil {
164 var location string
165 err = json.Unmarshal(*v, &location)
166 if err != nil {
167 return err
168 }
169 cs.Location = &location
170 }
171 case "tags":
172 if v != nil {
173 var tags map[string]*string
174 err = json.Unmarshal(*v, &tags)
175 if err != nil {
176 return err
177 }
178 cs.Tags = tags
179 }
180 }
181 }
182
183 return nil
184 }
185
186
187
188 type ContainerServicesCreateOrUpdateFutureType struct {
189 azure.FutureAPI
190
191
192 Result func(ContainerServicesClient) (ContainerService, error)
193 }
194
195
196 func (future *ContainerServicesCreateOrUpdateFutureType) UnmarshalJSON(body []byte) error {
197 var azFuture azure.Future
198 if err := json.Unmarshal(body, &azFuture); err != nil {
199 return err
200 }
201 future.FutureAPI = &azFuture
202 future.Result = future.result
203 return nil
204 }
205
206
207 func (future *ContainerServicesCreateOrUpdateFutureType) result(client ContainerServicesClient) (cs ContainerService, err error) {
208 var done bool
209 done, err = future.DoneWithContext(context.Background(), client)
210 if err != nil {
211 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesCreateOrUpdateFutureType", "Result", future.Response(), "Polling failure")
212 return
213 }
214 if !done {
215 cs.Response.Response = future.Response()
216 err = azure.NewAsyncOpIncompleteError("containerservice.ContainerServicesCreateOrUpdateFutureType")
217 return
218 }
219 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
220 if cs.Response.Response, err = future.GetResult(sender); err == nil && cs.Response.Response.StatusCode != http.StatusNoContent {
221 cs, err = client.CreateOrUpdateResponder(cs.Response.Response)
222 if err != nil {
223 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesCreateOrUpdateFutureType", "Result", cs.Response.Response, "Failure responding to request")
224 }
225 }
226 return
227 }
228
229
230
231 type ContainerServicesDeleteFutureType struct {
232 azure.FutureAPI
233
234
235 Result func(ContainerServicesClient) (autorest.Response, error)
236 }
237
238
239 func (future *ContainerServicesDeleteFutureType) UnmarshalJSON(body []byte) error {
240 var azFuture azure.Future
241 if err := json.Unmarshal(body, &azFuture); err != nil {
242 return err
243 }
244 future.FutureAPI = &azFuture
245 future.Result = future.result
246 return nil
247 }
248
249
250 func (future *ContainerServicesDeleteFutureType) result(client ContainerServicesClient) (ar autorest.Response, err error) {
251 var done bool
252 done, err = future.DoneWithContext(context.Background(), client)
253 if err != nil {
254 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesDeleteFutureType", "Result", future.Response(), "Polling failure")
255 return
256 }
257 if !done {
258 ar.Response = future.Response()
259 err = azure.NewAsyncOpIncompleteError("containerservice.ContainerServicesDeleteFutureType")
260 return
261 }
262 ar.Response = future.Response()
263 return
264 }
265
266
267 type CustomProfile struct {
268
269 Orchestrator *string `json:"orchestrator,omitempty"`
270 }
271
272
273 type DiagnosticsProfile struct {
274
275 VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"`
276 }
277
278
279 type KeyVaultSecretRef struct {
280
281 VaultID *string `json:"vaultID,omitempty"`
282
283 SecretName *string `json:"secretName,omitempty"`
284
285 Version *string `json:"version,omitempty"`
286 }
287
288
289 type LinuxProfile struct {
290
291 AdminUsername *string `json:"adminUsername,omitempty"`
292
293 SSH *SSHConfiguration `json:"ssh,omitempty"`
294 }
295
296
297 type ListResult struct {
298 autorest.Response `json:"-"`
299
300 Value *[]ContainerService `json:"value,omitempty"`
301
302 NextLink *string `json:"nextLink,omitempty"`
303 }
304
305
306 func (lr ListResult) MarshalJSON() ([]byte, error) {
307 objectMap := make(map[string]interface{})
308 if lr.Value != nil {
309 objectMap["value"] = lr.Value
310 }
311 return json.Marshal(objectMap)
312 }
313
314
315 type ListResultIterator struct {
316 i int
317 page ListResultPage
318 }
319
320
321
322 func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) {
323 if tracing.IsEnabled() {
324 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext")
325 defer func() {
326 sc := -1
327 if iter.Response().Response.Response != nil {
328 sc = iter.Response().Response.Response.StatusCode
329 }
330 tracing.EndSpan(ctx, sc, err)
331 }()
332 }
333 iter.i++
334 if iter.i < len(iter.page.Values()) {
335 return nil
336 }
337 err = iter.page.NextWithContext(ctx)
338 if err != nil {
339 iter.i--
340 return err
341 }
342 iter.i = 0
343 return nil
344 }
345
346
347
348
349 func (iter *ListResultIterator) Next() error {
350 return iter.NextWithContext(context.Background())
351 }
352
353
354 func (iter ListResultIterator) NotDone() bool {
355 return iter.page.NotDone() && iter.i < len(iter.page.Values())
356 }
357
358
359 func (iter ListResultIterator) Response() ListResult {
360 return iter.page.Response()
361 }
362
363
364
365 func (iter ListResultIterator) Value() ContainerService {
366 if !iter.page.NotDone() {
367 return ContainerService{}
368 }
369 return iter.page.Values()[iter.i]
370 }
371
372
373 func NewListResultIterator(page ListResultPage) ListResultIterator {
374 return ListResultIterator{page: page}
375 }
376
377
378 func (lr ListResult) IsEmpty() bool {
379 return lr.Value == nil || len(*lr.Value) == 0
380 }
381
382
383 func (lr ListResult) hasNextLink() bool {
384 return lr.NextLink != nil && len(*lr.NextLink) != 0
385 }
386
387
388
389 func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {
390 if !lr.hasNextLink() {
391 return nil, nil
392 }
393 return autorest.Prepare((&http.Request{}).WithContext(ctx),
394 autorest.AsJSON(),
395 autorest.AsGet(),
396 autorest.WithBaseURL(to.String(lr.NextLink)))
397 }
398
399
400 type ListResultPage struct {
401 fn func(context.Context, ListResult) (ListResult, error)
402 lr ListResult
403 }
404
405
406
407 func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {
408 if tracing.IsEnabled() {
409 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext")
410 defer func() {
411 sc := -1
412 if page.Response().Response.Response != nil {
413 sc = page.Response().Response.Response.StatusCode
414 }
415 tracing.EndSpan(ctx, sc, err)
416 }()
417 }
418 for {
419 next, err := page.fn(ctx, page.lr)
420 if err != nil {
421 return err
422 }
423 page.lr = next
424 if !next.hasNextLink() || !next.IsEmpty() {
425 break
426 }
427 }
428 return nil
429 }
430
431
432
433
434 func (page *ListResultPage) Next() error {
435 return page.NextWithContext(context.Background())
436 }
437
438
439 func (page ListResultPage) NotDone() bool {
440 return !page.lr.IsEmpty()
441 }
442
443
444 func (page ListResultPage) Response() ListResult {
445 return page.lr
446 }
447
448
449 func (page ListResultPage) Values() []ContainerService {
450 if page.lr.IsEmpty() {
451 return nil
452 }
453 return *page.lr.Value
454 }
455
456
457 func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage {
458 return ListResultPage{
459 fn: getNextPage,
460 lr: cur,
461 }
462 }
463
464
465 type ManagedCluster struct {
466 autorest.Response `json:"-"`
467
468 *ManagedClusterProperties `json:"properties,omitempty"`
469
470 ID *string `json:"id,omitempty"`
471
472 Name *string `json:"name,omitempty"`
473
474 Type *string `json:"type,omitempty"`
475
476 Location *string `json:"location,omitempty"`
477
478 Tags map[string]*string `json:"tags"`
479 }
480
481
482 func (mc ManagedCluster) MarshalJSON() ([]byte, error) {
483 objectMap := make(map[string]interface{})
484 if mc.ManagedClusterProperties != nil {
485 objectMap["properties"] = mc.ManagedClusterProperties
486 }
487 if mc.Location != nil {
488 objectMap["location"] = mc.Location
489 }
490 if mc.Tags != nil {
491 objectMap["tags"] = mc.Tags
492 }
493 return json.Marshal(objectMap)
494 }
495
496
497 func (mc *ManagedCluster) UnmarshalJSON(body []byte) error {
498 var m map[string]*json.RawMessage
499 err := json.Unmarshal(body, &m)
500 if err != nil {
501 return err
502 }
503 for k, v := range m {
504 switch k {
505 case "properties":
506 if v != nil {
507 var managedClusterProperties ManagedClusterProperties
508 err = json.Unmarshal(*v, &managedClusterProperties)
509 if err != nil {
510 return err
511 }
512 mc.ManagedClusterProperties = &managedClusterProperties
513 }
514 case "id":
515 if v != nil {
516 var ID string
517 err = json.Unmarshal(*v, &ID)
518 if err != nil {
519 return err
520 }
521 mc.ID = &ID
522 }
523 case "name":
524 if v != nil {
525 var name string
526 err = json.Unmarshal(*v, &name)
527 if err != nil {
528 return err
529 }
530 mc.Name = &name
531 }
532 case "type":
533 if v != nil {
534 var typeVar string
535 err = json.Unmarshal(*v, &typeVar)
536 if err != nil {
537 return err
538 }
539 mc.Type = &typeVar
540 }
541 case "location":
542 if v != nil {
543 var location string
544 err = json.Unmarshal(*v, &location)
545 if err != nil {
546 return err
547 }
548 mc.Location = &location
549 }
550 case "tags":
551 if v != nil {
552 var tags map[string]*string
553 err = json.Unmarshal(*v, &tags)
554 if err != nil {
555 return err
556 }
557 mc.Tags = tags
558 }
559 }
560 }
561
562 return nil
563 }
564
565
566 type ManagedClusterAccessProfile struct {
567 autorest.Response `json:"-"`
568
569 *AccessProfile `json:"properties,omitempty"`
570
571 ID *string `json:"id,omitempty"`
572
573 Name *string `json:"name,omitempty"`
574
575 Type *string `json:"type,omitempty"`
576
577 Location *string `json:"location,omitempty"`
578
579 Tags map[string]*string `json:"tags"`
580 }
581
582
583 func (mcap ManagedClusterAccessProfile) MarshalJSON() ([]byte, error) {
584 objectMap := make(map[string]interface{})
585 if mcap.AccessProfile != nil {
586 objectMap["properties"] = mcap.AccessProfile
587 }
588 if mcap.Location != nil {
589 objectMap["location"] = mcap.Location
590 }
591 if mcap.Tags != nil {
592 objectMap["tags"] = mcap.Tags
593 }
594 return json.Marshal(objectMap)
595 }
596
597
598 func (mcap *ManagedClusterAccessProfile) UnmarshalJSON(body []byte) error {
599 var m map[string]*json.RawMessage
600 err := json.Unmarshal(body, &m)
601 if err != nil {
602 return err
603 }
604 for k, v := range m {
605 switch k {
606 case "properties":
607 if v != nil {
608 var accessProfile AccessProfile
609 err = json.Unmarshal(*v, &accessProfile)
610 if err != nil {
611 return err
612 }
613 mcap.AccessProfile = &accessProfile
614 }
615 case "id":
616 if v != nil {
617 var ID string
618 err = json.Unmarshal(*v, &ID)
619 if err != nil {
620 return err
621 }
622 mcap.ID = &ID
623 }
624 case "name":
625 if v != nil {
626 var name string
627 err = json.Unmarshal(*v, &name)
628 if err != nil {
629 return err
630 }
631 mcap.Name = &name
632 }
633 case "type":
634 if v != nil {
635 var typeVar string
636 err = json.Unmarshal(*v, &typeVar)
637 if err != nil {
638 return err
639 }
640 mcap.Type = &typeVar
641 }
642 case "location":
643 if v != nil {
644 var location string
645 err = json.Unmarshal(*v, &location)
646 if err != nil {
647 return err
648 }
649 mcap.Location = &location
650 }
651 case "tags":
652 if v != nil {
653 var tags map[string]*string
654 err = json.Unmarshal(*v, &tags)
655 if err != nil {
656 return err
657 }
658 mcap.Tags = tags
659 }
660 }
661 }
662
663 return nil
664 }
665
666
667 type ManagedClusterListResult struct {
668 autorest.Response `json:"-"`
669
670 Value *[]ManagedCluster `json:"value,omitempty"`
671
672 NextLink *string `json:"nextLink,omitempty"`
673 }
674
675
676 func (mclr ManagedClusterListResult) MarshalJSON() ([]byte, error) {
677 objectMap := make(map[string]interface{})
678 if mclr.Value != nil {
679 objectMap["value"] = mclr.Value
680 }
681 return json.Marshal(objectMap)
682 }
683
684
685 type ManagedClusterListResultIterator struct {
686 i int
687 page ManagedClusterListResultPage
688 }
689
690
691
692 func (iter *ManagedClusterListResultIterator) NextWithContext(ctx context.Context) (err error) {
693 if tracing.IsEnabled() {
694 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultIterator.NextWithContext")
695 defer func() {
696 sc := -1
697 if iter.Response().Response.Response != nil {
698 sc = iter.Response().Response.Response.StatusCode
699 }
700 tracing.EndSpan(ctx, sc, err)
701 }()
702 }
703 iter.i++
704 if iter.i < len(iter.page.Values()) {
705 return nil
706 }
707 err = iter.page.NextWithContext(ctx)
708 if err != nil {
709 iter.i--
710 return err
711 }
712 iter.i = 0
713 return nil
714 }
715
716
717
718
719 func (iter *ManagedClusterListResultIterator) Next() error {
720 return iter.NextWithContext(context.Background())
721 }
722
723
724 func (iter ManagedClusterListResultIterator) NotDone() bool {
725 return iter.page.NotDone() && iter.i < len(iter.page.Values())
726 }
727
728
729 func (iter ManagedClusterListResultIterator) Response() ManagedClusterListResult {
730 return iter.page.Response()
731 }
732
733
734
735 func (iter ManagedClusterListResultIterator) Value() ManagedCluster {
736 if !iter.page.NotDone() {
737 return ManagedCluster{}
738 }
739 return iter.page.Values()[iter.i]
740 }
741
742
743 func NewManagedClusterListResultIterator(page ManagedClusterListResultPage) ManagedClusterListResultIterator {
744 return ManagedClusterListResultIterator{page: page}
745 }
746
747
748 func (mclr ManagedClusterListResult) IsEmpty() bool {
749 return mclr.Value == nil || len(*mclr.Value) == 0
750 }
751
752
753 func (mclr ManagedClusterListResult) hasNextLink() bool {
754 return mclr.NextLink != nil && len(*mclr.NextLink) != 0
755 }
756
757
758
759 func (mclr ManagedClusterListResult) managedClusterListResultPreparer(ctx context.Context) (*http.Request, error) {
760 if !mclr.hasNextLink() {
761 return nil, nil
762 }
763 return autorest.Prepare((&http.Request{}).WithContext(ctx),
764 autorest.AsJSON(),
765 autorest.AsGet(),
766 autorest.WithBaseURL(to.String(mclr.NextLink)))
767 }
768
769
770 type ManagedClusterListResultPage struct {
771 fn func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)
772 mclr ManagedClusterListResult
773 }
774
775
776
777 func (page *ManagedClusterListResultPage) NextWithContext(ctx context.Context) (err error) {
778 if tracing.IsEnabled() {
779 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultPage.NextWithContext")
780 defer func() {
781 sc := -1
782 if page.Response().Response.Response != nil {
783 sc = page.Response().Response.Response.StatusCode
784 }
785 tracing.EndSpan(ctx, sc, err)
786 }()
787 }
788 for {
789 next, err := page.fn(ctx, page.mclr)
790 if err != nil {
791 return err
792 }
793 page.mclr = next
794 if !next.hasNextLink() || !next.IsEmpty() {
795 break
796 }
797 }
798 return nil
799 }
800
801
802
803
804 func (page *ManagedClusterListResultPage) Next() error {
805 return page.NextWithContext(context.Background())
806 }
807
808
809 func (page ManagedClusterListResultPage) NotDone() bool {
810 return !page.mclr.IsEmpty()
811 }
812
813
814 func (page ManagedClusterListResultPage) Response() ManagedClusterListResult {
815 return page.mclr
816 }
817
818
819 func (page ManagedClusterListResultPage) Values() []ManagedCluster {
820 if page.mclr.IsEmpty() {
821 return nil
822 }
823 return *page.mclr.Value
824 }
825
826
827 func NewManagedClusterListResultPage(cur ManagedClusterListResult, getNextPage func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)) ManagedClusterListResultPage {
828 return ManagedClusterListResultPage{
829 fn: getNextPage,
830 mclr: cur,
831 }
832 }
833
834
835 type ManagedClusterPoolUpgradeProfile struct {
836
837 KubernetesVersion *string `json:"kubernetesVersion,omitempty"`
838
839 Name *string `json:"name,omitempty"`
840
841 OsType OSType `json:"osType,omitempty"`
842
843 Upgrades *[]string `json:"upgrades,omitempty"`
844 }
845
846
847 type ManagedClusterProperties struct {
848
849 ProvisioningState *string `json:"provisioningState,omitempty"`
850
851 DNSPrefix *string `json:"dnsPrefix,omitempty"`
852
853 Fqdn *string `json:"fqdn,omitempty"`
854
855 KubernetesVersion *string `json:"kubernetesVersion,omitempty"`
856
857 AgentPoolProfiles *[]AgentPoolProfile `json:"agentPoolProfiles,omitempty"`
858
859 LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"`
860
861 ServicePrincipalProfile *ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"`
862 }
863
864
865 func (mcp ManagedClusterProperties) MarshalJSON() ([]byte, error) {
866 objectMap := make(map[string]interface{})
867 if mcp.DNSPrefix != nil {
868 objectMap["dnsPrefix"] = mcp.DNSPrefix
869 }
870 if mcp.KubernetesVersion != nil {
871 objectMap["kubernetesVersion"] = mcp.KubernetesVersion
872 }
873 if mcp.AgentPoolProfiles != nil {
874 objectMap["agentPoolProfiles"] = mcp.AgentPoolProfiles
875 }
876 if mcp.LinuxProfile != nil {
877 objectMap["linuxProfile"] = mcp.LinuxProfile
878 }
879 if mcp.ServicePrincipalProfile != nil {
880 objectMap["servicePrincipalProfile"] = mcp.ServicePrincipalProfile
881 }
882 return json.Marshal(objectMap)
883 }
884
885
886
887 type ManagedClustersCreateOrUpdateFuture struct {
888 azure.FutureAPI
889
890
891 Result func(ManagedClustersClient) (ManagedCluster, error)
892 }
893
894
895 func (future *ManagedClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
896 var azFuture azure.Future
897 if err := json.Unmarshal(body, &azFuture); err != nil {
898 return err
899 }
900 future.FutureAPI = &azFuture
901 future.Result = future.result
902 return nil
903 }
904
905
906 func (future *ManagedClustersCreateOrUpdateFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) {
907 var done bool
908 done, err = future.DoneWithContext(context.Background(), client)
909 if err != nil {
910 err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
911 return
912 }
913 if !done {
914 mc.Response.Response = future.Response()
915 err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersCreateOrUpdateFuture")
916 return
917 }
918 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
919 if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent {
920 mc, err = client.CreateOrUpdateResponder(mc.Response.Response)
921 if err != nil {
922 err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", mc.Response.Response, "Failure responding to request")
923 }
924 }
925 return
926 }
927
928
929
930 type ManagedClustersDeleteFuture struct {
931 azure.FutureAPI
932
933
934 Result func(ManagedClustersClient) (autorest.Response, error)
935 }
936
937
938 func (future *ManagedClustersDeleteFuture) UnmarshalJSON(body []byte) error {
939 var azFuture azure.Future
940 if err := json.Unmarshal(body, &azFuture); err != nil {
941 return err
942 }
943 future.FutureAPI = &azFuture
944 future.Result = future.result
945 return nil
946 }
947
948
949 func (future *ManagedClustersDeleteFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) {
950 var done bool
951 done, err = future.DoneWithContext(context.Background(), client)
952 if err != nil {
953 err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersDeleteFuture", "Result", future.Response(), "Polling failure")
954 return
955 }
956 if !done {
957 ar.Response = future.Response()
958 err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersDeleteFuture")
959 return
960 }
961 ar.Response = future.Response()
962 return
963 }
964
965
966 type ManagedClusterUpgradeProfile struct {
967 autorest.Response `json:"-"`
968
969 ID *string `json:"id,omitempty"`
970
971 Name *string `json:"name,omitempty"`
972
973 Type *string `json:"type,omitempty"`
974
975 *ManagedClusterUpgradeProfileProperties `json:"properties,omitempty"`
976 }
977
978
979 func (mcup ManagedClusterUpgradeProfile) MarshalJSON() ([]byte, error) {
980 objectMap := make(map[string]interface{})
981 if mcup.ManagedClusterUpgradeProfileProperties != nil {
982 objectMap["properties"] = mcup.ManagedClusterUpgradeProfileProperties
983 }
984 return json.Marshal(objectMap)
985 }
986
987
988 func (mcup *ManagedClusterUpgradeProfile) UnmarshalJSON(body []byte) error {
989 var m map[string]*json.RawMessage
990 err := json.Unmarshal(body, &m)
991 if err != nil {
992 return err
993 }
994 for k, v := range m {
995 switch k {
996 case "id":
997 if v != nil {
998 var ID string
999 err = json.Unmarshal(*v, &ID)
1000 if err != nil {
1001 return err
1002 }
1003 mcup.ID = &ID
1004 }
1005 case "name":
1006 if v != nil {
1007 var name string
1008 err = json.Unmarshal(*v, &name)
1009 if err != nil {
1010 return err
1011 }
1012 mcup.Name = &name
1013 }
1014 case "type":
1015 if v != nil {
1016 var typeVar string
1017 err = json.Unmarshal(*v, &typeVar)
1018 if err != nil {
1019 return err
1020 }
1021 mcup.Type = &typeVar
1022 }
1023 case "properties":
1024 if v != nil {
1025 var managedClusterUpgradeProfileProperties ManagedClusterUpgradeProfileProperties
1026 err = json.Unmarshal(*v, &managedClusterUpgradeProfileProperties)
1027 if err != nil {
1028 return err
1029 }
1030 mcup.ManagedClusterUpgradeProfileProperties = &managedClusterUpgradeProfileProperties
1031 }
1032 }
1033 }
1034
1035 return nil
1036 }
1037
1038
1039 type ManagedClusterUpgradeProfileProperties struct {
1040
1041 ControlPlaneProfile *ManagedClusterPoolUpgradeProfile `json:"controlPlaneProfile,omitempty"`
1042
1043 AgentPoolProfiles *[]ManagedClusterPoolUpgradeProfile `json:"agentPoolProfiles,omitempty"`
1044 }
1045
1046
1047 type MasterProfile struct {
1048
1049 Count *int32 `json:"count,omitempty"`
1050
1051 DNSPrefix *string `json:"dnsPrefix,omitempty"`
1052
1053 VMSize VMSizeTypes `json:"vmSize,omitempty"`
1054
1055 OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"`
1056
1057 VnetSubnetID *string `json:"vnetSubnetID,omitempty"`
1058
1059 FirstConsecutiveStaticIP *string `json:"firstConsecutiveStaticIP,omitempty"`
1060
1061 StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"`
1062
1063 Fqdn *string `json:"fqdn,omitempty"`
1064 }
1065
1066
1067 func (mp MasterProfile) MarshalJSON() ([]byte, error) {
1068 objectMap := make(map[string]interface{})
1069 if mp.Count != nil {
1070 objectMap["count"] = mp.Count
1071 }
1072 if mp.DNSPrefix != nil {
1073 objectMap["dnsPrefix"] = mp.DNSPrefix
1074 }
1075 if mp.VMSize != "" {
1076 objectMap["vmSize"] = mp.VMSize
1077 }
1078 if mp.OsDiskSizeGB != nil {
1079 objectMap["osDiskSizeGB"] = mp.OsDiskSizeGB
1080 }
1081 if mp.VnetSubnetID != nil {
1082 objectMap["vnetSubnetID"] = mp.VnetSubnetID
1083 }
1084 if mp.FirstConsecutiveStaticIP != nil {
1085 objectMap["firstConsecutiveStaticIP"] = mp.FirstConsecutiveStaticIP
1086 }
1087 if mp.StorageProfile != "" {
1088 objectMap["storageProfile"] = mp.StorageProfile
1089 }
1090 return json.Marshal(objectMap)
1091 }
1092
1093
1094 type OrchestratorProfile struct {
1095
1096 OrchestratorType *string `json:"orchestratorType,omitempty"`
1097
1098 OrchestratorVersion *string `json:"orchestratorVersion,omitempty"`
1099 }
1100
1101
1102 type OrchestratorProfileType struct {
1103
1104 OrchestratorType OrchestratorTypes `json:"orchestratorType,omitempty"`
1105
1106 OrchestratorVersion *string `json:"orchestratorVersion,omitempty"`
1107 }
1108
1109
1110 type Properties struct {
1111
1112 ProvisioningState *string `json:"provisioningState,omitempty"`
1113
1114 OrchestratorProfile *OrchestratorProfileType `json:"orchestratorProfile,omitempty"`
1115
1116 CustomProfile *CustomProfile `json:"customProfile,omitempty"`
1117
1118 ServicePrincipalProfile *ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"`
1119
1120 MasterProfile *MasterProfile `json:"masterProfile,omitempty"`
1121
1122 AgentPoolProfiles *[]AgentPoolProfile `json:"agentPoolProfiles,omitempty"`
1123
1124 WindowsProfile *WindowsProfile `json:"windowsProfile,omitempty"`
1125
1126 LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"`
1127
1128 DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"`
1129 }
1130
1131
1132 func (p Properties) MarshalJSON() ([]byte, error) {
1133 objectMap := make(map[string]interface{})
1134 if p.OrchestratorProfile != nil {
1135 objectMap["orchestratorProfile"] = p.OrchestratorProfile
1136 }
1137 if p.CustomProfile != nil {
1138 objectMap["customProfile"] = p.CustomProfile
1139 }
1140 if p.ServicePrincipalProfile != nil {
1141 objectMap["servicePrincipalProfile"] = p.ServicePrincipalProfile
1142 }
1143 if p.MasterProfile != nil {
1144 objectMap["masterProfile"] = p.MasterProfile
1145 }
1146 if p.AgentPoolProfiles != nil {
1147 objectMap["agentPoolProfiles"] = p.AgentPoolProfiles
1148 }
1149 if p.WindowsProfile != nil {
1150 objectMap["windowsProfile"] = p.WindowsProfile
1151 }
1152 if p.LinuxProfile != nil {
1153 objectMap["linuxProfile"] = p.LinuxProfile
1154 }
1155 if p.DiagnosticsProfile != nil {
1156 objectMap["diagnosticsProfile"] = p.DiagnosticsProfile
1157 }
1158 return json.Marshal(objectMap)
1159 }
1160
1161
1162 type Resource struct {
1163
1164 ID *string `json:"id,omitempty"`
1165
1166 Name *string `json:"name,omitempty"`
1167
1168 Type *string `json:"type,omitempty"`
1169
1170 Location *string `json:"location,omitempty"`
1171
1172 Tags map[string]*string `json:"tags"`
1173 }
1174
1175
1176 func (r Resource) MarshalJSON() ([]byte, error) {
1177 objectMap := make(map[string]interface{})
1178 if r.Location != nil {
1179 objectMap["location"] = r.Location
1180 }
1181 if r.Tags != nil {
1182 objectMap["tags"] = r.Tags
1183 }
1184 return json.Marshal(objectMap)
1185 }
1186
1187
1188
1189 type ServicePrincipalProfile struct {
1190
1191 ClientID *string `json:"clientId,omitempty"`
1192
1193 Secret *string `json:"secret,omitempty"`
1194
1195 KeyVaultSecretRef *KeyVaultSecretRef `json:"keyVaultSecretRef,omitempty"`
1196 }
1197
1198
1199 type SSHConfiguration struct {
1200
1201 PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"`
1202 }
1203
1204
1205 type SSHPublicKey struct {
1206
1207 KeyData *string `json:"keyData,omitempty"`
1208 }
1209
1210
1211 type VMDiagnostics struct {
1212
1213 Enabled *bool `json:"enabled,omitempty"`
1214
1215 StorageURI *string `json:"storageUri,omitempty"`
1216 }
1217
1218
1219 func (vd VMDiagnostics) MarshalJSON() ([]byte, error) {
1220 objectMap := make(map[string]interface{})
1221 if vd.Enabled != nil {
1222 objectMap["enabled"] = vd.Enabled
1223 }
1224 return json.Marshal(objectMap)
1225 }
1226
1227
1228 type WindowsProfile struct {
1229
1230 AdminUsername *string `json:"adminUsername,omitempty"`
1231
1232 AdminPassword *string `json:"adminPassword,omitempty"`
1233 }
1234
View as plain text