1 package mysqlflexibleservers
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/mysql/mgmt/2021-05-01/mysqlflexibleservers"
22
23
24 type AzureEntityResource struct {
25
26 Etag *string `json:"etag,omitempty"`
27
28 ID *string `json:"id,omitempty"`
29
30 Name *string `json:"name,omitempty"`
31
32 Type *string `json:"type,omitempty"`
33 }
34
35
36 func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
37 objectMap := make(map[string]interface{})
38 return json.Marshal(objectMap)
39 }
40
41
42 type Backup struct {
43
44 BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
45
46 GeoRedundantBackup EnableStatusEnum `json:"geoRedundantBackup,omitempty"`
47
48 EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"`
49 }
50
51
52 func (b Backup) MarshalJSON() ([]byte, error) {
53 objectMap := make(map[string]interface{})
54 if b.BackupRetentionDays != nil {
55 objectMap["backupRetentionDays"] = b.BackupRetentionDays
56 }
57 if b.GeoRedundantBackup != "" {
58 objectMap["geoRedundantBackup"] = b.GeoRedundantBackup
59 }
60 return json.Marshal(objectMap)
61 }
62
63
64 type CapabilitiesListResult struct {
65 autorest.Response `json:"-"`
66
67 Value *[]CapabilityProperties `json:"value,omitempty"`
68
69 NextLink *string `json:"nextLink,omitempty"`
70 }
71
72
73 func (clr CapabilitiesListResult) MarshalJSON() ([]byte, error) {
74 objectMap := make(map[string]interface{})
75 return json.Marshal(objectMap)
76 }
77
78
79 type CapabilitiesListResultIterator struct {
80 i int
81 page CapabilitiesListResultPage
82 }
83
84
85
86 func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) {
87 if tracing.IsEnabled() {
88 ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext")
89 defer func() {
90 sc := -1
91 if iter.Response().Response.Response != nil {
92 sc = iter.Response().Response.Response.StatusCode
93 }
94 tracing.EndSpan(ctx, sc, err)
95 }()
96 }
97 iter.i++
98 if iter.i < len(iter.page.Values()) {
99 return nil
100 }
101 err = iter.page.NextWithContext(ctx)
102 if err != nil {
103 iter.i--
104 return err
105 }
106 iter.i = 0
107 return nil
108 }
109
110
111
112
113 func (iter *CapabilitiesListResultIterator) Next() error {
114 return iter.NextWithContext(context.Background())
115 }
116
117
118 func (iter CapabilitiesListResultIterator) NotDone() bool {
119 return iter.page.NotDone() && iter.i < len(iter.page.Values())
120 }
121
122
123 func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult {
124 return iter.page.Response()
125 }
126
127
128
129 func (iter CapabilitiesListResultIterator) Value() CapabilityProperties {
130 if !iter.page.NotDone() {
131 return CapabilityProperties{}
132 }
133 return iter.page.Values()[iter.i]
134 }
135
136
137 func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator {
138 return CapabilitiesListResultIterator{page: page}
139 }
140
141
142 func (clr CapabilitiesListResult) IsEmpty() bool {
143 return clr.Value == nil || len(*clr.Value) == 0
144 }
145
146
147 func (clr CapabilitiesListResult) hasNextLink() bool {
148 return clr.NextLink != nil && len(*clr.NextLink) != 0
149 }
150
151
152
153 func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) {
154 if !clr.hasNextLink() {
155 return nil, nil
156 }
157 return autorest.Prepare((&http.Request{}).WithContext(ctx),
158 autorest.AsJSON(),
159 autorest.AsGet(),
160 autorest.WithBaseURL(to.String(clr.NextLink)))
161 }
162
163
164 type CapabilitiesListResultPage struct {
165 fn func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)
166 clr CapabilitiesListResult
167 }
168
169
170
171 func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) {
172 if tracing.IsEnabled() {
173 ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext")
174 defer func() {
175 sc := -1
176 if page.Response().Response.Response != nil {
177 sc = page.Response().Response.Response.StatusCode
178 }
179 tracing.EndSpan(ctx, sc, err)
180 }()
181 }
182 for {
183 next, err := page.fn(ctx, page.clr)
184 if err != nil {
185 return err
186 }
187 page.clr = next
188 if !next.hasNextLink() || !next.IsEmpty() {
189 break
190 }
191 }
192 return nil
193 }
194
195
196
197
198 func (page *CapabilitiesListResultPage) Next() error {
199 return page.NextWithContext(context.Background())
200 }
201
202
203 func (page CapabilitiesListResultPage) NotDone() bool {
204 return !page.clr.IsEmpty()
205 }
206
207
208 func (page CapabilitiesListResultPage) Response() CapabilitiesListResult {
209 return page.clr
210 }
211
212
213 func (page CapabilitiesListResultPage) Values() []CapabilityProperties {
214 if page.clr.IsEmpty() {
215 return nil
216 }
217 return *page.clr.Value
218 }
219
220
221 func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage {
222 return CapabilitiesListResultPage{
223 fn: getNextPage,
224 clr: cur,
225 }
226 }
227
228
229 type CapabilityProperties struct {
230
231 Zone *string `json:"zone,omitempty"`
232
233 SupportedHAMode *[]string `json:"supportedHAMode,omitempty"`
234
235 SupportedGeoBackupRegions *[]string `json:"supportedGeoBackupRegions,omitempty"`
236
237 SupportedFlexibleServerEditions *[]ServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"`
238 }
239
240
241 func (cp CapabilityProperties) MarshalJSON() ([]byte, error) {
242 objectMap := make(map[string]interface{})
243 return json.Marshal(objectMap)
244 }
245
246
247 type CloudError struct {
248
249 Error *ErrorResponse `json:"error,omitempty"`
250 }
251
252
253 type Configuration struct {
254 autorest.Response `json:"-"`
255
256 *ConfigurationProperties `json:"properties,omitempty"`
257
258 SystemData *SystemData `json:"systemData,omitempty"`
259
260 ID *string `json:"id,omitempty"`
261
262 Name *string `json:"name,omitempty"`
263
264 Type *string `json:"type,omitempty"`
265 }
266
267
268 func (c Configuration) MarshalJSON() ([]byte, error) {
269 objectMap := make(map[string]interface{})
270 if c.ConfigurationProperties != nil {
271 objectMap["properties"] = c.ConfigurationProperties
272 }
273 return json.Marshal(objectMap)
274 }
275
276
277 func (c *Configuration) UnmarshalJSON(body []byte) error {
278 var m map[string]*json.RawMessage
279 err := json.Unmarshal(body, &m)
280 if err != nil {
281 return err
282 }
283 for k, v := range m {
284 switch k {
285 case "properties":
286 if v != nil {
287 var configurationProperties ConfigurationProperties
288 err = json.Unmarshal(*v, &configurationProperties)
289 if err != nil {
290 return err
291 }
292 c.ConfigurationProperties = &configurationProperties
293 }
294 case "systemData":
295 if v != nil {
296 var systemData SystemData
297 err = json.Unmarshal(*v, &systemData)
298 if err != nil {
299 return err
300 }
301 c.SystemData = &systemData
302 }
303 case "id":
304 if v != nil {
305 var ID string
306 err = json.Unmarshal(*v, &ID)
307 if err != nil {
308 return err
309 }
310 c.ID = &ID
311 }
312 case "name":
313 if v != nil {
314 var name string
315 err = json.Unmarshal(*v, &name)
316 if err != nil {
317 return err
318 }
319 c.Name = &name
320 }
321 case "type":
322 if v != nil {
323 var typeVar string
324 err = json.Unmarshal(*v, &typeVar)
325 if err != nil {
326 return err
327 }
328 c.Type = &typeVar
329 }
330 }
331 }
332
333 return nil
334 }
335
336
337 type ConfigurationForBatchUpdate struct {
338
339 Name *string `json:"name,omitempty"`
340
341 *ConfigurationForBatchUpdateProperties `json:"properties,omitempty"`
342 }
343
344
345 func (cfbu ConfigurationForBatchUpdate) MarshalJSON() ([]byte, error) {
346 objectMap := make(map[string]interface{})
347 if cfbu.Name != nil {
348 objectMap["name"] = cfbu.Name
349 }
350 if cfbu.ConfigurationForBatchUpdateProperties != nil {
351 objectMap["properties"] = cfbu.ConfigurationForBatchUpdateProperties
352 }
353 return json.Marshal(objectMap)
354 }
355
356
357 func (cfbu *ConfigurationForBatchUpdate) UnmarshalJSON(body []byte) error {
358 var m map[string]*json.RawMessage
359 err := json.Unmarshal(body, &m)
360 if err != nil {
361 return err
362 }
363 for k, v := range m {
364 switch k {
365 case "name":
366 if v != nil {
367 var name string
368 err = json.Unmarshal(*v, &name)
369 if err != nil {
370 return err
371 }
372 cfbu.Name = &name
373 }
374 case "properties":
375 if v != nil {
376 var configurationForBatchUpdateProperties ConfigurationForBatchUpdateProperties
377 err = json.Unmarshal(*v, &configurationForBatchUpdateProperties)
378 if err != nil {
379 return err
380 }
381 cfbu.ConfigurationForBatchUpdateProperties = &configurationForBatchUpdateProperties
382 }
383 }
384 }
385
386 return nil
387 }
388
389
390 type ConfigurationForBatchUpdateProperties struct {
391
392 Value *string `json:"value,omitempty"`
393
394 Source *string `json:"source,omitempty"`
395 }
396
397
398 type ConfigurationListForBatchUpdate struct {
399
400 Value *[]ConfigurationForBatchUpdate `json:"value,omitempty"`
401 }
402
403
404 type ConfigurationListResult struct {
405 autorest.Response `json:"-"`
406
407 Value *[]Configuration `json:"value,omitempty"`
408
409 NextLink *string `json:"nextLink,omitempty"`
410 }
411
412
413 type ConfigurationListResultIterator struct {
414 i int
415 page ConfigurationListResultPage
416 }
417
418
419
420 func (iter *ConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) {
421 if tracing.IsEnabled() {
422 ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultIterator.NextWithContext")
423 defer func() {
424 sc := -1
425 if iter.Response().Response.Response != nil {
426 sc = iter.Response().Response.Response.StatusCode
427 }
428 tracing.EndSpan(ctx, sc, err)
429 }()
430 }
431 iter.i++
432 if iter.i < len(iter.page.Values()) {
433 return nil
434 }
435 err = iter.page.NextWithContext(ctx)
436 if err != nil {
437 iter.i--
438 return err
439 }
440 iter.i = 0
441 return nil
442 }
443
444
445
446
447 func (iter *ConfigurationListResultIterator) Next() error {
448 return iter.NextWithContext(context.Background())
449 }
450
451
452 func (iter ConfigurationListResultIterator) NotDone() bool {
453 return iter.page.NotDone() && iter.i < len(iter.page.Values())
454 }
455
456
457 func (iter ConfigurationListResultIterator) Response() ConfigurationListResult {
458 return iter.page.Response()
459 }
460
461
462
463 func (iter ConfigurationListResultIterator) Value() Configuration {
464 if !iter.page.NotDone() {
465 return Configuration{}
466 }
467 return iter.page.Values()[iter.i]
468 }
469
470
471 func NewConfigurationListResultIterator(page ConfigurationListResultPage) ConfigurationListResultIterator {
472 return ConfigurationListResultIterator{page: page}
473 }
474
475
476 func (clr ConfigurationListResult) IsEmpty() bool {
477 return clr.Value == nil || len(*clr.Value) == 0
478 }
479
480
481 func (clr ConfigurationListResult) hasNextLink() bool {
482 return clr.NextLink != nil && len(*clr.NextLink) != 0
483 }
484
485
486
487 func (clr ConfigurationListResult) configurationListResultPreparer(ctx context.Context) (*http.Request, error) {
488 if !clr.hasNextLink() {
489 return nil, nil
490 }
491 return autorest.Prepare((&http.Request{}).WithContext(ctx),
492 autorest.AsJSON(),
493 autorest.AsGet(),
494 autorest.WithBaseURL(to.String(clr.NextLink)))
495 }
496
497
498 type ConfigurationListResultPage struct {
499 fn func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)
500 clr ConfigurationListResult
501 }
502
503
504
505 func (page *ConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) {
506 if tracing.IsEnabled() {
507 ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultPage.NextWithContext")
508 defer func() {
509 sc := -1
510 if page.Response().Response.Response != nil {
511 sc = page.Response().Response.Response.StatusCode
512 }
513 tracing.EndSpan(ctx, sc, err)
514 }()
515 }
516 for {
517 next, err := page.fn(ctx, page.clr)
518 if err != nil {
519 return err
520 }
521 page.clr = next
522 if !next.hasNextLink() || !next.IsEmpty() {
523 break
524 }
525 }
526 return nil
527 }
528
529
530
531
532 func (page *ConfigurationListResultPage) Next() error {
533 return page.NextWithContext(context.Background())
534 }
535
536
537 func (page ConfigurationListResultPage) NotDone() bool {
538 return !page.clr.IsEmpty()
539 }
540
541
542 func (page ConfigurationListResultPage) Response() ConfigurationListResult {
543 return page.clr
544 }
545
546
547 func (page ConfigurationListResultPage) Values() []Configuration {
548 if page.clr.IsEmpty() {
549 return nil
550 }
551 return *page.clr.Value
552 }
553
554
555 func NewConfigurationListResultPage(cur ConfigurationListResult, getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage {
556 return ConfigurationListResultPage{
557 fn: getNextPage,
558 clr: cur,
559 }
560 }
561
562
563 type ConfigurationProperties struct {
564
565 Value *string `json:"value,omitempty"`
566
567 Description *string `json:"description,omitempty"`
568
569 DefaultValue *string `json:"defaultValue,omitempty"`
570
571 DataType *string `json:"dataType,omitempty"`
572
573 AllowedValues *string `json:"allowedValues,omitempty"`
574
575 Source ConfigurationSource `json:"source,omitempty"`
576
577 IsReadOnly IsReadOnly `json:"isReadOnly,omitempty"`
578
579 IsConfigPendingRestart IsConfigPendingRestart `json:"isConfigPendingRestart,omitempty"`
580
581 IsDynamicConfig IsDynamicConfig `json:"isDynamicConfig,omitempty"`
582 }
583
584
585 func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) {
586 objectMap := make(map[string]interface{})
587 if cp.Value != nil {
588 objectMap["value"] = cp.Value
589 }
590 if cp.Source != "" {
591 objectMap["source"] = cp.Source
592 }
593 return json.Marshal(objectMap)
594 }
595
596
597
598 type ConfigurationsBatchUpdateFuture struct {
599 azure.FutureAPI
600
601
602 Result func(ConfigurationsClient) (ConfigurationListResult, error)
603 }
604
605
606 func (future *ConfigurationsBatchUpdateFuture) UnmarshalJSON(body []byte) error {
607 var azFuture azure.Future
608 if err := json.Unmarshal(body, &azFuture); err != nil {
609 return err
610 }
611 future.FutureAPI = &azFuture
612 future.Result = future.result
613 return nil
614 }
615
616
617 func (future *ConfigurationsBatchUpdateFuture) result(client ConfigurationsClient) (clr ConfigurationListResult, err error) {
618 var done bool
619 done, err = future.DoneWithContext(context.Background(), client)
620 if err != nil {
621 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsBatchUpdateFuture", "Result", future.Response(), "Polling failure")
622 return
623 }
624 if !done {
625 clr.Response.Response = future.Response()
626 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ConfigurationsBatchUpdateFuture")
627 return
628 }
629 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
630 if clr.Response.Response, err = future.GetResult(sender); err == nil && clr.Response.Response.StatusCode != http.StatusNoContent {
631 clr, err = client.BatchUpdateResponder(clr.Response.Response)
632 if err != nil {
633 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsBatchUpdateFuture", "Result", clr.Response.Response, "Failure responding to request")
634 }
635 }
636 return
637 }
638
639
640
641 type ConfigurationsUpdateFuture struct {
642 azure.FutureAPI
643
644
645 Result func(ConfigurationsClient) (Configuration, error)
646 }
647
648
649 func (future *ConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error {
650 var azFuture azure.Future
651 if err := json.Unmarshal(body, &azFuture); err != nil {
652 return err
653 }
654 future.FutureAPI = &azFuture
655 future.Result = future.result
656 return nil
657 }
658
659
660 func (future *ConfigurationsUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) {
661 var done bool
662 done, err = future.DoneWithContext(context.Background(), client)
663 if err != nil {
664 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure")
665 return
666 }
667 if !done {
668 c.Response.Response = future.Response()
669 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ConfigurationsUpdateFuture")
670 return
671 }
672 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
673 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
674 c, err = client.UpdateResponder(c.Response.Response)
675 if err != nil {
676 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
677 }
678 }
679 return
680 }
681
682
683 type Database struct {
684 autorest.Response `json:"-"`
685
686 *DatabaseProperties `json:"properties,omitempty"`
687
688 SystemData *SystemData `json:"systemData,omitempty"`
689
690 ID *string `json:"id,omitempty"`
691
692 Name *string `json:"name,omitempty"`
693
694 Type *string `json:"type,omitempty"`
695 }
696
697
698 func (d Database) MarshalJSON() ([]byte, error) {
699 objectMap := make(map[string]interface{})
700 if d.DatabaseProperties != nil {
701 objectMap["properties"] = d.DatabaseProperties
702 }
703 return json.Marshal(objectMap)
704 }
705
706
707 func (d *Database) UnmarshalJSON(body []byte) error {
708 var m map[string]*json.RawMessage
709 err := json.Unmarshal(body, &m)
710 if err != nil {
711 return err
712 }
713 for k, v := range m {
714 switch k {
715 case "properties":
716 if v != nil {
717 var databaseProperties DatabaseProperties
718 err = json.Unmarshal(*v, &databaseProperties)
719 if err != nil {
720 return err
721 }
722 d.DatabaseProperties = &databaseProperties
723 }
724 case "systemData":
725 if v != nil {
726 var systemData SystemData
727 err = json.Unmarshal(*v, &systemData)
728 if err != nil {
729 return err
730 }
731 d.SystemData = &systemData
732 }
733 case "id":
734 if v != nil {
735 var ID string
736 err = json.Unmarshal(*v, &ID)
737 if err != nil {
738 return err
739 }
740 d.ID = &ID
741 }
742 case "name":
743 if v != nil {
744 var name string
745 err = json.Unmarshal(*v, &name)
746 if err != nil {
747 return err
748 }
749 d.Name = &name
750 }
751 case "type":
752 if v != nil {
753 var typeVar string
754 err = json.Unmarshal(*v, &typeVar)
755 if err != nil {
756 return err
757 }
758 d.Type = &typeVar
759 }
760 }
761 }
762
763 return nil
764 }
765
766
767 type DatabaseListResult struct {
768 autorest.Response `json:"-"`
769
770 Value *[]Database `json:"value,omitempty"`
771
772 NextLink *string `json:"nextLink,omitempty"`
773 }
774
775
776 type DatabaseListResultIterator struct {
777 i int
778 page DatabaseListResultPage
779 }
780
781
782
783 func (iter *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) {
784 if tracing.IsEnabled() {
785 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.NextWithContext")
786 defer func() {
787 sc := -1
788 if iter.Response().Response.Response != nil {
789 sc = iter.Response().Response.Response.StatusCode
790 }
791 tracing.EndSpan(ctx, sc, err)
792 }()
793 }
794 iter.i++
795 if iter.i < len(iter.page.Values()) {
796 return nil
797 }
798 err = iter.page.NextWithContext(ctx)
799 if err != nil {
800 iter.i--
801 return err
802 }
803 iter.i = 0
804 return nil
805 }
806
807
808
809
810 func (iter *DatabaseListResultIterator) Next() error {
811 return iter.NextWithContext(context.Background())
812 }
813
814
815 func (iter DatabaseListResultIterator) NotDone() bool {
816 return iter.page.NotDone() && iter.i < len(iter.page.Values())
817 }
818
819
820 func (iter DatabaseListResultIterator) Response() DatabaseListResult {
821 return iter.page.Response()
822 }
823
824
825
826 func (iter DatabaseListResultIterator) Value() Database {
827 if !iter.page.NotDone() {
828 return Database{}
829 }
830 return iter.page.Values()[iter.i]
831 }
832
833
834 func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator {
835 return DatabaseListResultIterator{page: page}
836 }
837
838
839 func (dlr DatabaseListResult) IsEmpty() bool {
840 return dlr.Value == nil || len(*dlr.Value) == 0
841 }
842
843
844 func (dlr DatabaseListResult) hasNextLink() bool {
845 return dlr.NextLink != nil && len(*dlr.NextLink) != 0
846 }
847
848
849
850 func (dlr DatabaseListResult) databaseListResultPreparer(ctx context.Context) (*http.Request, error) {
851 if !dlr.hasNextLink() {
852 return nil, nil
853 }
854 return autorest.Prepare((&http.Request{}).WithContext(ctx),
855 autorest.AsJSON(),
856 autorest.AsGet(),
857 autorest.WithBaseURL(to.String(dlr.NextLink)))
858 }
859
860
861 type DatabaseListResultPage struct {
862 fn func(context.Context, DatabaseListResult) (DatabaseListResult, error)
863 dlr DatabaseListResult
864 }
865
866
867
868 func (page *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) {
869 if tracing.IsEnabled() {
870 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.NextWithContext")
871 defer func() {
872 sc := -1
873 if page.Response().Response.Response != nil {
874 sc = page.Response().Response.Response.StatusCode
875 }
876 tracing.EndSpan(ctx, sc, err)
877 }()
878 }
879 for {
880 next, err := page.fn(ctx, page.dlr)
881 if err != nil {
882 return err
883 }
884 page.dlr = next
885 if !next.hasNextLink() || !next.IsEmpty() {
886 break
887 }
888 }
889 return nil
890 }
891
892
893
894
895 func (page *DatabaseListResultPage) Next() error {
896 return page.NextWithContext(context.Background())
897 }
898
899
900 func (page DatabaseListResultPage) NotDone() bool {
901 return !page.dlr.IsEmpty()
902 }
903
904
905 func (page DatabaseListResultPage) Response() DatabaseListResult {
906 return page.dlr
907 }
908
909
910 func (page DatabaseListResultPage) Values() []Database {
911 if page.dlr.IsEmpty() {
912 return nil
913 }
914 return *page.dlr.Value
915 }
916
917
918 func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage {
919 return DatabaseListResultPage{
920 fn: getNextPage,
921 dlr: cur,
922 }
923 }
924
925
926 type DatabaseProperties struct {
927
928 Charset *string `json:"charset,omitempty"`
929
930 Collation *string `json:"collation,omitempty"`
931 }
932
933
934
935 type DatabasesCreateOrUpdateFuture struct {
936 azure.FutureAPI
937
938
939 Result func(DatabasesClient) (Database, error)
940 }
941
942
943 func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
944 var azFuture azure.Future
945 if err := json.Unmarshal(body, &azFuture); err != nil {
946 return err
947 }
948 future.FutureAPI = &azFuture
949 future.Result = future.result
950 return nil
951 }
952
953
954 func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) {
955 var done bool
956 done, err = future.DoneWithContext(context.Background(), client)
957 if err != nil {
958 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
959 return
960 }
961 if !done {
962 d.Response.Response = future.Response()
963 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.DatabasesCreateOrUpdateFuture")
964 return
965 }
966 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
967 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
968 d, err = client.CreateOrUpdateResponder(d.Response.Response)
969 if err != nil {
970 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request")
971 }
972 }
973 return
974 }
975
976
977
978 type DatabasesDeleteFuture struct {
979 azure.FutureAPI
980
981
982 Result func(DatabasesClient) (autorest.Response, error)
983 }
984
985
986 func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error {
987 var azFuture azure.Future
988 if err := json.Unmarshal(body, &azFuture); err != nil {
989 return err
990 }
991 future.FutureAPI = &azFuture
992 future.Result = future.result
993 return nil
994 }
995
996
997 func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) {
998 var done bool
999 done, err = future.DoneWithContext(context.Background(), client)
1000 if err != nil {
1001 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
1002 return
1003 }
1004 if !done {
1005 ar.Response = future.Response()
1006 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.DatabasesDeleteFuture")
1007 return
1008 }
1009 ar.Response = future.Response()
1010 return
1011 }
1012
1013
1014 type DelegatedSubnetUsage struct {
1015
1016 SubnetName *string `json:"subnetName,omitempty"`
1017
1018 Usage *int64 `json:"usage,omitempty"`
1019 }
1020
1021
1022 func (dsu DelegatedSubnetUsage) MarshalJSON() ([]byte, error) {
1023 objectMap := make(map[string]interface{})
1024 return json.Marshal(objectMap)
1025 }
1026
1027
1028 type ErrorAdditionalInfo struct {
1029
1030 Type *string `json:"type,omitempty"`
1031
1032 Info interface{} `json:"info,omitempty"`
1033 }
1034
1035
1036 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
1037 objectMap := make(map[string]interface{})
1038 return json.Marshal(objectMap)
1039 }
1040
1041
1042
1043 type ErrorResponse struct {
1044
1045 Code *string `json:"code,omitempty"`
1046
1047 Message *string `json:"message,omitempty"`
1048
1049 Target *string `json:"target,omitempty"`
1050
1051 Details *[]ErrorResponse `json:"details,omitempty"`
1052
1053 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
1054 }
1055
1056
1057 func (er ErrorResponse) MarshalJSON() ([]byte, error) {
1058 objectMap := make(map[string]interface{})
1059 return json.Marshal(objectMap)
1060 }
1061
1062
1063 type FirewallRule struct {
1064 autorest.Response `json:"-"`
1065
1066 *FirewallRuleProperties `json:"properties,omitempty"`
1067
1068 SystemData *SystemData `json:"systemData,omitempty"`
1069
1070 ID *string `json:"id,omitempty"`
1071
1072 Name *string `json:"name,omitempty"`
1073
1074 Type *string `json:"type,omitempty"`
1075 }
1076
1077
1078 func (fr FirewallRule) MarshalJSON() ([]byte, error) {
1079 objectMap := make(map[string]interface{})
1080 if fr.FirewallRuleProperties != nil {
1081 objectMap["properties"] = fr.FirewallRuleProperties
1082 }
1083 return json.Marshal(objectMap)
1084 }
1085
1086
1087 func (fr *FirewallRule) UnmarshalJSON(body []byte) error {
1088 var m map[string]*json.RawMessage
1089 err := json.Unmarshal(body, &m)
1090 if err != nil {
1091 return err
1092 }
1093 for k, v := range m {
1094 switch k {
1095 case "properties":
1096 if v != nil {
1097 var firewallRuleProperties FirewallRuleProperties
1098 err = json.Unmarshal(*v, &firewallRuleProperties)
1099 if err != nil {
1100 return err
1101 }
1102 fr.FirewallRuleProperties = &firewallRuleProperties
1103 }
1104 case "systemData":
1105 if v != nil {
1106 var systemData SystemData
1107 err = json.Unmarshal(*v, &systemData)
1108 if err != nil {
1109 return err
1110 }
1111 fr.SystemData = &systemData
1112 }
1113 case "id":
1114 if v != nil {
1115 var ID string
1116 err = json.Unmarshal(*v, &ID)
1117 if err != nil {
1118 return err
1119 }
1120 fr.ID = &ID
1121 }
1122 case "name":
1123 if v != nil {
1124 var name string
1125 err = json.Unmarshal(*v, &name)
1126 if err != nil {
1127 return err
1128 }
1129 fr.Name = &name
1130 }
1131 case "type":
1132 if v != nil {
1133 var typeVar string
1134 err = json.Unmarshal(*v, &typeVar)
1135 if err != nil {
1136 return err
1137 }
1138 fr.Type = &typeVar
1139 }
1140 }
1141 }
1142
1143 return nil
1144 }
1145
1146
1147 type FirewallRuleListResult struct {
1148 autorest.Response `json:"-"`
1149
1150 Value *[]FirewallRule `json:"value,omitempty"`
1151
1152 NextLink *string `json:"nextLink,omitempty"`
1153 }
1154
1155
1156 type FirewallRuleListResultIterator struct {
1157 i int
1158 page FirewallRuleListResultPage
1159 }
1160
1161
1162
1163 func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
1164 if tracing.IsEnabled() {
1165 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext")
1166 defer func() {
1167 sc := -1
1168 if iter.Response().Response.Response != nil {
1169 sc = iter.Response().Response.Response.StatusCode
1170 }
1171 tracing.EndSpan(ctx, sc, err)
1172 }()
1173 }
1174 iter.i++
1175 if iter.i < len(iter.page.Values()) {
1176 return nil
1177 }
1178 err = iter.page.NextWithContext(ctx)
1179 if err != nil {
1180 iter.i--
1181 return err
1182 }
1183 iter.i = 0
1184 return nil
1185 }
1186
1187
1188
1189
1190 func (iter *FirewallRuleListResultIterator) Next() error {
1191 return iter.NextWithContext(context.Background())
1192 }
1193
1194
1195 func (iter FirewallRuleListResultIterator) NotDone() bool {
1196 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1197 }
1198
1199
1200 func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult {
1201 return iter.page.Response()
1202 }
1203
1204
1205
1206 func (iter FirewallRuleListResultIterator) Value() FirewallRule {
1207 if !iter.page.NotDone() {
1208 return FirewallRule{}
1209 }
1210 return iter.page.Values()[iter.i]
1211 }
1212
1213
1214 func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator {
1215 return FirewallRuleListResultIterator{page: page}
1216 }
1217
1218
1219 func (frlr FirewallRuleListResult) IsEmpty() bool {
1220 return frlr.Value == nil || len(*frlr.Value) == 0
1221 }
1222
1223
1224 func (frlr FirewallRuleListResult) hasNextLink() bool {
1225 return frlr.NextLink != nil && len(*frlr.NextLink) != 0
1226 }
1227
1228
1229
1230 func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
1231 if !frlr.hasNextLink() {
1232 return nil, nil
1233 }
1234 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1235 autorest.AsJSON(),
1236 autorest.AsGet(),
1237 autorest.WithBaseURL(to.String(frlr.NextLink)))
1238 }
1239
1240
1241 type FirewallRuleListResultPage struct {
1242 fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)
1243 frlr FirewallRuleListResult
1244 }
1245
1246
1247
1248 func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
1249 if tracing.IsEnabled() {
1250 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext")
1251 defer func() {
1252 sc := -1
1253 if page.Response().Response.Response != nil {
1254 sc = page.Response().Response.Response.StatusCode
1255 }
1256 tracing.EndSpan(ctx, sc, err)
1257 }()
1258 }
1259 for {
1260 next, err := page.fn(ctx, page.frlr)
1261 if err != nil {
1262 return err
1263 }
1264 page.frlr = next
1265 if !next.hasNextLink() || !next.IsEmpty() {
1266 break
1267 }
1268 }
1269 return nil
1270 }
1271
1272
1273
1274
1275 func (page *FirewallRuleListResultPage) Next() error {
1276 return page.NextWithContext(context.Background())
1277 }
1278
1279
1280 func (page FirewallRuleListResultPage) NotDone() bool {
1281 return !page.frlr.IsEmpty()
1282 }
1283
1284
1285 func (page FirewallRuleListResultPage) Response() FirewallRuleListResult {
1286 return page.frlr
1287 }
1288
1289
1290 func (page FirewallRuleListResultPage) Values() []FirewallRule {
1291 if page.frlr.IsEmpty() {
1292 return nil
1293 }
1294 return *page.frlr.Value
1295 }
1296
1297
1298 func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {
1299 return FirewallRuleListResultPage{
1300 fn: getNextPage,
1301 frlr: cur,
1302 }
1303 }
1304
1305
1306 type FirewallRuleProperties struct {
1307
1308 StartIPAddress *string `json:"startIpAddress,omitempty"`
1309
1310 EndIPAddress *string `json:"endIpAddress,omitempty"`
1311 }
1312
1313
1314
1315 type FirewallRulesCreateOrUpdateFuture struct {
1316 azure.FutureAPI
1317
1318
1319 Result func(FirewallRulesClient) (FirewallRule, error)
1320 }
1321
1322
1323 func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1324 var azFuture azure.Future
1325 if err := json.Unmarshal(body, &azFuture); err != nil {
1326 return err
1327 }
1328 future.FutureAPI = &azFuture
1329 future.Result = future.result
1330 return nil
1331 }
1332
1333
1334 func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) {
1335 var done bool
1336 done, err = future.DoneWithContext(context.Background(), client)
1337 if err != nil {
1338 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1339 return
1340 }
1341 if !done {
1342 fr.Response.Response = future.Response()
1343 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture")
1344 return
1345 }
1346 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1347 if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent {
1348 fr, err = client.CreateOrUpdateResponder(fr.Response.Response)
1349 if err != nil {
1350 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request")
1351 }
1352 }
1353 return
1354 }
1355
1356
1357
1358 type FirewallRulesDeleteFuture struct {
1359 azure.FutureAPI
1360
1361
1362 Result func(FirewallRulesClient) (autorest.Response, error)
1363 }
1364
1365
1366 func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error {
1367 var azFuture azure.Future
1368 if err := json.Unmarshal(body, &azFuture); err != nil {
1369 return err
1370 }
1371 future.FutureAPI = &azFuture
1372 future.Result = future.result
1373 return nil
1374 }
1375
1376
1377 func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) {
1378 var done bool
1379 done, err = future.DoneWithContext(context.Background(), client)
1380 if err != nil {
1381 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure")
1382 return
1383 }
1384 if !done {
1385 ar.Response = future.Response()
1386 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.FirewallRulesDeleteFuture")
1387 return
1388 }
1389 ar.Response = future.Response()
1390 return
1391 }
1392
1393
1394 type GetPrivateDNSZoneSuffixResponse struct {
1395 autorest.Response `json:"-"`
1396
1397 PrivateDNSZoneSuffix *string `json:"privateDnsZoneSuffix,omitempty"`
1398 }
1399
1400
1401 type HighAvailability struct {
1402
1403 Mode HighAvailabilityMode `json:"mode,omitempty"`
1404
1405 State HighAvailabilityState `json:"state,omitempty"`
1406
1407 StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"`
1408 }
1409
1410
1411 func (ha HighAvailability) MarshalJSON() ([]byte, error) {
1412 objectMap := make(map[string]interface{})
1413 if ha.Mode != "" {
1414 objectMap["mode"] = ha.Mode
1415 }
1416 if ha.StandbyAvailabilityZone != nil {
1417 objectMap["standbyAvailabilityZone"] = ha.StandbyAvailabilityZone
1418 }
1419 return json.Marshal(objectMap)
1420 }
1421
1422
1423 type MaintenanceWindow struct {
1424
1425 CustomWindow *string `json:"customWindow,omitempty"`
1426
1427 StartHour *int32 `json:"startHour,omitempty"`
1428
1429 StartMinute *int32 `json:"startMinute,omitempty"`
1430
1431 DayOfWeek *int32 `json:"dayOfWeek,omitempty"`
1432 }
1433
1434
1435 type NameAvailability struct {
1436 autorest.Response `json:"-"`
1437
1438 Message *string `json:"message,omitempty"`
1439
1440 NameAvailable *bool `json:"nameAvailable,omitempty"`
1441
1442 Reason *string `json:"reason,omitempty"`
1443 }
1444
1445
1446 type NameAvailabilityRequest struct {
1447
1448 Name *string `json:"name,omitempty"`
1449
1450 Type *string `json:"type,omitempty"`
1451 }
1452
1453
1454 type Network struct {
1455
1456 PublicNetworkAccess EnableStatusEnum `json:"publicNetworkAccess,omitempty"`
1457
1458 DelegatedSubnetResourceID *string `json:"delegatedSubnetResourceId,omitempty"`
1459
1460 PrivateDNSZoneResourceID *string `json:"privateDnsZoneResourceId,omitempty"`
1461 }
1462
1463
1464 func (n Network) MarshalJSON() ([]byte, error) {
1465 objectMap := make(map[string]interface{})
1466 if n.DelegatedSubnetResourceID != nil {
1467 objectMap["delegatedSubnetResourceId"] = n.DelegatedSubnetResourceID
1468 }
1469 if n.PrivateDNSZoneResourceID != nil {
1470 objectMap["privateDnsZoneResourceId"] = n.PrivateDNSZoneResourceID
1471 }
1472 return json.Marshal(objectMap)
1473 }
1474
1475
1476 type Operation struct {
1477
1478 Name *string `json:"name,omitempty"`
1479
1480 Display *OperationDisplay `json:"display,omitempty"`
1481
1482 Origin *string `json:"origin,omitempty"`
1483
1484 Properties map[string]interface{} `json:"properties"`
1485 }
1486
1487
1488 func (o Operation) MarshalJSON() ([]byte, error) {
1489 objectMap := make(map[string]interface{})
1490 if o.Name != nil {
1491 objectMap["name"] = o.Name
1492 }
1493 if o.Display != nil {
1494 objectMap["display"] = o.Display
1495 }
1496 if o.Origin != nil {
1497 objectMap["origin"] = o.Origin
1498 }
1499 if o.Properties != nil {
1500 objectMap["properties"] = o.Properties
1501 }
1502 return json.Marshal(objectMap)
1503 }
1504
1505
1506 type OperationDisplay struct {
1507
1508 Provider *string `json:"provider,omitempty"`
1509
1510 Resource *string `json:"resource,omitempty"`
1511
1512 Operation *string `json:"operation,omitempty"`
1513
1514 Description *string `json:"description,omitempty"`
1515 }
1516
1517
1518 type OperationListResult struct {
1519 autorest.Response `json:"-"`
1520
1521 Value *[]Operation `json:"value,omitempty"`
1522
1523 NextLink *string `json:"nextLink,omitempty"`
1524 }
1525
1526
1527 type OperationListResultIterator struct {
1528 i int
1529 page OperationListResultPage
1530 }
1531
1532
1533
1534 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1535 if tracing.IsEnabled() {
1536 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
1537 defer func() {
1538 sc := -1
1539 if iter.Response().Response.Response != nil {
1540 sc = iter.Response().Response.Response.StatusCode
1541 }
1542 tracing.EndSpan(ctx, sc, err)
1543 }()
1544 }
1545 iter.i++
1546 if iter.i < len(iter.page.Values()) {
1547 return nil
1548 }
1549 err = iter.page.NextWithContext(ctx)
1550 if err != nil {
1551 iter.i--
1552 return err
1553 }
1554 iter.i = 0
1555 return nil
1556 }
1557
1558
1559
1560
1561 func (iter *OperationListResultIterator) Next() error {
1562 return iter.NextWithContext(context.Background())
1563 }
1564
1565
1566 func (iter OperationListResultIterator) NotDone() bool {
1567 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1568 }
1569
1570
1571 func (iter OperationListResultIterator) Response() OperationListResult {
1572 return iter.page.Response()
1573 }
1574
1575
1576
1577 func (iter OperationListResultIterator) Value() Operation {
1578 if !iter.page.NotDone() {
1579 return Operation{}
1580 }
1581 return iter.page.Values()[iter.i]
1582 }
1583
1584
1585 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
1586 return OperationListResultIterator{page: page}
1587 }
1588
1589
1590 func (olr OperationListResult) IsEmpty() bool {
1591 return olr.Value == nil || len(*olr.Value) == 0
1592 }
1593
1594
1595 func (olr OperationListResult) hasNextLink() bool {
1596 return olr.NextLink != nil && len(*olr.NextLink) != 0
1597 }
1598
1599
1600
1601 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
1602 if !olr.hasNextLink() {
1603 return nil, nil
1604 }
1605 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1606 autorest.AsJSON(),
1607 autorest.AsGet(),
1608 autorest.WithBaseURL(to.String(olr.NextLink)))
1609 }
1610
1611
1612 type OperationListResultPage struct {
1613 fn func(context.Context, OperationListResult) (OperationListResult, error)
1614 olr OperationListResult
1615 }
1616
1617
1618
1619 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
1620 if tracing.IsEnabled() {
1621 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
1622 defer func() {
1623 sc := -1
1624 if page.Response().Response.Response != nil {
1625 sc = page.Response().Response.Response.StatusCode
1626 }
1627 tracing.EndSpan(ctx, sc, err)
1628 }()
1629 }
1630 for {
1631 next, err := page.fn(ctx, page.olr)
1632 if err != nil {
1633 return err
1634 }
1635 page.olr = next
1636 if !next.hasNextLink() || !next.IsEmpty() {
1637 break
1638 }
1639 }
1640 return nil
1641 }
1642
1643
1644
1645
1646 func (page *OperationListResultPage) Next() error {
1647 return page.NextWithContext(context.Background())
1648 }
1649
1650
1651 func (page OperationListResultPage) NotDone() bool {
1652 return !page.olr.IsEmpty()
1653 }
1654
1655
1656 func (page OperationListResultPage) Response() OperationListResult {
1657 return page.olr
1658 }
1659
1660
1661 func (page OperationListResultPage) Values() []Operation {
1662 if page.olr.IsEmpty() {
1663 return nil
1664 }
1665 return *page.olr.Value
1666 }
1667
1668
1669 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1670 return OperationListResultPage{
1671 fn: getNextPage,
1672 olr: cur,
1673 }
1674 }
1675
1676
1677
1678 type ProxyResource struct {
1679
1680 ID *string `json:"id,omitempty"`
1681
1682 Name *string `json:"name,omitempty"`
1683
1684 Type *string `json:"type,omitempty"`
1685 }
1686
1687
1688 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1689 objectMap := make(map[string]interface{})
1690 return json.Marshal(objectMap)
1691 }
1692
1693
1694 type Resource struct {
1695
1696 ID *string `json:"id,omitempty"`
1697
1698 Name *string `json:"name,omitempty"`
1699
1700 Type *string `json:"type,omitempty"`
1701 }
1702
1703
1704 func (r Resource) MarshalJSON() ([]byte, error) {
1705 objectMap := make(map[string]interface{})
1706 return json.Marshal(objectMap)
1707 }
1708
1709
1710 type Server struct {
1711 autorest.Response `json:"-"`
1712
1713 Sku *Sku `json:"sku,omitempty"`
1714
1715 *ServerProperties `json:"properties,omitempty"`
1716
1717 SystemData *SystemData `json:"systemData,omitempty"`
1718
1719 Tags map[string]*string `json:"tags"`
1720
1721 Location *string `json:"location,omitempty"`
1722
1723 ID *string `json:"id,omitempty"`
1724
1725 Name *string `json:"name,omitempty"`
1726
1727 Type *string `json:"type,omitempty"`
1728 }
1729
1730
1731 func (s Server) MarshalJSON() ([]byte, error) {
1732 objectMap := make(map[string]interface{})
1733 if s.Sku != nil {
1734 objectMap["sku"] = s.Sku
1735 }
1736 if s.ServerProperties != nil {
1737 objectMap["properties"] = s.ServerProperties
1738 }
1739 if s.Tags != nil {
1740 objectMap["tags"] = s.Tags
1741 }
1742 if s.Location != nil {
1743 objectMap["location"] = s.Location
1744 }
1745 return json.Marshal(objectMap)
1746 }
1747
1748
1749 func (s *Server) UnmarshalJSON(body []byte) error {
1750 var m map[string]*json.RawMessage
1751 err := json.Unmarshal(body, &m)
1752 if err != nil {
1753 return err
1754 }
1755 for k, v := range m {
1756 switch k {
1757 case "sku":
1758 if v != nil {
1759 var sku Sku
1760 err = json.Unmarshal(*v, &sku)
1761 if err != nil {
1762 return err
1763 }
1764 s.Sku = &sku
1765 }
1766 case "properties":
1767 if v != nil {
1768 var serverProperties ServerProperties
1769 err = json.Unmarshal(*v, &serverProperties)
1770 if err != nil {
1771 return err
1772 }
1773 s.ServerProperties = &serverProperties
1774 }
1775 case "systemData":
1776 if v != nil {
1777 var systemData SystemData
1778 err = json.Unmarshal(*v, &systemData)
1779 if err != nil {
1780 return err
1781 }
1782 s.SystemData = &systemData
1783 }
1784 case "tags":
1785 if v != nil {
1786 var tags map[string]*string
1787 err = json.Unmarshal(*v, &tags)
1788 if err != nil {
1789 return err
1790 }
1791 s.Tags = tags
1792 }
1793 case "location":
1794 if v != nil {
1795 var location string
1796 err = json.Unmarshal(*v, &location)
1797 if err != nil {
1798 return err
1799 }
1800 s.Location = &location
1801 }
1802 case "id":
1803 if v != nil {
1804 var ID string
1805 err = json.Unmarshal(*v, &ID)
1806 if err != nil {
1807 return err
1808 }
1809 s.ID = &ID
1810 }
1811 case "name":
1812 if v != nil {
1813 var name string
1814 err = json.Unmarshal(*v, &name)
1815 if err != nil {
1816 return err
1817 }
1818 s.Name = &name
1819 }
1820 case "type":
1821 if v != nil {
1822 var typeVar string
1823 err = json.Unmarshal(*v, &typeVar)
1824 if err != nil {
1825 return err
1826 }
1827 s.Type = &typeVar
1828 }
1829 }
1830 }
1831
1832 return nil
1833 }
1834
1835
1836 type ServerBackup struct {
1837 autorest.Response `json:"-"`
1838
1839 *ServerBackupProperties `json:"properties,omitempty"`
1840
1841 SystemData *SystemData `json:"systemData,omitempty"`
1842
1843 ID *string `json:"id,omitempty"`
1844
1845 Name *string `json:"name,omitempty"`
1846
1847 Type *string `json:"type,omitempty"`
1848 }
1849
1850
1851 func (sb ServerBackup) MarshalJSON() ([]byte, error) {
1852 objectMap := make(map[string]interface{})
1853 if sb.ServerBackupProperties != nil {
1854 objectMap["properties"] = sb.ServerBackupProperties
1855 }
1856 return json.Marshal(objectMap)
1857 }
1858
1859
1860 func (sb *ServerBackup) UnmarshalJSON(body []byte) error {
1861 var m map[string]*json.RawMessage
1862 err := json.Unmarshal(body, &m)
1863 if err != nil {
1864 return err
1865 }
1866 for k, v := range m {
1867 switch k {
1868 case "properties":
1869 if v != nil {
1870 var serverBackupProperties ServerBackupProperties
1871 err = json.Unmarshal(*v, &serverBackupProperties)
1872 if err != nil {
1873 return err
1874 }
1875 sb.ServerBackupProperties = &serverBackupProperties
1876 }
1877 case "systemData":
1878 if v != nil {
1879 var systemData SystemData
1880 err = json.Unmarshal(*v, &systemData)
1881 if err != nil {
1882 return err
1883 }
1884 sb.SystemData = &systemData
1885 }
1886 case "id":
1887 if v != nil {
1888 var ID string
1889 err = json.Unmarshal(*v, &ID)
1890 if err != nil {
1891 return err
1892 }
1893 sb.ID = &ID
1894 }
1895 case "name":
1896 if v != nil {
1897 var name string
1898 err = json.Unmarshal(*v, &name)
1899 if err != nil {
1900 return err
1901 }
1902 sb.Name = &name
1903 }
1904 case "type":
1905 if v != nil {
1906 var typeVar string
1907 err = json.Unmarshal(*v, &typeVar)
1908 if err != nil {
1909 return err
1910 }
1911 sb.Type = &typeVar
1912 }
1913 }
1914 }
1915
1916 return nil
1917 }
1918
1919
1920 type ServerBackupListResult struct {
1921 autorest.Response `json:"-"`
1922
1923 Value *[]ServerBackup `json:"value,omitempty"`
1924
1925 NextLink *string `json:"nextLink,omitempty"`
1926 }
1927
1928
1929 type ServerBackupListResultIterator struct {
1930 i int
1931 page ServerBackupListResultPage
1932 }
1933
1934
1935
1936 func (iter *ServerBackupListResultIterator) NextWithContext(ctx context.Context) (err error) {
1937 if tracing.IsEnabled() {
1938 ctx = tracing.StartSpan(ctx, fqdn+"/ServerBackupListResultIterator.NextWithContext")
1939 defer func() {
1940 sc := -1
1941 if iter.Response().Response.Response != nil {
1942 sc = iter.Response().Response.Response.StatusCode
1943 }
1944 tracing.EndSpan(ctx, sc, err)
1945 }()
1946 }
1947 iter.i++
1948 if iter.i < len(iter.page.Values()) {
1949 return nil
1950 }
1951 err = iter.page.NextWithContext(ctx)
1952 if err != nil {
1953 iter.i--
1954 return err
1955 }
1956 iter.i = 0
1957 return nil
1958 }
1959
1960
1961
1962
1963 func (iter *ServerBackupListResultIterator) Next() error {
1964 return iter.NextWithContext(context.Background())
1965 }
1966
1967
1968 func (iter ServerBackupListResultIterator) NotDone() bool {
1969 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1970 }
1971
1972
1973 func (iter ServerBackupListResultIterator) Response() ServerBackupListResult {
1974 return iter.page.Response()
1975 }
1976
1977
1978
1979 func (iter ServerBackupListResultIterator) Value() ServerBackup {
1980 if !iter.page.NotDone() {
1981 return ServerBackup{}
1982 }
1983 return iter.page.Values()[iter.i]
1984 }
1985
1986
1987 func NewServerBackupListResultIterator(page ServerBackupListResultPage) ServerBackupListResultIterator {
1988 return ServerBackupListResultIterator{page: page}
1989 }
1990
1991
1992 func (sblr ServerBackupListResult) IsEmpty() bool {
1993 return sblr.Value == nil || len(*sblr.Value) == 0
1994 }
1995
1996
1997 func (sblr ServerBackupListResult) hasNextLink() bool {
1998 return sblr.NextLink != nil && len(*sblr.NextLink) != 0
1999 }
2000
2001
2002
2003 func (sblr ServerBackupListResult) serverBackupListResultPreparer(ctx context.Context) (*http.Request, error) {
2004 if !sblr.hasNextLink() {
2005 return nil, nil
2006 }
2007 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2008 autorest.AsJSON(),
2009 autorest.AsGet(),
2010 autorest.WithBaseURL(to.String(sblr.NextLink)))
2011 }
2012
2013
2014 type ServerBackupListResultPage struct {
2015 fn func(context.Context, ServerBackupListResult) (ServerBackupListResult, error)
2016 sblr ServerBackupListResult
2017 }
2018
2019
2020
2021 func (page *ServerBackupListResultPage) NextWithContext(ctx context.Context) (err error) {
2022 if tracing.IsEnabled() {
2023 ctx = tracing.StartSpan(ctx, fqdn+"/ServerBackupListResultPage.NextWithContext")
2024 defer func() {
2025 sc := -1
2026 if page.Response().Response.Response != nil {
2027 sc = page.Response().Response.Response.StatusCode
2028 }
2029 tracing.EndSpan(ctx, sc, err)
2030 }()
2031 }
2032 for {
2033 next, err := page.fn(ctx, page.sblr)
2034 if err != nil {
2035 return err
2036 }
2037 page.sblr = next
2038 if !next.hasNextLink() || !next.IsEmpty() {
2039 break
2040 }
2041 }
2042 return nil
2043 }
2044
2045
2046
2047
2048 func (page *ServerBackupListResultPage) Next() error {
2049 return page.NextWithContext(context.Background())
2050 }
2051
2052
2053 func (page ServerBackupListResultPage) NotDone() bool {
2054 return !page.sblr.IsEmpty()
2055 }
2056
2057
2058 func (page ServerBackupListResultPage) Response() ServerBackupListResult {
2059 return page.sblr
2060 }
2061
2062
2063 func (page ServerBackupListResultPage) Values() []ServerBackup {
2064 if page.sblr.IsEmpty() {
2065 return nil
2066 }
2067 return *page.sblr.Value
2068 }
2069
2070
2071 func NewServerBackupListResultPage(cur ServerBackupListResult, getNextPage func(context.Context, ServerBackupListResult) (ServerBackupListResult, error)) ServerBackupListResultPage {
2072 return ServerBackupListResultPage{
2073 fn: getNextPage,
2074 sblr: cur,
2075 }
2076 }
2077
2078
2079 type ServerBackupProperties struct {
2080
2081 BackupType *string `json:"backupType,omitempty"`
2082
2083 CompletedTime *date.Time `json:"completedTime,omitempty"`
2084
2085 Source *string `json:"source,omitempty"`
2086 }
2087
2088
2089 type ServerEditionCapability struct {
2090
2091 Name *string `json:"name,omitempty"`
2092
2093 SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"`
2094
2095 SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"`
2096 }
2097
2098
2099 func (sec ServerEditionCapability) MarshalJSON() ([]byte, error) {
2100 objectMap := make(map[string]interface{})
2101 return json.Marshal(objectMap)
2102 }
2103
2104
2105 type ServerForUpdate struct {
2106
2107 Sku *Sku `json:"sku,omitempty"`
2108
2109 *ServerPropertiesForUpdate `json:"properties,omitempty"`
2110
2111 Tags map[string]*string `json:"tags"`
2112 }
2113
2114
2115 func (sfu ServerForUpdate) MarshalJSON() ([]byte, error) {
2116 objectMap := make(map[string]interface{})
2117 if sfu.Sku != nil {
2118 objectMap["sku"] = sfu.Sku
2119 }
2120 if sfu.ServerPropertiesForUpdate != nil {
2121 objectMap["properties"] = sfu.ServerPropertiesForUpdate
2122 }
2123 if sfu.Tags != nil {
2124 objectMap["tags"] = sfu.Tags
2125 }
2126 return json.Marshal(objectMap)
2127 }
2128
2129
2130 func (sfu *ServerForUpdate) UnmarshalJSON(body []byte) error {
2131 var m map[string]*json.RawMessage
2132 err := json.Unmarshal(body, &m)
2133 if err != nil {
2134 return err
2135 }
2136 for k, v := range m {
2137 switch k {
2138 case "sku":
2139 if v != nil {
2140 var sku Sku
2141 err = json.Unmarshal(*v, &sku)
2142 if err != nil {
2143 return err
2144 }
2145 sfu.Sku = &sku
2146 }
2147 case "properties":
2148 if v != nil {
2149 var serverPropertiesForUpdate ServerPropertiesForUpdate
2150 err = json.Unmarshal(*v, &serverPropertiesForUpdate)
2151 if err != nil {
2152 return err
2153 }
2154 sfu.ServerPropertiesForUpdate = &serverPropertiesForUpdate
2155 }
2156 case "tags":
2157 if v != nil {
2158 var tags map[string]*string
2159 err = json.Unmarshal(*v, &tags)
2160 if err != nil {
2161 return err
2162 }
2163 sfu.Tags = tags
2164 }
2165 }
2166 }
2167
2168 return nil
2169 }
2170
2171
2172 type ServerListResult struct {
2173 autorest.Response `json:"-"`
2174
2175 Value *[]Server `json:"value,omitempty"`
2176
2177 NextLink *string `json:"nextLink,omitempty"`
2178 }
2179
2180
2181 type ServerListResultIterator struct {
2182 i int
2183 page ServerListResultPage
2184 }
2185
2186
2187
2188 func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) {
2189 if tracing.IsEnabled() {
2190 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext")
2191 defer func() {
2192 sc := -1
2193 if iter.Response().Response.Response != nil {
2194 sc = iter.Response().Response.Response.StatusCode
2195 }
2196 tracing.EndSpan(ctx, sc, err)
2197 }()
2198 }
2199 iter.i++
2200 if iter.i < len(iter.page.Values()) {
2201 return nil
2202 }
2203 err = iter.page.NextWithContext(ctx)
2204 if err != nil {
2205 iter.i--
2206 return err
2207 }
2208 iter.i = 0
2209 return nil
2210 }
2211
2212
2213
2214
2215 func (iter *ServerListResultIterator) Next() error {
2216 return iter.NextWithContext(context.Background())
2217 }
2218
2219
2220 func (iter ServerListResultIterator) NotDone() bool {
2221 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2222 }
2223
2224
2225 func (iter ServerListResultIterator) Response() ServerListResult {
2226 return iter.page.Response()
2227 }
2228
2229
2230
2231 func (iter ServerListResultIterator) Value() Server {
2232 if !iter.page.NotDone() {
2233 return Server{}
2234 }
2235 return iter.page.Values()[iter.i]
2236 }
2237
2238
2239 func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator {
2240 return ServerListResultIterator{page: page}
2241 }
2242
2243
2244 func (slr ServerListResult) IsEmpty() bool {
2245 return slr.Value == nil || len(*slr.Value) == 0
2246 }
2247
2248
2249 func (slr ServerListResult) hasNextLink() bool {
2250 return slr.NextLink != nil && len(*slr.NextLink) != 0
2251 }
2252
2253
2254
2255 func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) {
2256 if !slr.hasNextLink() {
2257 return nil, nil
2258 }
2259 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2260 autorest.AsJSON(),
2261 autorest.AsGet(),
2262 autorest.WithBaseURL(to.String(slr.NextLink)))
2263 }
2264
2265
2266 type ServerListResultPage struct {
2267 fn func(context.Context, ServerListResult) (ServerListResult, error)
2268 slr ServerListResult
2269 }
2270
2271
2272
2273 func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) {
2274 if tracing.IsEnabled() {
2275 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext")
2276 defer func() {
2277 sc := -1
2278 if page.Response().Response.Response != nil {
2279 sc = page.Response().Response.Response.StatusCode
2280 }
2281 tracing.EndSpan(ctx, sc, err)
2282 }()
2283 }
2284 for {
2285 next, err := page.fn(ctx, page.slr)
2286 if err != nil {
2287 return err
2288 }
2289 page.slr = next
2290 if !next.hasNextLink() || !next.IsEmpty() {
2291 break
2292 }
2293 }
2294 return nil
2295 }
2296
2297
2298
2299
2300 func (page *ServerListResultPage) Next() error {
2301 return page.NextWithContext(context.Background())
2302 }
2303
2304
2305 func (page ServerListResultPage) NotDone() bool {
2306 return !page.slr.IsEmpty()
2307 }
2308
2309
2310 func (page ServerListResultPage) Response() ServerListResult {
2311 return page.slr
2312 }
2313
2314
2315 func (page ServerListResultPage) Values() []Server {
2316 if page.slr.IsEmpty() {
2317 return nil
2318 }
2319 return *page.slr.Value
2320 }
2321
2322
2323 func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage {
2324 return ServerListResultPage{
2325 fn: getNextPage,
2326 slr: cur,
2327 }
2328 }
2329
2330
2331 type ServerProperties struct {
2332
2333 AdministratorLogin *string `json:"administratorLogin,omitempty"`
2334
2335 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
2336
2337 Version ServerVersion `json:"version,omitempty"`
2338
2339 AvailabilityZone *string `json:"availabilityZone,omitempty"`
2340
2341 CreateMode CreateMode `json:"createMode,omitempty"`
2342
2343 SourceServerResourceID *string `json:"sourceServerResourceId,omitempty"`
2344
2345 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"`
2346
2347 ReplicationRole ReplicationRole `json:"replicationRole,omitempty"`
2348
2349 ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"`
2350
2351 State ServerState `json:"state,omitempty"`
2352
2353 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
2354
2355 Storage *Storage `json:"storage,omitempty"`
2356
2357 Backup *Backup `json:"backup,omitempty"`
2358
2359 HighAvailability *HighAvailability `json:"highAvailability,omitempty"`
2360
2361 Network *Network `json:"network,omitempty"`
2362
2363 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
2364 }
2365
2366
2367 func (sp ServerProperties) MarshalJSON() ([]byte, error) {
2368 objectMap := make(map[string]interface{})
2369 if sp.AdministratorLogin != nil {
2370 objectMap["administratorLogin"] = sp.AdministratorLogin
2371 }
2372 if sp.AdministratorLoginPassword != nil {
2373 objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword
2374 }
2375 if sp.Version != "" {
2376 objectMap["version"] = sp.Version
2377 }
2378 if sp.AvailabilityZone != nil {
2379 objectMap["availabilityZone"] = sp.AvailabilityZone
2380 }
2381 if sp.CreateMode != "" {
2382 objectMap["createMode"] = sp.CreateMode
2383 }
2384 if sp.SourceServerResourceID != nil {
2385 objectMap["sourceServerResourceId"] = sp.SourceServerResourceID
2386 }
2387 if sp.RestorePointInTime != nil {
2388 objectMap["restorePointInTime"] = sp.RestorePointInTime
2389 }
2390 if sp.ReplicationRole != "" {
2391 objectMap["replicationRole"] = sp.ReplicationRole
2392 }
2393 if sp.Storage != nil {
2394 objectMap["storage"] = sp.Storage
2395 }
2396 if sp.Backup != nil {
2397 objectMap["backup"] = sp.Backup
2398 }
2399 if sp.HighAvailability != nil {
2400 objectMap["highAvailability"] = sp.HighAvailability
2401 }
2402 if sp.Network != nil {
2403 objectMap["network"] = sp.Network
2404 }
2405 if sp.MaintenanceWindow != nil {
2406 objectMap["maintenanceWindow"] = sp.MaintenanceWindow
2407 }
2408 return json.Marshal(objectMap)
2409 }
2410
2411
2412 type ServerPropertiesForUpdate struct {
2413
2414 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
2415
2416 Storage *Storage `json:"storage,omitempty"`
2417
2418 Backup *Backup `json:"backup,omitempty"`
2419
2420 HighAvailability *HighAvailability `json:"highAvailability,omitempty"`
2421
2422 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
2423
2424 ReplicationRole ReplicationRole `json:"replicationRole,omitempty"`
2425 }
2426
2427
2428 type ServerRestartParameter struct {
2429
2430 RestartWithFailover EnableStatusEnum `json:"restartWithFailover,omitempty"`
2431
2432 MaxFailoverSeconds *int32 `json:"maxFailoverSeconds,omitempty"`
2433 }
2434
2435
2436
2437 type ServersCreateFuture struct {
2438 azure.FutureAPI
2439
2440
2441 Result func(ServersClient) (Server, error)
2442 }
2443
2444
2445 func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
2446 var azFuture azure.Future
2447 if err := json.Unmarshal(body, &azFuture); err != nil {
2448 return err
2449 }
2450 future.FutureAPI = &azFuture
2451 future.Result = future.result
2452 return nil
2453 }
2454
2455
2456 func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
2457 var done bool
2458 done, err = future.DoneWithContext(context.Background(), client)
2459 if err != nil {
2460 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersCreateFuture", "Result", future.Response(), "Polling failure")
2461 return
2462 }
2463 if !done {
2464 s.Response.Response = future.Response()
2465 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersCreateFuture")
2466 return
2467 }
2468 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2469 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
2470 s, err = client.CreateResponder(s.Response.Response)
2471 if err != nil {
2472 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
2473 }
2474 }
2475 return
2476 }
2477
2478
2479
2480 type ServersDeleteFuture struct {
2481 azure.FutureAPI
2482
2483
2484 Result func(ServersClient) (autorest.Response, error)
2485 }
2486
2487
2488 func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
2489 var azFuture azure.Future
2490 if err := json.Unmarshal(body, &azFuture); err != nil {
2491 return err
2492 }
2493 future.FutureAPI = &azFuture
2494 future.Result = future.result
2495 return nil
2496 }
2497
2498
2499 func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
2500 var done bool
2501 done, err = future.DoneWithContext(context.Background(), client)
2502 if err != nil {
2503 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
2504 return
2505 }
2506 if !done {
2507 ar.Response = future.Response()
2508 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersDeleteFuture")
2509 return
2510 }
2511 ar.Response = future.Response()
2512 return
2513 }
2514
2515
2516
2517 type ServersFailoverFuture struct {
2518 azure.FutureAPI
2519
2520
2521 Result func(ServersClient) (autorest.Response, error)
2522 }
2523
2524
2525 func (future *ServersFailoverFuture) UnmarshalJSON(body []byte) error {
2526 var azFuture azure.Future
2527 if err := json.Unmarshal(body, &azFuture); err != nil {
2528 return err
2529 }
2530 future.FutureAPI = &azFuture
2531 future.Result = future.result
2532 return nil
2533 }
2534
2535
2536 func (future *ServersFailoverFuture) result(client ServersClient) (ar autorest.Response, err error) {
2537 var done bool
2538 done, err = future.DoneWithContext(context.Background(), client)
2539 if err != nil {
2540 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersFailoverFuture", "Result", future.Response(), "Polling failure")
2541 return
2542 }
2543 if !done {
2544 ar.Response = future.Response()
2545 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersFailoverFuture")
2546 return
2547 }
2548 ar.Response = future.Response()
2549 return
2550 }
2551
2552
2553
2554 type ServersRestartFuture struct {
2555 azure.FutureAPI
2556
2557
2558 Result func(ServersClient) (autorest.Response, error)
2559 }
2560
2561
2562 func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error {
2563 var azFuture azure.Future
2564 if err := json.Unmarshal(body, &azFuture); err != nil {
2565 return err
2566 }
2567 future.FutureAPI = &azFuture
2568 future.Result = future.result
2569 return nil
2570 }
2571
2572
2573 func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {
2574 var done bool
2575 done, err = future.DoneWithContext(context.Background(), client)
2576 if err != nil {
2577 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersRestartFuture", "Result", future.Response(), "Polling failure")
2578 return
2579 }
2580 if !done {
2581 ar.Response = future.Response()
2582 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersRestartFuture")
2583 return
2584 }
2585 ar.Response = future.Response()
2586 return
2587 }
2588
2589
2590 type ServersStartFuture struct {
2591 azure.FutureAPI
2592
2593
2594 Result func(ServersClient) (autorest.Response, error)
2595 }
2596
2597
2598 func (future *ServersStartFuture) UnmarshalJSON(body []byte) error {
2599 var azFuture azure.Future
2600 if err := json.Unmarshal(body, &azFuture); err != nil {
2601 return err
2602 }
2603 future.FutureAPI = &azFuture
2604 future.Result = future.result
2605 return nil
2606 }
2607
2608
2609 func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) {
2610 var done bool
2611 done, err = future.DoneWithContext(context.Background(), client)
2612 if err != nil {
2613 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersStartFuture", "Result", future.Response(), "Polling failure")
2614 return
2615 }
2616 if !done {
2617 ar.Response = future.Response()
2618 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersStartFuture")
2619 return
2620 }
2621 ar.Response = future.Response()
2622 return
2623 }
2624
2625
2626 type ServersStopFuture struct {
2627 azure.FutureAPI
2628
2629
2630 Result func(ServersClient) (autorest.Response, error)
2631 }
2632
2633
2634 func (future *ServersStopFuture) UnmarshalJSON(body []byte) error {
2635 var azFuture azure.Future
2636 if err := json.Unmarshal(body, &azFuture); err != nil {
2637 return err
2638 }
2639 future.FutureAPI = &azFuture
2640 future.Result = future.result
2641 return nil
2642 }
2643
2644
2645 func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) {
2646 var done bool
2647 done, err = future.DoneWithContext(context.Background(), client)
2648 if err != nil {
2649 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersStopFuture", "Result", future.Response(), "Polling failure")
2650 return
2651 }
2652 if !done {
2653 ar.Response = future.Response()
2654 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersStopFuture")
2655 return
2656 }
2657 ar.Response = future.Response()
2658 return
2659 }
2660
2661
2662
2663 type ServersUpdateFuture struct {
2664 azure.FutureAPI
2665
2666
2667 Result func(ServersClient) (Server, error)
2668 }
2669
2670
2671 func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
2672 var azFuture azure.Future
2673 if err := json.Unmarshal(body, &azFuture); err != nil {
2674 return err
2675 }
2676 future.FutureAPI = &azFuture
2677 future.Result = future.result
2678 return nil
2679 }
2680
2681
2682 func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
2683 var done bool
2684 done, err = future.DoneWithContext(context.Background(), client)
2685 if err != nil {
2686 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
2687 return
2688 }
2689 if !done {
2690 s.Response.Response = future.Response()
2691 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersUpdateFuture")
2692 return
2693 }
2694 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2695 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
2696 s, err = client.UpdateResponder(s.Response.Response)
2697 if err != nil {
2698 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
2699 }
2700 }
2701 return
2702 }
2703
2704
2705 type ServerVersionCapability struct {
2706
2707 Name *string `json:"name,omitempty"`
2708
2709 SupportedSkus *[]SkuCapability `json:"supportedSkus,omitempty"`
2710 }
2711
2712
2713 func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) {
2714 objectMap := make(map[string]interface{})
2715 return json.Marshal(objectMap)
2716 }
2717
2718
2719 type Sku struct {
2720
2721 Name *string `json:"name,omitempty"`
2722
2723 Tier SkuTier `json:"tier,omitempty"`
2724 }
2725
2726
2727 type SkuCapability struct {
2728
2729 Name *string `json:"name,omitempty"`
2730
2731 VCores *int64 `json:"vCores,omitempty"`
2732
2733 SupportedIops *int64 `json:"supportedIops,omitempty"`
2734
2735 SupportedMemoryPerVCoreMB *int64 `json:"supportedMemoryPerVCoreMB,omitempty"`
2736 }
2737
2738
2739 func (sc SkuCapability) MarshalJSON() ([]byte, error) {
2740 objectMap := make(map[string]interface{})
2741 return json.Marshal(objectMap)
2742 }
2743
2744
2745 type Storage struct {
2746
2747 StorageSizeGB *int32 `json:"storageSizeGB,omitempty"`
2748
2749 Iops *int32 `json:"iops,omitempty"`
2750
2751 AutoGrow EnableStatusEnum `json:"autoGrow,omitempty"`
2752
2753 StorageSku *string `json:"storageSku,omitempty"`
2754 }
2755
2756
2757 func (s Storage) MarshalJSON() ([]byte, error) {
2758 objectMap := make(map[string]interface{})
2759 if s.StorageSizeGB != nil {
2760 objectMap["storageSizeGB"] = s.StorageSizeGB
2761 }
2762 if s.Iops != nil {
2763 objectMap["iops"] = s.Iops
2764 }
2765 if s.AutoGrow != "" {
2766 objectMap["autoGrow"] = s.AutoGrow
2767 }
2768 return json.Marshal(objectMap)
2769 }
2770
2771
2772 type StorageEditionCapability struct {
2773
2774 Name *string `json:"name,omitempty"`
2775
2776 MinStorageSize *int64 `json:"minStorageSize,omitempty"`
2777
2778 MaxStorageSize *int64 `json:"maxStorageSize,omitempty"`
2779
2780 MinBackupRetentionDays *int64 `json:"minBackupRetentionDays,omitempty"`
2781
2782 MaxBackupRetentionDays *int64 `json:"maxBackupRetentionDays,omitempty"`
2783 }
2784
2785
2786 func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) {
2787 objectMap := make(map[string]interface{})
2788 return json.Marshal(objectMap)
2789 }
2790
2791
2792 type SystemData struct {
2793
2794 CreatedBy *string `json:"createdBy,omitempty"`
2795
2796 CreatedByType CreatedByType `json:"createdByType,omitempty"`
2797
2798 CreatedAt *date.Time `json:"createdAt,omitempty"`
2799
2800 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
2801
2802 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
2803
2804 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
2805 }
2806
2807
2808
2809 type TrackedResource struct {
2810
2811 Tags map[string]*string `json:"tags"`
2812
2813 Location *string `json:"location,omitempty"`
2814
2815 ID *string `json:"id,omitempty"`
2816
2817 Name *string `json:"name,omitempty"`
2818
2819 Type *string `json:"type,omitempty"`
2820 }
2821
2822
2823 func (tr TrackedResource) MarshalJSON() ([]byte, error) {
2824 objectMap := make(map[string]interface{})
2825 if tr.Tags != nil {
2826 objectMap["tags"] = tr.Tags
2827 }
2828 if tr.Location != nil {
2829 objectMap["location"] = tr.Location
2830 }
2831 return json.Marshal(objectMap)
2832 }
2833
2834
2835 type VirtualNetworkSubnetUsageParameter struct {
2836
2837 VirtualNetworkResourceID *string `json:"virtualNetworkResourceId,omitempty"`
2838 }
2839
2840
2841 type VirtualNetworkSubnetUsageResult struct {
2842 autorest.Response `json:"-"`
2843
2844 DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"`
2845 }
2846
2847
2848 func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) {
2849 objectMap := make(map[string]interface{})
2850 return json.Marshal(objectMap)
2851 }
2852
View as plain text