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/preview/mysql/mgmt/2021-05-01-preview/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 Identity struct {
1424
1425 PrincipalID *string `json:"principalId,omitempty"`
1426
1427 TenantID *string `json:"tenantId,omitempty"`
1428
1429 Type ResourceIdentityType `json:"type,omitempty"`
1430 }
1431
1432
1433 func (i Identity) MarshalJSON() ([]byte, error) {
1434 objectMap := make(map[string]interface{})
1435 if i.Type != "" {
1436 objectMap["type"] = i.Type
1437 }
1438 return json.Marshal(objectMap)
1439 }
1440
1441
1442 type MaintenanceWindow struct {
1443
1444 CustomWindow *string `json:"customWindow,omitempty"`
1445
1446 StartHour *int32 `json:"startHour,omitempty"`
1447
1448 StartMinute *int32 `json:"startMinute,omitempty"`
1449
1450 DayOfWeek *int32 `json:"dayOfWeek,omitempty"`
1451 }
1452
1453
1454 type NameAvailability struct {
1455 autorest.Response `json:"-"`
1456
1457 Message *string `json:"message,omitempty"`
1458
1459 NameAvailable *bool `json:"nameAvailable,omitempty"`
1460
1461 Reason *string `json:"reason,omitempty"`
1462 }
1463
1464
1465 type NameAvailabilityRequest struct {
1466
1467 Name *string `json:"name,omitempty"`
1468
1469 Type *string `json:"type,omitempty"`
1470 }
1471
1472
1473 type Network struct {
1474
1475 PublicNetworkAccess EnableStatusEnum `json:"publicNetworkAccess,omitempty"`
1476
1477 DelegatedSubnetResourceID *string `json:"delegatedSubnetResourceId,omitempty"`
1478
1479 PrivateDNSZoneResourceID *string `json:"privateDnsZoneResourceId,omitempty"`
1480 }
1481
1482
1483 func (n Network) MarshalJSON() ([]byte, error) {
1484 objectMap := make(map[string]interface{})
1485 if n.DelegatedSubnetResourceID != nil {
1486 objectMap["delegatedSubnetResourceId"] = n.DelegatedSubnetResourceID
1487 }
1488 if n.PrivateDNSZoneResourceID != nil {
1489 objectMap["privateDnsZoneResourceId"] = n.PrivateDNSZoneResourceID
1490 }
1491 return json.Marshal(objectMap)
1492 }
1493
1494
1495 type Operation struct {
1496
1497 Name *string `json:"name,omitempty"`
1498
1499 Display *OperationDisplay `json:"display,omitempty"`
1500
1501 Origin *string `json:"origin,omitempty"`
1502
1503 Properties map[string]interface{} `json:"properties"`
1504 }
1505
1506
1507 func (o Operation) MarshalJSON() ([]byte, error) {
1508 objectMap := make(map[string]interface{})
1509 if o.Name != nil {
1510 objectMap["name"] = o.Name
1511 }
1512 if o.Display != nil {
1513 objectMap["display"] = o.Display
1514 }
1515 if o.Origin != nil {
1516 objectMap["origin"] = o.Origin
1517 }
1518 if o.Properties != nil {
1519 objectMap["properties"] = o.Properties
1520 }
1521 return json.Marshal(objectMap)
1522 }
1523
1524
1525 type OperationDisplay struct {
1526
1527 Provider *string `json:"provider,omitempty"`
1528
1529 Resource *string `json:"resource,omitempty"`
1530
1531 Operation *string `json:"operation,omitempty"`
1532
1533 Description *string `json:"description,omitempty"`
1534 }
1535
1536
1537 type OperationListResult struct {
1538 autorest.Response `json:"-"`
1539
1540 Value *[]Operation `json:"value,omitempty"`
1541
1542 NextLink *string `json:"nextLink,omitempty"`
1543 }
1544
1545
1546 type OperationListResultIterator struct {
1547 i int
1548 page OperationListResultPage
1549 }
1550
1551
1552
1553 func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
1554 if tracing.IsEnabled() {
1555 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
1556 defer func() {
1557 sc := -1
1558 if iter.Response().Response.Response != nil {
1559 sc = iter.Response().Response.Response.StatusCode
1560 }
1561 tracing.EndSpan(ctx, sc, err)
1562 }()
1563 }
1564 iter.i++
1565 if iter.i < len(iter.page.Values()) {
1566 return nil
1567 }
1568 err = iter.page.NextWithContext(ctx)
1569 if err != nil {
1570 iter.i--
1571 return err
1572 }
1573 iter.i = 0
1574 return nil
1575 }
1576
1577
1578
1579
1580 func (iter *OperationListResultIterator) Next() error {
1581 return iter.NextWithContext(context.Background())
1582 }
1583
1584
1585 func (iter OperationListResultIterator) NotDone() bool {
1586 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1587 }
1588
1589
1590 func (iter OperationListResultIterator) Response() OperationListResult {
1591 return iter.page.Response()
1592 }
1593
1594
1595
1596 func (iter OperationListResultIterator) Value() Operation {
1597 if !iter.page.NotDone() {
1598 return Operation{}
1599 }
1600 return iter.page.Values()[iter.i]
1601 }
1602
1603
1604 func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
1605 return OperationListResultIterator{page: page}
1606 }
1607
1608
1609 func (olr OperationListResult) IsEmpty() bool {
1610 return olr.Value == nil || len(*olr.Value) == 0
1611 }
1612
1613
1614 func (olr OperationListResult) hasNextLink() bool {
1615 return olr.NextLink != nil && len(*olr.NextLink) != 0
1616 }
1617
1618
1619
1620 func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
1621 if !olr.hasNextLink() {
1622 return nil, nil
1623 }
1624 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1625 autorest.AsJSON(),
1626 autorest.AsGet(),
1627 autorest.WithBaseURL(to.String(olr.NextLink)))
1628 }
1629
1630
1631 type OperationListResultPage struct {
1632 fn func(context.Context, OperationListResult) (OperationListResult, error)
1633 olr OperationListResult
1634 }
1635
1636
1637
1638 func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
1639 if tracing.IsEnabled() {
1640 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
1641 defer func() {
1642 sc := -1
1643 if page.Response().Response.Response != nil {
1644 sc = page.Response().Response.Response.StatusCode
1645 }
1646 tracing.EndSpan(ctx, sc, err)
1647 }()
1648 }
1649 for {
1650 next, err := page.fn(ctx, page.olr)
1651 if err != nil {
1652 return err
1653 }
1654 page.olr = next
1655 if !next.hasNextLink() || !next.IsEmpty() {
1656 break
1657 }
1658 }
1659 return nil
1660 }
1661
1662
1663
1664
1665 func (page *OperationListResultPage) Next() error {
1666 return page.NextWithContext(context.Background())
1667 }
1668
1669
1670 func (page OperationListResultPage) NotDone() bool {
1671 return !page.olr.IsEmpty()
1672 }
1673
1674
1675 func (page OperationListResultPage) Response() OperationListResult {
1676 return page.olr
1677 }
1678
1679
1680 func (page OperationListResultPage) Values() []Operation {
1681 if page.olr.IsEmpty() {
1682 return nil
1683 }
1684 return *page.olr.Value
1685 }
1686
1687
1688 func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
1689 return OperationListResultPage{
1690 fn: getNextPage,
1691 olr: cur,
1692 }
1693 }
1694
1695
1696 type Plan struct {
1697
1698 Name *string `json:"name,omitempty"`
1699
1700 Publisher *string `json:"publisher,omitempty"`
1701
1702 Product *string `json:"product,omitempty"`
1703
1704 PromotionCode *string `json:"promotionCode,omitempty"`
1705
1706 Version *string `json:"version,omitempty"`
1707 }
1708
1709
1710
1711 type ProxyResource struct {
1712
1713 ID *string `json:"id,omitempty"`
1714
1715 Name *string `json:"name,omitempty"`
1716
1717 Type *string `json:"type,omitempty"`
1718 }
1719
1720
1721 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1722 objectMap := make(map[string]interface{})
1723 return json.Marshal(objectMap)
1724 }
1725
1726
1727 type Resource struct {
1728
1729 ID *string `json:"id,omitempty"`
1730
1731 Name *string `json:"name,omitempty"`
1732
1733 Type *string `json:"type,omitempty"`
1734 }
1735
1736
1737 func (r Resource) MarshalJSON() ([]byte, error) {
1738 objectMap := make(map[string]interface{})
1739 return json.Marshal(objectMap)
1740 }
1741
1742
1743
1744
1745 type ResourceModelWithAllowedPropertySet struct {
1746
1747 ID *string `json:"id,omitempty"`
1748
1749 Name *string `json:"name,omitempty"`
1750
1751 Type *string `json:"type,omitempty"`
1752
1753 Location *string `json:"location,omitempty"`
1754
1755 ManagedBy *string `json:"managedBy,omitempty"`
1756
1757 Kind *string `json:"kind,omitempty"`
1758
1759 Etag *string `json:"etag,omitempty"`
1760
1761 Tags map[string]*string `json:"tags"`
1762 Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"`
1763 Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"`
1764 Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"`
1765 }
1766
1767
1768 func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) {
1769 objectMap := make(map[string]interface{})
1770 if rmwaps.Location != nil {
1771 objectMap["location"] = rmwaps.Location
1772 }
1773 if rmwaps.ManagedBy != nil {
1774 objectMap["managedBy"] = rmwaps.ManagedBy
1775 }
1776 if rmwaps.Kind != nil {
1777 objectMap["kind"] = rmwaps.Kind
1778 }
1779 if rmwaps.Tags != nil {
1780 objectMap["tags"] = rmwaps.Tags
1781 }
1782 if rmwaps.Identity != nil {
1783 objectMap["identity"] = rmwaps.Identity
1784 }
1785 if rmwaps.Sku != nil {
1786 objectMap["sku"] = rmwaps.Sku
1787 }
1788 if rmwaps.Plan != nil {
1789 objectMap["plan"] = rmwaps.Plan
1790 }
1791 return json.Marshal(objectMap)
1792 }
1793
1794
1795 type ResourceModelWithAllowedPropertySetIdentity struct {
1796
1797 PrincipalID *string `json:"principalId,omitempty"`
1798
1799 TenantID *string `json:"tenantId,omitempty"`
1800
1801 Type ResourceIdentityType `json:"type,omitempty"`
1802 }
1803
1804
1805 func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) {
1806 objectMap := make(map[string]interface{})
1807 if rmwaps.Type != "" {
1808 objectMap["type"] = rmwaps.Type
1809 }
1810 return json.Marshal(objectMap)
1811 }
1812
1813
1814 type ResourceModelWithAllowedPropertySetPlan struct {
1815
1816 Name *string `json:"name,omitempty"`
1817
1818 Publisher *string `json:"publisher,omitempty"`
1819
1820 Product *string `json:"product,omitempty"`
1821
1822 PromotionCode *string `json:"promotionCode,omitempty"`
1823
1824 Version *string `json:"version,omitempty"`
1825 }
1826
1827
1828 type ResourceModelWithAllowedPropertySetSku struct {
1829
1830 Name *string `json:"name,omitempty"`
1831
1832 Tier SkuTier `json:"tier,omitempty"`
1833 }
1834
1835
1836 type Server struct {
1837 autorest.Response `json:"-"`
1838
1839 Identity *Identity `json:"identity,omitempty"`
1840
1841 Sku *Sku `json:"sku,omitempty"`
1842
1843 *ServerProperties `json:"properties,omitempty"`
1844
1845 SystemData *SystemData `json:"systemData,omitempty"`
1846
1847 Tags map[string]*string `json:"tags"`
1848
1849 Location *string `json:"location,omitempty"`
1850
1851 ID *string `json:"id,omitempty"`
1852
1853 Name *string `json:"name,omitempty"`
1854
1855 Type *string `json:"type,omitempty"`
1856 }
1857
1858
1859 func (s Server) MarshalJSON() ([]byte, error) {
1860 objectMap := make(map[string]interface{})
1861 if s.Identity != nil {
1862 objectMap["identity"] = s.Identity
1863 }
1864 if s.Sku != nil {
1865 objectMap["sku"] = s.Sku
1866 }
1867 if s.ServerProperties != nil {
1868 objectMap["properties"] = s.ServerProperties
1869 }
1870 if s.Tags != nil {
1871 objectMap["tags"] = s.Tags
1872 }
1873 if s.Location != nil {
1874 objectMap["location"] = s.Location
1875 }
1876 return json.Marshal(objectMap)
1877 }
1878
1879
1880 func (s *Server) UnmarshalJSON(body []byte) error {
1881 var m map[string]*json.RawMessage
1882 err := json.Unmarshal(body, &m)
1883 if err != nil {
1884 return err
1885 }
1886 for k, v := range m {
1887 switch k {
1888 case "identity":
1889 if v != nil {
1890 var identity Identity
1891 err = json.Unmarshal(*v, &identity)
1892 if err != nil {
1893 return err
1894 }
1895 s.Identity = &identity
1896 }
1897 case "sku":
1898 if v != nil {
1899 var sku Sku
1900 err = json.Unmarshal(*v, &sku)
1901 if err != nil {
1902 return err
1903 }
1904 s.Sku = &sku
1905 }
1906 case "properties":
1907 if v != nil {
1908 var serverProperties ServerProperties
1909 err = json.Unmarshal(*v, &serverProperties)
1910 if err != nil {
1911 return err
1912 }
1913 s.ServerProperties = &serverProperties
1914 }
1915 case "systemData":
1916 if v != nil {
1917 var systemData SystemData
1918 err = json.Unmarshal(*v, &systemData)
1919 if err != nil {
1920 return err
1921 }
1922 s.SystemData = &systemData
1923 }
1924 case "tags":
1925 if v != nil {
1926 var tags map[string]*string
1927 err = json.Unmarshal(*v, &tags)
1928 if err != nil {
1929 return err
1930 }
1931 s.Tags = tags
1932 }
1933 case "location":
1934 if v != nil {
1935 var location string
1936 err = json.Unmarshal(*v, &location)
1937 if err != nil {
1938 return err
1939 }
1940 s.Location = &location
1941 }
1942 case "id":
1943 if v != nil {
1944 var ID string
1945 err = json.Unmarshal(*v, &ID)
1946 if err != nil {
1947 return err
1948 }
1949 s.ID = &ID
1950 }
1951 case "name":
1952 if v != nil {
1953 var name string
1954 err = json.Unmarshal(*v, &name)
1955 if err != nil {
1956 return err
1957 }
1958 s.Name = &name
1959 }
1960 case "type":
1961 if v != nil {
1962 var typeVar string
1963 err = json.Unmarshal(*v, &typeVar)
1964 if err != nil {
1965 return err
1966 }
1967 s.Type = &typeVar
1968 }
1969 }
1970 }
1971
1972 return nil
1973 }
1974
1975
1976 type ServerBackup struct {
1977 autorest.Response `json:"-"`
1978
1979 *ServerBackupProperties `json:"properties,omitempty"`
1980
1981 SystemData *SystemData `json:"systemData,omitempty"`
1982
1983 ID *string `json:"id,omitempty"`
1984
1985 Name *string `json:"name,omitempty"`
1986
1987 Type *string `json:"type,omitempty"`
1988 }
1989
1990
1991 func (sb ServerBackup) MarshalJSON() ([]byte, error) {
1992 objectMap := make(map[string]interface{})
1993 if sb.ServerBackupProperties != nil {
1994 objectMap["properties"] = sb.ServerBackupProperties
1995 }
1996 return json.Marshal(objectMap)
1997 }
1998
1999
2000 func (sb *ServerBackup) UnmarshalJSON(body []byte) error {
2001 var m map[string]*json.RawMessage
2002 err := json.Unmarshal(body, &m)
2003 if err != nil {
2004 return err
2005 }
2006 for k, v := range m {
2007 switch k {
2008 case "properties":
2009 if v != nil {
2010 var serverBackupProperties ServerBackupProperties
2011 err = json.Unmarshal(*v, &serverBackupProperties)
2012 if err != nil {
2013 return err
2014 }
2015 sb.ServerBackupProperties = &serverBackupProperties
2016 }
2017 case "systemData":
2018 if v != nil {
2019 var systemData SystemData
2020 err = json.Unmarshal(*v, &systemData)
2021 if err != nil {
2022 return err
2023 }
2024 sb.SystemData = &systemData
2025 }
2026 case "id":
2027 if v != nil {
2028 var ID string
2029 err = json.Unmarshal(*v, &ID)
2030 if err != nil {
2031 return err
2032 }
2033 sb.ID = &ID
2034 }
2035 case "name":
2036 if v != nil {
2037 var name string
2038 err = json.Unmarshal(*v, &name)
2039 if err != nil {
2040 return err
2041 }
2042 sb.Name = &name
2043 }
2044 case "type":
2045 if v != nil {
2046 var typeVar string
2047 err = json.Unmarshal(*v, &typeVar)
2048 if err != nil {
2049 return err
2050 }
2051 sb.Type = &typeVar
2052 }
2053 }
2054 }
2055
2056 return nil
2057 }
2058
2059
2060 type ServerBackupListResult struct {
2061 autorest.Response `json:"-"`
2062
2063 Value *[]ServerBackup `json:"value,omitempty"`
2064
2065 NextLink *string `json:"nextLink,omitempty"`
2066 }
2067
2068
2069 type ServerBackupListResultIterator struct {
2070 i int
2071 page ServerBackupListResultPage
2072 }
2073
2074
2075
2076 func (iter *ServerBackupListResultIterator) NextWithContext(ctx context.Context) (err error) {
2077 if tracing.IsEnabled() {
2078 ctx = tracing.StartSpan(ctx, fqdn+"/ServerBackupListResultIterator.NextWithContext")
2079 defer func() {
2080 sc := -1
2081 if iter.Response().Response.Response != nil {
2082 sc = iter.Response().Response.Response.StatusCode
2083 }
2084 tracing.EndSpan(ctx, sc, err)
2085 }()
2086 }
2087 iter.i++
2088 if iter.i < len(iter.page.Values()) {
2089 return nil
2090 }
2091 err = iter.page.NextWithContext(ctx)
2092 if err != nil {
2093 iter.i--
2094 return err
2095 }
2096 iter.i = 0
2097 return nil
2098 }
2099
2100
2101
2102
2103 func (iter *ServerBackupListResultIterator) Next() error {
2104 return iter.NextWithContext(context.Background())
2105 }
2106
2107
2108 func (iter ServerBackupListResultIterator) NotDone() bool {
2109 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2110 }
2111
2112
2113 func (iter ServerBackupListResultIterator) Response() ServerBackupListResult {
2114 return iter.page.Response()
2115 }
2116
2117
2118
2119 func (iter ServerBackupListResultIterator) Value() ServerBackup {
2120 if !iter.page.NotDone() {
2121 return ServerBackup{}
2122 }
2123 return iter.page.Values()[iter.i]
2124 }
2125
2126
2127 func NewServerBackupListResultIterator(page ServerBackupListResultPage) ServerBackupListResultIterator {
2128 return ServerBackupListResultIterator{page: page}
2129 }
2130
2131
2132 func (sblr ServerBackupListResult) IsEmpty() bool {
2133 return sblr.Value == nil || len(*sblr.Value) == 0
2134 }
2135
2136
2137 func (sblr ServerBackupListResult) hasNextLink() bool {
2138 return sblr.NextLink != nil && len(*sblr.NextLink) != 0
2139 }
2140
2141
2142
2143 func (sblr ServerBackupListResult) serverBackupListResultPreparer(ctx context.Context) (*http.Request, error) {
2144 if !sblr.hasNextLink() {
2145 return nil, nil
2146 }
2147 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2148 autorest.AsJSON(),
2149 autorest.AsGet(),
2150 autorest.WithBaseURL(to.String(sblr.NextLink)))
2151 }
2152
2153
2154 type ServerBackupListResultPage struct {
2155 fn func(context.Context, ServerBackupListResult) (ServerBackupListResult, error)
2156 sblr ServerBackupListResult
2157 }
2158
2159
2160
2161 func (page *ServerBackupListResultPage) NextWithContext(ctx context.Context) (err error) {
2162 if tracing.IsEnabled() {
2163 ctx = tracing.StartSpan(ctx, fqdn+"/ServerBackupListResultPage.NextWithContext")
2164 defer func() {
2165 sc := -1
2166 if page.Response().Response.Response != nil {
2167 sc = page.Response().Response.Response.StatusCode
2168 }
2169 tracing.EndSpan(ctx, sc, err)
2170 }()
2171 }
2172 for {
2173 next, err := page.fn(ctx, page.sblr)
2174 if err != nil {
2175 return err
2176 }
2177 page.sblr = next
2178 if !next.hasNextLink() || !next.IsEmpty() {
2179 break
2180 }
2181 }
2182 return nil
2183 }
2184
2185
2186
2187
2188 func (page *ServerBackupListResultPage) Next() error {
2189 return page.NextWithContext(context.Background())
2190 }
2191
2192
2193 func (page ServerBackupListResultPage) NotDone() bool {
2194 return !page.sblr.IsEmpty()
2195 }
2196
2197
2198 func (page ServerBackupListResultPage) Response() ServerBackupListResult {
2199 return page.sblr
2200 }
2201
2202
2203 func (page ServerBackupListResultPage) Values() []ServerBackup {
2204 if page.sblr.IsEmpty() {
2205 return nil
2206 }
2207 return *page.sblr.Value
2208 }
2209
2210
2211 func NewServerBackupListResultPage(cur ServerBackupListResult, getNextPage func(context.Context, ServerBackupListResult) (ServerBackupListResult, error)) ServerBackupListResultPage {
2212 return ServerBackupListResultPage{
2213 fn: getNextPage,
2214 sblr: cur,
2215 }
2216 }
2217
2218
2219 type ServerBackupProperties struct {
2220
2221 BackupType *string `json:"backupType,omitempty"`
2222
2223 CompletedTime *date.Time `json:"completedTime,omitempty"`
2224
2225 Source *string `json:"source,omitempty"`
2226 }
2227
2228
2229 type ServerEditionCapability struct {
2230
2231 Name *string `json:"name,omitempty"`
2232
2233 SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"`
2234
2235 SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"`
2236 }
2237
2238
2239 func (sec ServerEditionCapability) MarshalJSON() ([]byte, error) {
2240 objectMap := make(map[string]interface{})
2241 return json.Marshal(objectMap)
2242 }
2243
2244
2245 type ServerForUpdate struct {
2246
2247 Sku *Sku `json:"sku,omitempty"`
2248
2249 *ServerPropertiesForUpdate `json:"properties,omitempty"`
2250
2251 Tags map[string]*string `json:"tags"`
2252 }
2253
2254
2255 func (sfu ServerForUpdate) MarshalJSON() ([]byte, error) {
2256 objectMap := make(map[string]interface{})
2257 if sfu.Sku != nil {
2258 objectMap["sku"] = sfu.Sku
2259 }
2260 if sfu.ServerPropertiesForUpdate != nil {
2261 objectMap["properties"] = sfu.ServerPropertiesForUpdate
2262 }
2263 if sfu.Tags != nil {
2264 objectMap["tags"] = sfu.Tags
2265 }
2266 return json.Marshal(objectMap)
2267 }
2268
2269
2270 func (sfu *ServerForUpdate) UnmarshalJSON(body []byte) error {
2271 var m map[string]*json.RawMessage
2272 err := json.Unmarshal(body, &m)
2273 if err != nil {
2274 return err
2275 }
2276 for k, v := range m {
2277 switch k {
2278 case "sku":
2279 if v != nil {
2280 var sku Sku
2281 err = json.Unmarshal(*v, &sku)
2282 if err != nil {
2283 return err
2284 }
2285 sfu.Sku = &sku
2286 }
2287 case "properties":
2288 if v != nil {
2289 var serverPropertiesForUpdate ServerPropertiesForUpdate
2290 err = json.Unmarshal(*v, &serverPropertiesForUpdate)
2291 if err != nil {
2292 return err
2293 }
2294 sfu.ServerPropertiesForUpdate = &serverPropertiesForUpdate
2295 }
2296 case "tags":
2297 if v != nil {
2298 var tags map[string]*string
2299 err = json.Unmarshal(*v, &tags)
2300 if err != nil {
2301 return err
2302 }
2303 sfu.Tags = tags
2304 }
2305 }
2306 }
2307
2308 return nil
2309 }
2310
2311
2312 type ServerListResult struct {
2313 autorest.Response `json:"-"`
2314
2315 Value *[]Server `json:"value,omitempty"`
2316
2317 NextLink *string `json:"nextLink,omitempty"`
2318 }
2319
2320
2321 type ServerListResultIterator struct {
2322 i int
2323 page ServerListResultPage
2324 }
2325
2326
2327
2328 func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) {
2329 if tracing.IsEnabled() {
2330 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext")
2331 defer func() {
2332 sc := -1
2333 if iter.Response().Response.Response != nil {
2334 sc = iter.Response().Response.Response.StatusCode
2335 }
2336 tracing.EndSpan(ctx, sc, err)
2337 }()
2338 }
2339 iter.i++
2340 if iter.i < len(iter.page.Values()) {
2341 return nil
2342 }
2343 err = iter.page.NextWithContext(ctx)
2344 if err != nil {
2345 iter.i--
2346 return err
2347 }
2348 iter.i = 0
2349 return nil
2350 }
2351
2352
2353
2354
2355 func (iter *ServerListResultIterator) Next() error {
2356 return iter.NextWithContext(context.Background())
2357 }
2358
2359
2360 func (iter ServerListResultIterator) NotDone() bool {
2361 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2362 }
2363
2364
2365 func (iter ServerListResultIterator) Response() ServerListResult {
2366 return iter.page.Response()
2367 }
2368
2369
2370
2371 func (iter ServerListResultIterator) Value() Server {
2372 if !iter.page.NotDone() {
2373 return Server{}
2374 }
2375 return iter.page.Values()[iter.i]
2376 }
2377
2378
2379 func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator {
2380 return ServerListResultIterator{page: page}
2381 }
2382
2383
2384 func (slr ServerListResult) IsEmpty() bool {
2385 return slr.Value == nil || len(*slr.Value) == 0
2386 }
2387
2388
2389 func (slr ServerListResult) hasNextLink() bool {
2390 return slr.NextLink != nil && len(*slr.NextLink) != 0
2391 }
2392
2393
2394
2395 func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) {
2396 if !slr.hasNextLink() {
2397 return nil, nil
2398 }
2399 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2400 autorest.AsJSON(),
2401 autorest.AsGet(),
2402 autorest.WithBaseURL(to.String(slr.NextLink)))
2403 }
2404
2405
2406 type ServerListResultPage struct {
2407 fn func(context.Context, ServerListResult) (ServerListResult, error)
2408 slr ServerListResult
2409 }
2410
2411
2412
2413 func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) {
2414 if tracing.IsEnabled() {
2415 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext")
2416 defer func() {
2417 sc := -1
2418 if page.Response().Response.Response != nil {
2419 sc = page.Response().Response.Response.StatusCode
2420 }
2421 tracing.EndSpan(ctx, sc, err)
2422 }()
2423 }
2424 for {
2425 next, err := page.fn(ctx, page.slr)
2426 if err != nil {
2427 return err
2428 }
2429 page.slr = next
2430 if !next.hasNextLink() || !next.IsEmpty() {
2431 break
2432 }
2433 }
2434 return nil
2435 }
2436
2437
2438
2439
2440 func (page *ServerListResultPage) Next() error {
2441 return page.NextWithContext(context.Background())
2442 }
2443
2444
2445 func (page ServerListResultPage) NotDone() bool {
2446 return !page.slr.IsEmpty()
2447 }
2448
2449
2450 func (page ServerListResultPage) Response() ServerListResult {
2451 return page.slr
2452 }
2453
2454
2455 func (page ServerListResultPage) Values() []Server {
2456 if page.slr.IsEmpty() {
2457 return nil
2458 }
2459 return *page.slr.Value
2460 }
2461
2462
2463 func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage {
2464 return ServerListResultPage{
2465 fn: getNextPage,
2466 slr: cur,
2467 }
2468 }
2469
2470
2471 type ServerProperties struct {
2472
2473 AdministratorLogin *string `json:"administratorLogin,omitempty"`
2474
2475 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
2476
2477 Version ServerVersion `json:"version,omitempty"`
2478
2479 AvailabilityZone *string `json:"availabilityZone,omitempty"`
2480
2481 CreateMode CreateMode `json:"createMode,omitempty"`
2482
2483 SourceServerResourceID *string `json:"sourceServerResourceId,omitempty"`
2484
2485 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"`
2486
2487 ReplicationRole ReplicationRole `json:"replicationRole,omitempty"`
2488
2489 ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"`
2490
2491 State ServerState `json:"state,omitempty"`
2492
2493 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
2494
2495 Storage *Storage `json:"storage,omitempty"`
2496
2497 Backup *Backup `json:"backup,omitempty"`
2498
2499 HighAvailability *HighAvailability `json:"highAvailability,omitempty"`
2500
2501 Network *Network `json:"network,omitempty"`
2502
2503 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
2504 }
2505
2506
2507 func (sp ServerProperties) MarshalJSON() ([]byte, error) {
2508 objectMap := make(map[string]interface{})
2509 if sp.AdministratorLogin != nil {
2510 objectMap["administratorLogin"] = sp.AdministratorLogin
2511 }
2512 if sp.AdministratorLoginPassword != nil {
2513 objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword
2514 }
2515 if sp.Version != "" {
2516 objectMap["version"] = sp.Version
2517 }
2518 if sp.AvailabilityZone != nil {
2519 objectMap["availabilityZone"] = sp.AvailabilityZone
2520 }
2521 if sp.CreateMode != "" {
2522 objectMap["createMode"] = sp.CreateMode
2523 }
2524 if sp.SourceServerResourceID != nil {
2525 objectMap["sourceServerResourceId"] = sp.SourceServerResourceID
2526 }
2527 if sp.RestorePointInTime != nil {
2528 objectMap["restorePointInTime"] = sp.RestorePointInTime
2529 }
2530 if sp.ReplicationRole != "" {
2531 objectMap["replicationRole"] = sp.ReplicationRole
2532 }
2533 if sp.Storage != nil {
2534 objectMap["storage"] = sp.Storage
2535 }
2536 if sp.Backup != nil {
2537 objectMap["backup"] = sp.Backup
2538 }
2539 if sp.HighAvailability != nil {
2540 objectMap["highAvailability"] = sp.HighAvailability
2541 }
2542 if sp.Network != nil {
2543 objectMap["network"] = sp.Network
2544 }
2545 if sp.MaintenanceWindow != nil {
2546 objectMap["maintenanceWindow"] = sp.MaintenanceWindow
2547 }
2548 return json.Marshal(objectMap)
2549 }
2550
2551
2552 type ServerPropertiesForUpdate struct {
2553
2554 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
2555
2556 Storage *Storage `json:"storage,omitempty"`
2557
2558 Backup *Backup `json:"backup,omitempty"`
2559
2560 HighAvailability *HighAvailability `json:"highAvailability,omitempty"`
2561
2562 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
2563
2564 ReplicationRole ReplicationRole `json:"replicationRole,omitempty"`
2565 }
2566
2567
2568 type ServerRestartParameter struct {
2569
2570 RestartWithFailover EnableStatusEnum `json:"restartWithFailover,omitempty"`
2571
2572 MaxFailoverSeconds *int32 `json:"maxFailoverSeconds,omitempty"`
2573 }
2574
2575
2576
2577 type ServersCreateFuture struct {
2578 azure.FutureAPI
2579
2580
2581 Result func(ServersClient) (Server, error)
2582 }
2583
2584
2585 func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
2586 var azFuture azure.Future
2587 if err := json.Unmarshal(body, &azFuture); err != nil {
2588 return err
2589 }
2590 future.FutureAPI = &azFuture
2591 future.Result = future.result
2592 return nil
2593 }
2594
2595
2596 func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
2597 var done bool
2598 done, err = future.DoneWithContext(context.Background(), client)
2599 if err != nil {
2600 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersCreateFuture", "Result", future.Response(), "Polling failure")
2601 return
2602 }
2603 if !done {
2604 s.Response.Response = future.Response()
2605 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersCreateFuture")
2606 return
2607 }
2608 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2609 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
2610 s, err = client.CreateResponder(s.Response.Response)
2611 if err != nil {
2612 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
2613 }
2614 }
2615 return
2616 }
2617
2618
2619
2620 type ServersDeleteFuture struct {
2621 azure.FutureAPI
2622
2623
2624 Result func(ServersClient) (autorest.Response, error)
2625 }
2626
2627
2628 func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
2629 var azFuture azure.Future
2630 if err := json.Unmarshal(body, &azFuture); err != nil {
2631 return err
2632 }
2633 future.FutureAPI = &azFuture
2634 future.Result = future.result
2635 return nil
2636 }
2637
2638
2639 func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
2640 var done bool
2641 done, err = future.DoneWithContext(context.Background(), client)
2642 if err != nil {
2643 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
2644 return
2645 }
2646 if !done {
2647 ar.Response = future.Response()
2648 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersDeleteFuture")
2649 return
2650 }
2651 ar.Response = future.Response()
2652 return
2653 }
2654
2655
2656
2657 type ServersFailoverFuture struct {
2658 azure.FutureAPI
2659
2660
2661 Result func(ServersClient) (autorest.Response, error)
2662 }
2663
2664
2665 func (future *ServersFailoverFuture) UnmarshalJSON(body []byte) error {
2666 var azFuture azure.Future
2667 if err := json.Unmarshal(body, &azFuture); err != nil {
2668 return err
2669 }
2670 future.FutureAPI = &azFuture
2671 future.Result = future.result
2672 return nil
2673 }
2674
2675
2676 func (future *ServersFailoverFuture) result(client ServersClient) (ar autorest.Response, err error) {
2677 var done bool
2678 done, err = future.DoneWithContext(context.Background(), client)
2679 if err != nil {
2680 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersFailoverFuture", "Result", future.Response(), "Polling failure")
2681 return
2682 }
2683 if !done {
2684 ar.Response = future.Response()
2685 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersFailoverFuture")
2686 return
2687 }
2688 ar.Response = future.Response()
2689 return
2690 }
2691
2692
2693
2694 type ServersRestartFuture struct {
2695 azure.FutureAPI
2696
2697
2698 Result func(ServersClient) (autorest.Response, error)
2699 }
2700
2701
2702 func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error {
2703 var azFuture azure.Future
2704 if err := json.Unmarshal(body, &azFuture); err != nil {
2705 return err
2706 }
2707 future.FutureAPI = &azFuture
2708 future.Result = future.result
2709 return nil
2710 }
2711
2712
2713 func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {
2714 var done bool
2715 done, err = future.DoneWithContext(context.Background(), client)
2716 if err != nil {
2717 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersRestartFuture", "Result", future.Response(), "Polling failure")
2718 return
2719 }
2720 if !done {
2721 ar.Response = future.Response()
2722 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersRestartFuture")
2723 return
2724 }
2725 ar.Response = future.Response()
2726 return
2727 }
2728
2729
2730 type ServersStartFuture struct {
2731 azure.FutureAPI
2732
2733
2734 Result func(ServersClient) (autorest.Response, error)
2735 }
2736
2737
2738 func (future *ServersStartFuture) UnmarshalJSON(body []byte) error {
2739 var azFuture azure.Future
2740 if err := json.Unmarshal(body, &azFuture); err != nil {
2741 return err
2742 }
2743 future.FutureAPI = &azFuture
2744 future.Result = future.result
2745 return nil
2746 }
2747
2748
2749 func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) {
2750 var done bool
2751 done, err = future.DoneWithContext(context.Background(), client)
2752 if err != nil {
2753 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersStartFuture", "Result", future.Response(), "Polling failure")
2754 return
2755 }
2756 if !done {
2757 ar.Response = future.Response()
2758 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersStartFuture")
2759 return
2760 }
2761 ar.Response = future.Response()
2762 return
2763 }
2764
2765
2766 type ServersStopFuture struct {
2767 azure.FutureAPI
2768
2769
2770 Result func(ServersClient) (autorest.Response, error)
2771 }
2772
2773
2774 func (future *ServersStopFuture) UnmarshalJSON(body []byte) error {
2775 var azFuture azure.Future
2776 if err := json.Unmarshal(body, &azFuture); err != nil {
2777 return err
2778 }
2779 future.FutureAPI = &azFuture
2780 future.Result = future.result
2781 return nil
2782 }
2783
2784
2785 func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) {
2786 var done bool
2787 done, err = future.DoneWithContext(context.Background(), client)
2788 if err != nil {
2789 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersStopFuture", "Result", future.Response(), "Polling failure")
2790 return
2791 }
2792 if !done {
2793 ar.Response = future.Response()
2794 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersStopFuture")
2795 return
2796 }
2797 ar.Response = future.Response()
2798 return
2799 }
2800
2801
2802
2803 type ServersUpdateFuture struct {
2804 azure.FutureAPI
2805
2806
2807 Result func(ServersClient) (Server, error)
2808 }
2809
2810
2811 func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
2812 var azFuture azure.Future
2813 if err := json.Unmarshal(body, &azFuture); err != nil {
2814 return err
2815 }
2816 future.FutureAPI = &azFuture
2817 future.Result = future.result
2818 return nil
2819 }
2820
2821
2822 func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
2823 var done bool
2824 done, err = future.DoneWithContext(context.Background(), client)
2825 if err != nil {
2826 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
2827 return
2828 }
2829 if !done {
2830 s.Response.Response = future.Response()
2831 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersUpdateFuture")
2832 return
2833 }
2834 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2835 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
2836 s, err = client.UpdateResponder(s.Response.Response)
2837 if err != nil {
2838 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
2839 }
2840 }
2841 return
2842 }
2843
2844
2845 type ServerVersionCapability struct {
2846
2847 Name *string `json:"name,omitempty"`
2848
2849 SupportedSkus *[]SkuCapability `json:"supportedSkus,omitempty"`
2850 }
2851
2852
2853 func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) {
2854 objectMap := make(map[string]interface{})
2855 return json.Marshal(objectMap)
2856 }
2857
2858
2859 type Sku struct {
2860
2861 Name *string `json:"name,omitempty"`
2862
2863 Tier SkuTier `json:"tier,omitempty"`
2864 }
2865
2866
2867 type SkuCapability struct {
2868
2869 Name *string `json:"name,omitempty"`
2870
2871 VCores *int64 `json:"vCores,omitempty"`
2872
2873 SupportedIops *int64 `json:"supportedIops,omitempty"`
2874
2875 SupportedMemoryPerVCoreMB *int64 `json:"supportedMemoryPerVCoreMB,omitempty"`
2876 }
2877
2878
2879 func (sc SkuCapability) MarshalJSON() ([]byte, error) {
2880 objectMap := make(map[string]interface{})
2881 return json.Marshal(objectMap)
2882 }
2883
2884
2885 type Storage struct {
2886
2887 StorageSizeGB *int32 `json:"storageSizeGB,omitempty"`
2888
2889 Iops *int32 `json:"iops,omitempty"`
2890
2891 AutoGrow EnableStatusEnum `json:"autoGrow,omitempty"`
2892
2893 StorageSku *string `json:"storageSku,omitempty"`
2894 }
2895
2896
2897 func (s Storage) MarshalJSON() ([]byte, error) {
2898 objectMap := make(map[string]interface{})
2899 if s.StorageSizeGB != nil {
2900 objectMap["storageSizeGB"] = s.StorageSizeGB
2901 }
2902 if s.Iops != nil {
2903 objectMap["iops"] = s.Iops
2904 }
2905 if s.AutoGrow != "" {
2906 objectMap["autoGrow"] = s.AutoGrow
2907 }
2908 return json.Marshal(objectMap)
2909 }
2910
2911
2912 type StorageEditionCapability struct {
2913
2914 Name *string `json:"name,omitempty"`
2915
2916 MinStorageSize *int64 `json:"minStorageSize,omitempty"`
2917
2918 MaxStorageSize *int64 `json:"maxStorageSize,omitempty"`
2919
2920 MinBackupRetentionDays *int64 `json:"minBackupRetentionDays,omitempty"`
2921
2922 MaxBackupRetentionDays *int64 `json:"maxBackupRetentionDays,omitempty"`
2923 }
2924
2925
2926 func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) {
2927 objectMap := make(map[string]interface{})
2928 return json.Marshal(objectMap)
2929 }
2930
2931
2932 type SystemData struct {
2933
2934 CreatedBy *string `json:"createdBy,omitempty"`
2935
2936 CreatedByType CreatedByType `json:"createdByType,omitempty"`
2937
2938 CreatedAt *date.Time `json:"createdAt,omitempty"`
2939
2940 LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
2941
2942 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
2943
2944 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
2945 }
2946
2947
2948
2949 type TrackedResource struct {
2950
2951 Tags map[string]*string `json:"tags"`
2952
2953 Location *string `json:"location,omitempty"`
2954
2955 ID *string `json:"id,omitempty"`
2956
2957 Name *string `json:"name,omitempty"`
2958
2959 Type *string `json:"type,omitempty"`
2960 }
2961
2962
2963 func (tr TrackedResource) MarshalJSON() ([]byte, error) {
2964 objectMap := make(map[string]interface{})
2965 if tr.Tags != nil {
2966 objectMap["tags"] = tr.Tags
2967 }
2968 if tr.Location != nil {
2969 objectMap["location"] = tr.Location
2970 }
2971 return json.Marshal(objectMap)
2972 }
2973
2974
2975 type VirtualNetworkSubnetUsageParameter struct {
2976
2977 VirtualNetworkResourceID *string `json:"virtualNetworkResourceId,omitempty"`
2978 }
2979
2980
2981 type VirtualNetworkSubnetUsageResult struct {
2982 autorest.Response `json:"-"`
2983
2984 DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"`
2985 }
2986
2987
2988 func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) {
2989 objectMap := make(map[string]interface{})
2990 return json.Marshal(objectMap)
2991 }
2992
View as plain text