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