1 package mariadb
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/mariadb/mgmt/2018-06-01/mariadb"
22
23
24 type Advisor struct {
25 autorest.Response `json:"-"`
26
27 Properties interface{} `json:"properties,omitempty"`
28
29 ID *string `json:"id,omitempty"`
30
31 Name *string `json:"name,omitempty"`
32
33 Type *string `json:"type,omitempty"`
34 }
35
36
37 func (a Advisor) MarshalJSON() ([]byte, error) {
38 objectMap := make(map[string]interface{})
39 if a.Properties != nil {
40 objectMap["properties"] = a.Properties
41 }
42 return json.Marshal(objectMap)
43 }
44
45
46 type AdvisorsResultList struct {
47 autorest.Response `json:"-"`
48
49 Value *[]Advisor `json:"value,omitempty"`
50
51 NextLink *string `json:"nextLink,omitempty"`
52 }
53
54
55 func (arl AdvisorsResultList) MarshalJSON() ([]byte, error) {
56 objectMap := make(map[string]interface{})
57 return json.Marshal(objectMap)
58 }
59
60
61 type AdvisorsResultListIterator struct {
62 i int
63 page AdvisorsResultListPage
64 }
65
66
67
68 func (iter *AdvisorsResultListIterator) NextWithContext(ctx context.Context) (err error) {
69 if tracing.IsEnabled() {
70 ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListIterator.NextWithContext")
71 defer func() {
72 sc := -1
73 if iter.Response().Response.Response != nil {
74 sc = iter.Response().Response.Response.StatusCode
75 }
76 tracing.EndSpan(ctx, sc, err)
77 }()
78 }
79 iter.i++
80 if iter.i < len(iter.page.Values()) {
81 return nil
82 }
83 err = iter.page.NextWithContext(ctx)
84 if err != nil {
85 iter.i--
86 return err
87 }
88 iter.i = 0
89 return nil
90 }
91
92
93
94
95 func (iter *AdvisorsResultListIterator) Next() error {
96 return iter.NextWithContext(context.Background())
97 }
98
99
100 func (iter AdvisorsResultListIterator) NotDone() bool {
101 return iter.page.NotDone() && iter.i < len(iter.page.Values())
102 }
103
104
105 func (iter AdvisorsResultListIterator) Response() AdvisorsResultList {
106 return iter.page.Response()
107 }
108
109
110
111 func (iter AdvisorsResultListIterator) Value() Advisor {
112 if !iter.page.NotDone() {
113 return Advisor{}
114 }
115 return iter.page.Values()[iter.i]
116 }
117
118
119 func NewAdvisorsResultListIterator(page AdvisorsResultListPage) AdvisorsResultListIterator {
120 return AdvisorsResultListIterator{page: page}
121 }
122
123
124 func (arl AdvisorsResultList) IsEmpty() bool {
125 return arl.Value == nil || len(*arl.Value) == 0
126 }
127
128
129 func (arl AdvisorsResultList) hasNextLink() bool {
130 return arl.NextLink != nil && len(*arl.NextLink) != 0
131 }
132
133
134
135 func (arl AdvisorsResultList) advisorsResultListPreparer(ctx context.Context) (*http.Request, error) {
136 if !arl.hasNextLink() {
137 return nil, nil
138 }
139 return autorest.Prepare((&http.Request{}).WithContext(ctx),
140 autorest.AsJSON(),
141 autorest.AsGet(),
142 autorest.WithBaseURL(to.String(arl.NextLink)))
143 }
144
145
146 type AdvisorsResultListPage struct {
147 fn func(context.Context, AdvisorsResultList) (AdvisorsResultList, error)
148 arl AdvisorsResultList
149 }
150
151
152
153 func (page *AdvisorsResultListPage) NextWithContext(ctx context.Context) (err error) {
154 if tracing.IsEnabled() {
155 ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListPage.NextWithContext")
156 defer func() {
157 sc := -1
158 if page.Response().Response.Response != nil {
159 sc = page.Response().Response.Response.StatusCode
160 }
161 tracing.EndSpan(ctx, sc, err)
162 }()
163 }
164 for {
165 next, err := page.fn(ctx, page.arl)
166 if err != nil {
167 return err
168 }
169 page.arl = next
170 if !next.hasNextLink() || !next.IsEmpty() {
171 break
172 }
173 }
174 return nil
175 }
176
177
178
179
180 func (page *AdvisorsResultListPage) Next() error {
181 return page.NextWithContext(context.Background())
182 }
183
184
185 func (page AdvisorsResultListPage) NotDone() bool {
186 return !page.arl.IsEmpty()
187 }
188
189
190 func (page AdvisorsResultListPage) Response() AdvisorsResultList {
191 return page.arl
192 }
193
194
195 func (page AdvisorsResultListPage) Values() []Advisor {
196 if page.arl.IsEmpty() {
197 return nil
198 }
199 return *page.arl.Value
200 }
201
202
203 func NewAdvisorsResultListPage(cur AdvisorsResultList, getNextPage func(context.Context, AdvisorsResultList) (AdvisorsResultList, error)) AdvisorsResultListPage {
204 return AdvisorsResultListPage{
205 fn: getNextPage,
206 arl: cur,
207 }
208 }
209
210
211 type AzureEntityResource struct {
212
213 Etag *string `json:"etag,omitempty"`
214
215 ID *string `json:"id,omitempty"`
216
217 Name *string `json:"name,omitempty"`
218
219 Type *string `json:"type,omitempty"`
220 }
221
222
223 func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
224 objectMap := make(map[string]interface{})
225 return json.Marshal(objectMap)
226 }
227
228
229 type CloudError struct {
230 Error *ErrorResponse `json:"error,omitempty"`
231 }
232
233
234 type Configuration struct {
235 autorest.Response `json:"-"`
236
237 *ConfigurationProperties `json:"properties,omitempty"`
238
239 ID *string `json:"id,omitempty"`
240
241 Name *string `json:"name,omitempty"`
242
243 Type *string `json:"type,omitempty"`
244 }
245
246
247 func (c Configuration) MarshalJSON() ([]byte, error) {
248 objectMap := make(map[string]interface{})
249 if c.ConfigurationProperties != nil {
250 objectMap["properties"] = c.ConfigurationProperties
251 }
252 return json.Marshal(objectMap)
253 }
254
255
256 func (c *Configuration) UnmarshalJSON(body []byte) error {
257 var m map[string]*json.RawMessage
258 err := json.Unmarshal(body, &m)
259 if err != nil {
260 return err
261 }
262 for k, v := range m {
263 switch k {
264 case "properties":
265 if v != nil {
266 var configurationProperties ConfigurationProperties
267 err = json.Unmarshal(*v, &configurationProperties)
268 if err != nil {
269 return err
270 }
271 c.ConfigurationProperties = &configurationProperties
272 }
273 case "id":
274 if v != nil {
275 var ID string
276 err = json.Unmarshal(*v, &ID)
277 if err != nil {
278 return err
279 }
280 c.ID = &ID
281 }
282 case "name":
283 if v != nil {
284 var name string
285 err = json.Unmarshal(*v, &name)
286 if err != nil {
287 return err
288 }
289 c.Name = &name
290 }
291 case "type":
292 if v != nil {
293 var typeVar string
294 err = json.Unmarshal(*v, &typeVar)
295 if err != nil {
296 return err
297 }
298 c.Type = &typeVar
299 }
300 }
301 }
302
303 return nil
304 }
305
306
307 type ConfigurationListResult struct {
308 autorest.Response `json:"-"`
309
310 Value *[]Configuration `json:"value,omitempty"`
311 }
312
313
314 type ConfigurationProperties struct {
315
316 Value *string `json:"value,omitempty"`
317
318 Description *string `json:"description,omitempty"`
319
320 DefaultValue *string `json:"defaultValue,omitempty"`
321
322 DataType *string `json:"dataType,omitempty"`
323
324 AllowedValues *string `json:"allowedValues,omitempty"`
325
326 Source *string `json:"source,omitempty"`
327 }
328
329
330 func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) {
331 objectMap := make(map[string]interface{})
332 if cp.Value != nil {
333 objectMap["value"] = cp.Value
334 }
335 if cp.Source != nil {
336 objectMap["source"] = cp.Source
337 }
338 return json.Marshal(objectMap)
339 }
340
341
342
343 type ConfigurationsCreateOrUpdateFuture struct {
344 azure.FutureAPI
345
346
347 Result func(ConfigurationsClient) (Configuration, error)
348 }
349
350
351 func (future *ConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
352 var azFuture azure.Future
353 if err := json.Unmarshal(body, &azFuture); err != nil {
354 return err
355 }
356 future.FutureAPI = &azFuture
357 future.Result = future.result
358 return nil
359 }
360
361
362 func (future *ConfigurationsCreateOrUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) {
363 var done bool
364 done, err = future.DoneWithContext(context.Background(), client)
365 if err != nil {
366 err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
367 return
368 }
369 if !done {
370 c.Response.Response = future.Response()
371 err = azure.NewAsyncOpIncompleteError("mariadb.ConfigurationsCreateOrUpdateFuture")
372 return
373 }
374 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
375 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
376 c, err = client.CreateOrUpdateResponder(c.Response.Response)
377 if err != nil {
378 err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
379 }
380 }
381 return
382 }
383
384
385
386 type CreateRecommendedActionSessionFuture struct {
387 azure.FutureAPI
388
389
390 Result func(BaseClient) (autorest.Response, error)
391 }
392
393
394 func (future *CreateRecommendedActionSessionFuture) UnmarshalJSON(body []byte) error {
395 var azFuture azure.Future
396 if err := json.Unmarshal(body, &azFuture); err != nil {
397 return err
398 }
399 future.FutureAPI = &azFuture
400 future.Result = future.result
401 return nil
402 }
403
404
405 func (future *CreateRecommendedActionSessionFuture) result(client BaseClient) (ar autorest.Response, err error) {
406 var done bool
407 done, err = future.DoneWithContext(context.Background(), client)
408 if err != nil {
409 err = autorest.NewErrorWithError(err, "mariadb.CreateRecommendedActionSessionFuture", "Result", future.Response(), "Polling failure")
410 return
411 }
412 if !done {
413 ar.Response = future.Response()
414 err = azure.NewAsyncOpIncompleteError("mariadb.CreateRecommendedActionSessionFuture")
415 return
416 }
417 ar.Response = future.Response()
418 return
419 }
420
421
422 type Database struct {
423 autorest.Response `json:"-"`
424
425 *DatabaseProperties `json:"properties,omitempty"`
426
427 ID *string `json:"id,omitempty"`
428
429 Name *string `json:"name,omitempty"`
430
431 Type *string `json:"type,omitempty"`
432 }
433
434
435 func (d Database) MarshalJSON() ([]byte, error) {
436 objectMap := make(map[string]interface{})
437 if d.DatabaseProperties != nil {
438 objectMap["properties"] = d.DatabaseProperties
439 }
440 return json.Marshal(objectMap)
441 }
442
443
444 func (d *Database) UnmarshalJSON(body []byte) error {
445 var m map[string]*json.RawMessage
446 err := json.Unmarshal(body, &m)
447 if err != nil {
448 return err
449 }
450 for k, v := range m {
451 switch k {
452 case "properties":
453 if v != nil {
454 var databaseProperties DatabaseProperties
455 err = json.Unmarshal(*v, &databaseProperties)
456 if err != nil {
457 return err
458 }
459 d.DatabaseProperties = &databaseProperties
460 }
461 case "id":
462 if v != nil {
463 var ID string
464 err = json.Unmarshal(*v, &ID)
465 if err != nil {
466 return err
467 }
468 d.ID = &ID
469 }
470 case "name":
471 if v != nil {
472 var name string
473 err = json.Unmarshal(*v, &name)
474 if err != nil {
475 return err
476 }
477 d.Name = &name
478 }
479 case "type":
480 if v != nil {
481 var typeVar string
482 err = json.Unmarshal(*v, &typeVar)
483 if err != nil {
484 return err
485 }
486 d.Type = &typeVar
487 }
488 }
489 }
490
491 return nil
492 }
493
494
495 type DatabaseListResult struct {
496 autorest.Response `json:"-"`
497
498 Value *[]Database `json:"value,omitempty"`
499 }
500
501
502 type DatabaseProperties struct {
503
504 Charset *string `json:"charset,omitempty"`
505
506 Collation *string `json:"collation,omitempty"`
507 }
508
509
510
511 type DatabasesCreateOrUpdateFuture struct {
512 azure.FutureAPI
513
514
515 Result func(DatabasesClient) (Database, error)
516 }
517
518
519 func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
520 var azFuture azure.Future
521 if err := json.Unmarshal(body, &azFuture); err != nil {
522 return err
523 }
524 future.FutureAPI = &azFuture
525 future.Result = future.result
526 return nil
527 }
528
529
530 func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) {
531 var done bool
532 done, err = future.DoneWithContext(context.Background(), client)
533 if err != nil {
534 err = autorest.NewErrorWithError(err, "mariadb.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
535 return
536 }
537 if !done {
538 d.Response.Response = future.Response()
539 err = azure.NewAsyncOpIncompleteError("mariadb.DatabasesCreateOrUpdateFuture")
540 return
541 }
542 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
543 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
544 d, err = client.CreateOrUpdateResponder(d.Response.Response)
545 if err != nil {
546 err = autorest.NewErrorWithError(err, "mariadb.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request")
547 }
548 }
549 return
550 }
551
552
553
554 type DatabasesDeleteFuture struct {
555 azure.FutureAPI
556
557
558 Result func(DatabasesClient) (autorest.Response, error)
559 }
560
561
562 func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error {
563 var azFuture azure.Future
564 if err := json.Unmarshal(body, &azFuture); err != nil {
565 return err
566 }
567 future.FutureAPI = &azFuture
568 future.Result = future.result
569 return nil
570 }
571
572
573 func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) {
574 var done bool
575 done, err = future.DoneWithContext(context.Background(), client)
576 if err != nil {
577 err = autorest.NewErrorWithError(err, "mariadb.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
578 return
579 }
580 if !done {
581 ar.Response = future.Response()
582 err = azure.NewAsyncOpIncompleteError("mariadb.DatabasesDeleteFuture")
583 return
584 }
585 ar.Response = future.Response()
586 return
587 }
588
589
590 type ErrorAdditionalInfo struct {
591
592 Type *string `json:"type,omitempty"`
593
594 Info interface{} `json:"info,omitempty"`
595 }
596
597
598 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
599 objectMap := make(map[string]interface{})
600 return json.Marshal(objectMap)
601 }
602
603
604
605 type ErrorResponse struct {
606
607 Code *string `json:"code,omitempty"`
608
609 Message *string `json:"message,omitempty"`
610
611 Target *string `json:"target,omitempty"`
612
613 Details *[]ErrorResponse `json:"details,omitempty"`
614
615 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
616 }
617
618
619 func (er ErrorResponse) MarshalJSON() ([]byte, error) {
620 objectMap := make(map[string]interface{})
621 return json.Marshal(objectMap)
622 }
623
624
625 type FirewallRule struct {
626 autorest.Response `json:"-"`
627
628 *FirewallRuleProperties `json:"properties,omitempty"`
629
630 ID *string `json:"id,omitempty"`
631
632 Name *string `json:"name,omitempty"`
633
634 Type *string `json:"type,omitempty"`
635 }
636
637
638 func (fr FirewallRule) MarshalJSON() ([]byte, error) {
639 objectMap := make(map[string]interface{})
640 if fr.FirewallRuleProperties != nil {
641 objectMap["properties"] = fr.FirewallRuleProperties
642 }
643 return json.Marshal(objectMap)
644 }
645
646
647 func (fr *FirewallRule) UnmarshalJSON(body []byte) error {
648 var m map[string]*json.RawMessage
649 err := json.Unmarshal(body, &m)
650 if err != nil {
651 return err
652 }
653 for k, v := range m {
654 switch k {
655 case "properties":
656 if v != nil {
657 var firewallRuleProperties FirewallRuleProperties
658 err = json.Unmarshal(*v, &firewallRuleProperties)
659 if err != nil {
660 return err
661 }
662 fr.FirewallRuleProperties = &firewallRuleProperties
663 }
664 case "id":
665 if v != nil {
666 var ID string
667 err = json.Unmarshal(*v, &ID)
668 if err != nil {
669 return err
670 }
671 fr.ID = &ID
672 }
673 case "name":
674 if v != nil {
675 var name string
676 err = json.Unmarshal(*v, &name)
677 if err != nil {
678 return err
679 }
680 fr.Name = &name
681 }
682 case "type":
683 if v != nil {
684 var typeVar string
685 err = json.Unmarshal(*v, &typeVar)
686 if err != nil {
687 return err
688 }
689 fr.Type = &typeVar
690 }
691 }
692 }
693
694 return nil
695 }
696
697
698 type FirewallRuleListResult struct {
699 autorest.Response `json:"-"`
700
701 Value *[]FirewallRule `json:"value,omitempty"`
702 }
703
704
705 type FirewallRuleProperties struct {
706
707 StartIPAddress *string `json:"startIpAddress,omitempty"`
708
709 EndIPAddress *string `json:"endIpAddress,omitempty"`
710 }
711
712
713
714 type FirewallRulesCreateOrUpdateFuture struct {
715 azure.FutureAPI
716
717
718 Result func(FirewallRulesClient) (FirewallRule, error)
719 }
720
721
722 func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
723 var azFuture azure.Future
724 if err := json.Unmarshal(body, &azFuture); err != nil {
725 return err
726 }
727 future.FutureAPI = &azFuture
728 future.Result = future.result
729 return nil
730 }
731
732
733 func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) {
734 var done bool
735 done, err = future.DoneWithContext(context.Background(), client)
736 if err != nil {
737 err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
738 return
739 }
740 if !done {
741 fr.Response.Response = future.Response()
742 err = azure.NewAsyncOpIncompleteError("mariadb.FirewallRulesCreateOrUpdateFuture")
743 return
744 }
745 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
746 if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent {
747 fr, err = client.CreateOrUpdateResponder(fr.Response.Response)
748 if err != nil {
749 err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request")
750 }
751 }
752 return
753 }
754
755
756
757 type FirewallRulesDeleteFuture struct {
758 azure.FutureAPI
759
760
761 Result func(FirewallRulesClient) (autorest.Response, error)
762 }
763
764
765 func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error {
766 var azFuture azure.Future
767 if err := json.Unmarshal(body, &azFuture); err != nil {
768 return err
769 }
770 future.FutureAPI = &azFuture
771 future.Result = future.result
772 return nil
773 }
774
775
776 func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) {
777 var done bool
778 done, err = future.DoneWithContext(context.Background(), client)
779 if err != nil {
780 err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure")
781 return
782 }
783 if !done {
784 ar.Response = future.Response()
785 err = azure.NewAsyncOpIncompleteError("mariadb.FirewallRulesDeleteFuture")
786 return
787 }
788 ar.Response = future.Response()
789 return
790 }
791
792
793 type LogFile struct {
794
795 *LogFileProperties `json:"properties,omitempty"`
796
797 ID *string `json:"id,omitempty"`
798
799 Name *string `json:"name,omitempty"`
800
801 Type *string `json:"type,omitempty"`
802 }
803
804
805 func (lf LogFile) MarshalJSON() ([]byte, error) {
806 objectMap := make(map[string]interface{})
807 if lf.LogFileProperties != nil {
808 objectMap["properties"] = lf.LogFileProperties
809 }
810 return json.Marshal(objectMap)
811 }
812
813
814 func (lf *LogFile) UnmarshalJSON(body []byte) error {
815 var m map[string]*json.RawMessage
816 err := json.Unmarshal(body, &m)
817 if err != nil {
818 return err
819 }
820 for k, v := range m {
821 switch k {
822 case "properties":
823 if v != nil {
824 var logFileProperties LogFileProperties
825 err = json.Unmarshal(*v, &logFileProperties)
826 if err != nil {
827 return err
828 }
829 lf.LogFileProperties = &logFileProperties
830 }
831 case "id":
832 if v != nil {
833 var ID string
834 err = json.Unmarshal(*v, &ID)
835 if err != nil {
836 return err
837 }
838 lf.ID = &ID
839 }
840 case "name":
841 if v != nil {
842 var name string
843 err = json.Unmarshal(*v, &name)
844 if err != nil {
845 return err
846 }
847 lf.Name = &name
848 }
849 case "type":
850 if v != nil {
851 var typeVar string
852 err = json.Unmarshal(*v, &typeVar)
853 if err != nil {
854 return err
855 }
856 lf.Type = &typeVar
857 }
858 }
859 }
860
861 return nil
862 }
863
864
865 type LogFileListResult struct {
866 autorest.Response `json:"-"`
867
868 Value *[]LogFile `json:"value,omitempty"`
869 }
870
871
872 type LogFileProperties struct {
873
874 SizeInKB *int64 `json:"sizeInKB,omitempty"`
875
876 CreatedTime *date.Time `json:"createdTime,omitempty"`
877
878 LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"`
879
880 Type *string `json:"type,omitempty"`
881
882 URL *string `json:"url,omitempty"`
883 }
884
885
886 func (lfp LogFileProperties) MarshalJSON() ([]byte, error) {
887 objectMap := make(map[string]interface{})
888 if lfp.SizeInKB != nil {
889 objectMap["sizeInKB"] = lfp.SizeInKB
890 }
891 if lfp.Type != nil {
892 objectMap["type"] = lfp.Type
893 }
894 return json.Marshal(objectMap)
895 }
896
897
898 type NameAvailability struct {
899 autorest.Response `json:"-"`
900
901 Message *string `json:"message,omitempty"`
902
903 NameAvailable *bool `json:"nameAvailable,omitempty"`
904
905 Reason *string `json:"reason,omitempty"`
906 }
907
908
909 type NameAvailabilityRequest struct {
910
911 Name *string `json:"name,omitempty"`
912
913 Type *string `json:"type,omitempty"`
914 }
915
916
917 type Operation struct {
918
919 Name *string `json:"name,omitempty"`
920
921 Display *OperationDisplay `json:"display,omitempty"`
922
923 Origin OperationOrigin `json:"origin,omitempty"`
924
925 Properties map[string]interface{} `json:"properties"`
926 }
927
928
929 func (o Operation) MarshalJSON() ([]byte, error) {
930 objectMap := make(map[string]interface{})
931 return json.Marshal(objectMap)
932 }
933
934
935 type OperationDisplay struct {
936
937 Provider *string `json:"provider,omitempty"`
938
939 Resource *string `json:"resource,omitempty"`
940
941 Operation *string `json:"operation,omitempty"`
942
943 Description *string `json:"description,omitempty"`
944 }
945
946
947 func (od OperationDisplay) MarshalJSON() ([]byte, error) {
948 objectMap := make(map[string]interface{})
949 return json.Marshal(objectMap)
950 }
951
952
953 type OperationListResult struct {
954 autorest.Response `json:"-"`
955
956 Value *[]Operation `json:"value,omitempty"`
957 }
958
959
960 type PerformanceTierListResult struct {
961 autorest.Response `json:"-"`
962
963 Value *[]PerformanceTierProperties `json:"value,omitempty"`
964 }
965
966
967 type PerformanceTierProperties struct {
968
969 ID *string `json:"id,omitempty"`
970
971 ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"`
972 }
973
974
975 type PerformanceTierServiceLevelObjectives struct {
976
977 ID *string `json:"id,omitempty"`
978
979 Edition *string `json:"edition,omitempty"`
980
981 VCore *int32 `json:"vCore,omitempty"`
982
983 HardwareGeneration *string `json:"hardwareGeneration,omitempty"`
984
985 MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"`
986
987 MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"`
988
989 MaxStorageMB *int32 `json:"maxStorageMB,omitempty"`
990
991 MinStorageMB *int32 `json:"minStorageMB,omitempty"`
992 }
993
994
995 type PrivateEndpointConnection struct {
996 autorest.Response `json:"-"`
997
998 *PrivateEndpointConnectionProperties `json:"properties,omitempty"`
999
1000 ID *string `json:"id,omitempty"`
1001
1002 Name *string `json:"name,omitempty"`
1003
1004 Type *string `json:"type,omitempty"`
1005 }
1006
1007
1008 func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
1009 objectMap := make(map[string]interface{})
1010 if pec.PrivateEndpointConnectionProperties != nil {
1011 objectMap["properties"] = pec.PrivateEndpointConnectionProperties
1012 }
1013 return json.Marshal(objectMap)
1014 }
1015
1016
1017 func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error {
1018 var m map[string]*json.RawMessage
1019 err := json.Unmarshal(body, &m)
1020 if err != nil {
1021 return err
1022 }
1023 for k, v := range m {
1024 switch k {
1025 case "properties":
1026 if v != nil {
1027 var privateEndpointConnectionProperties PrivateEndpointConnectionProperties
1028 err = json.Unmarshal(*v, &privateEndpointConnectionProperties)
1029 if err != nil {
1030 return err
1031 }
1032 pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties
1033 }
1034 case "id":
1035 if v != nil {
1036 var ID string
1037 err = json.Unmarshal(*v, &ID)
1038 if err != nil {
1039 return err
1040 }
1041 pec.ID = &ID
1042 }
1043 case "name":
1044 if v != nil {
1045 var name string
1046 err = json.Unmarshal(*v, &name)
1047 if err != nil {
1048 return err
1049 }
1050 pec.Name = &name
1051 }
1052 case "type":
1053 if v != nil {
1054 var typeVar string
1055 err = json.Unmarshal(*v, &typeVar)
1056 if err != nil {
1057 return err
1058 }
1059 pec.Type = &typeVar
1060 }
1061 }
1062 }
1063
1064 return nil
1065 }
1066
1067
1068 type PrivateEndpointConnectionListResult struct {
1069 autorest.Response `json:"-"`
1070
1071 Value *[]PrivateEndpointConnection `json:"value,omitempty"`
1072
1073 NextLink *string `json:"nextLink,omitempty"`
1074 }
1075
1076
1077 func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) {
1078 objectMap := make(map[string]interface{})
1079 return json.Marshal(objectMap)
1080 }
1081
1082
1083
1084 type PrivateEndpointConnectionListResultIterator struct {
1085 i int
1086 page PrivateEndpointConnectionListResultPage
1087 }
1088
1089
1090
1091 func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) {
1092 if tracing.IsEnabled() {
1093 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext")
1094 defer func() {
1095 sc := -1
1096 if iter.Response().Response.Response != nil {
1097 sc = iter.Response().Response.Response.StatusCode
1098 }
1099 tracing.EndSpan(ctx, sc, err)
1100 }()
1101 }
1102 iter.i++
1103 if iter.i < len(iter.page.Values()) {
1104 return nil
1105 }
1106 err = iter.page.NextWithContext(ctx)
1107 if err != nil {
1108 iter.i--
1109 return err
1110 }
1111 iter.i = 0
1112 return nil
1113 }
1114
1115
1116
1117
1118 func (iter *PrivateEndpointConnectionListResultIterator) Next() error {
1119 return iter.NextWithContext(context.Background())
1120 }
1121
1122
1123 func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool {
1124 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1125 }
1126
1127
1128 func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult {
1129 return iter.page.Response()
1130 }
1131
1132
1133
1134 func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection {
1135 if !iter.page.NotDone() {
1136 return PrivateEndpointConnection{}
1137 }
1138 return iter.page.Values()[iter.i]
1139 }
1140
1141
1142 func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator {
1143 return PrivateEndpointConnectionListResultIterator{page: page}
1144 }
1145
1146
1147 func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool {
1148 return peclr.Value == nil || len(*peclr.Value) == 0
1149 }
1150
1151
1152 func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool {
1153 return peclr.NextLink != nil && len(*peclr.NextLink) != 0
1154 }
1155
1156
1157
1158 func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) {
1159 if !peclr.hasNextLink() {
1160 return nil, nil
1161 }
1162 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1163 autorest.AsJSON(),
1164 autorest.AsGet(),
1165 autorest.WithBaseURL(to.String(peclr.NextLink)))
1166 }
1167
1168
1169 type PrivateEndpointConnectionListResultPage struct {
1170 fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)
1171 peclr PrivateEndpointConnectionListResult
1172 }
1173
1174
1175
1176 func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) {
1177 if tracing.IsEnabled() {
1178 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext")
1179 defer func() {
1180 sc := -1
1181 if page.Response().Response.Response != nil {
1182 sc = page.Response().Response.Response.StatusCode
1183 }
1184 tracing.EndSpan(ctx, sc, err)
1185 }()
1186 }
1187 for {
1188 next, err := page.fn(ctx, page.peclr)
1189 if err != nil {
1190 return err
1191 }
1192 page.peclr = next
1193 if !next.hasNextLink() || !next.IsEmpty() {
1194 break
1195 }
1196 }
1197 return nil
1198 }
1199
1200
1201
1202
1203 func (page *PrivateEndpointConnectionListResultPage) Next() error {
1204 return page.NextWithContext(context.Background())
1205 }
1206
1207
1208 func (page PrivateEndpointConnectionListResultPage) NotDone() bool {
1209 return !page.peclr.IsEmpty()
1210 }
1211
1212
1213 func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult {
1214 return page.peclr
1215 }
1216
1217
1218 func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection {
1219 if page.peclr.IsEmpty() {
1220 return nil
1221 }
1222 return *page.peclr.Value
1223 }
1224
1225
1226 func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage {
1227 return PrivateEndpointConnectionListResultPage{
1228 fn: getNextPage,
1229 peclr: cur,
1230 }
1231 }
1232
1233
1234 type PrivateEndpointConnectionProperties struct {
1235
1236 PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"`
1237
1238 PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"`
1239
1240 ProvisioningState *string `json:"provisioningState,omitempty"`
1241 }
1242
1243
1244 func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) {
1245 objectMap := make(map[string]interface{})
1246 if pecp.PrivateEndpoint != nil {
1247 objectMap["privateEndpoint"] = pecp.PrivateEndpoint
1248 }
1249 if pecp.PrivateLinkServiceConnectionState != nil {
1250 objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState
1251 }
1252 return json.Marshal(objectMap)
1253 }
1254
1255
1256
1257 type PrivateEndpointConnectionsCreateOrUpdateFuture struct {
1258 azure.FutureAPI
1259
1260
1261 Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error)
1262 }
1263
1264
1265 func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1266 var azFuture azure.Future
1267 if err := json.Unmarshal(body, &azFuture); err != nil {
1268 return err
1269 }
1270 future.FutureAPI = &azFuture
1271 future.Result = future.result
1272 return nil
1273 }
1274
1275
1276 func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) {
1277 var done bool
1278 done, err = future.DoneWithContext(context.Background(), client)
1279 if err != nil {
1280 err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1281 return
1282 }
1283 if !done {
1284 pec.Response.Response = future.Response()
1285 err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture")
1286 return
1287 }
1288 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1289 if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {
1290 pec, err = client.CreateOrUpdateResponder(pec.Response.Response)
1291 if err != nil {
1292 err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request")
1293 }
1294 }
1295 return
1296 }
1297
1298
1299
1300 type PrivateEndpointConnectionsDeleteFuture struct {
1301 azure.FutureAPI
1302
1303
1304 Result func(PrivateEndpointConnectionsClient) (autorest.Response, error)
1305 }
1306
1307
1308 func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error {
1309 var azFuture azure.Future
1310 if err := json.Unmarshal(body, &azFuture); err != nil {
1311 return err
1312 }
1313 future.FutureAPI = &azFuture
1314 future.Result = future.result
1315 return nil
1316 }
1317
1318
1319 func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) {
1320 var done bool
1321 done, err = future.DoneWithContext(context.Background(), client)
1322 if err != nil {
1323 err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure")
1324 return
1325 }
1326 if !done {
1327 ar.Response = future.Response()
1328 err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsDeleteFuture")
1329 return
1330 }
1331 ar.Response = future.Response()
1332 return
1333 }
1334
1335
1336
1337 type PrivateEndpointConnectionsUpdateTagsFuture struct {
1338 azure.FutureAPI
1339
1340
1341 Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error)
1342 }
1343
1344
1345 func (future *PrivateEndpointConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error {
1346 var azFuture azure.Future
1347 if err := json.Unmarshal(body, &azFuture); err != nil {
1348 return err
1349 }
1350 future.FutureAPI = &azFuture
1351 future.Result = future.result
1352 return nil
1353 }
1354
1355
1356 func (future *PrivateEndpointConnectionsUpdateTagsFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) {
1357 var done bool
1358 done, err = future.DoneWithContext(context.Background(), client)
1359 if err != nil {
1360 err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure")
1361 return
1362 }
1363 if !done {
1364 pec.Response.Response = future.Response()
1365 err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsUpdateTagsFuture")
1366 return
1367 }
1368 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1369 if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {
1370 pec, err = client.UpdateTagsResponder(pec.Response.Response)
1371 if err != nil {
1372 err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsUpdateTagsFuture", "Result", pec.Response.Response, "Failure responding to request")
1373 }
1374 }
1375 return
1376 }
1377
1378
1379 type PrivateEndpointProperty struct {
1380
1381 ID *string `json:"id,omitempty"`
1382 }
1383
1384
1385 type PrivateLinkResource struct {
1386 autorest.Response `json:"-"`
1387
1388 Properties *PrivateLinkResourceProperties `json:"properties,omitempty"`
1389
1390 ID *string `json:"id,omitempty"`
1391
1392 Name *string `json:"name,omitempty"`
1393
1394 Type *string `json:"type,omitempty"`
1395 }
1396
1397
1398 func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) {
1399 objectMap := make(map[string]interface{})
1400 return json.Marshal(objectMap)
1401 }
1402
1403
1404 type PrivateLinkResourceListResult struct {
1405 autorest.Response `json:"-"`
1406
1407 Value *[]PrivateLinkResource `json:"value,omitempty"`
1408
1409 NextLink *string `json:"nextLink,omitempty"`
1410 }
1411
1412
1413 func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) {
1414 objectMap := make(map[string]interface{})
1415 return json.Marshal(objectMap)
1416 }
1417
1418
1419
1420 type PrivateLinkResourceListResultIterator struct {
1421 i int
1422 page PrivateLinkResourceListResultPage
1423 }
1424
1425
1426
1427 func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
1428 if tracing.IsEnabled() {
1429 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext")
1430 defer func() {
1431 sc := -1
1432 if iter.Response().Response.Response != nil {
1433 sc = iter.Response().Response.Response.StatusCode
1434 }
1435 tracing.EndSpan(ctx, sc, err)
1436 }()
1437 }
1438 iter.i++
1439 if iter.i < len(iter.page.Values()) {
1440 return nil
1441 }
1442 err = iter.page.NextWithContext(ctx)
1443 if err != nil {
1444 iter.i--
1445 return err
1446 }
1447 iter.i = 0
1448 return nil
1449 }
1450
1451
1452
1453
1454 func (iter *PrivateLinkResourceListResultIterator) Next() error {
1455 return iter.NextWithContext(context.Background())
1456 }
1457
1458
1459 func (iter PrivateLinkResourceListResultIterator) NotDone() bool {
1460 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1461 }
1462
1463
1464 func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult {
1465 return iter.page.Response()
1466 }
1467
1468
1469
1470 func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource {
1471 if !iter.page.NotDone() {
1472 return PrivateLinkResource{}
1473 }
1474 return iter.page.Values()[iter.i]
1475 }
1476
1477
1478 func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator {
1479 return PrivateLinkResourceListResultIterator{page: page}
1480 }
1481
1482
1483 func (plrlr PrivateLinkResourceListResult) IsEmpty() bool {
1484 return plrlr.Value == nil || len(*plrlr.Value) == 0
1485 }
1486
1487
1488 func (plrlr PrivateLinkResourceListResult) hasNextLink() bool {
1489 return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0
1490 }
1491
1492
1493
1494 func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
1495 if !plrlr.hasNextLink() {
1496 return nil, nil
1497 }
1498 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1499 autorest.AsJSON(),
1500 autorest.AsGet(),
1501 autorest.WithBaseURL(to.String(plrlr.NextLink)))
1502 }
1503
1504
1505 type PrivateLinkResourceListResultPage struct {
1506 fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)
1507 plrlr PrivateLinkResourceListResult
1508 }
1509
1510
1511
1512 func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
1513 if tracing.IsEnabled() {
1514 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext")
1515 defer func() {
1516 sc := -1
1517 if page.Response().Response.Response != nil {
1518 sc = page.Response().Response.Response.StatusCode
1519 }
1520 tracing.EndSpan(ctx, sc, err)
1521 }()
1522 }
1523 for {
1524 next, err := page.fn(ctx, page.plrlr)
1525 if err != nil {
1526 return err
1527 }
1528 page.plrlr = next
1529 if !next.hasNextLink() || !next.IsEmpty() {
1530 break
1531 }
1532 }
1533 return nil
1534 }
1535
1536
1537
1538
1539 func (page *PrivateLinkResourceListResultPage) Next() error {
1540 return page.NextWithContext(context.Background())
1541 }
1542
1543
1544 func (page PrivateLinkResourceListResultPage) NotDone() bool {
1545 return !page.plrlr.IsEmpty()
1546 }
1547
1548
1549 func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult {
1550 return page.plrlr
1551 }
1552
1553
1554 func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource {
1555 if page.plrlr.IsEmpty() {
1556 return nil
1557 }
1558 return *page.plrlr.Value
1559 }
1560
1561
1562 func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage {
1563 return PrivateLinkResourceListResultPage{
1564 fn: getNextPage,
1565 plrlr: cur,
1566 }
1567 }
1568
1569
1570 type PrivateLinkResourceProperties struct {
1571
1572 GroupID *string `json:"groupId,omitempty"`
1573
1574 RequiredMembers *[]string `json:"requiredMembers,omitempty"`
1575 }
1576
1577
1578 func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) {
1579 objectMap := make(map[string]interface{})
1580 return json.Marshal(objectMap)
1581 }
1582
1583
1584 type PrivateLinkServiceConnectionStateProperty struct {
1585
1586 Status *string `json:"status,omitempty"`
1587
1588 Description *string `json:"description,omitempty"`
1589
1590 ActionsRequired *string `json:"actionsRequired,omitempty"`
1591 }
1592
1593
1594 func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) {
1595 objectMap := make(map[string]interface{})
1596 if plscsp.Status != nil {
1597 objectMap["status"] = plscsp.Status
1598 }
1599 if plscsp.Description != nil {
1600 objectMap["description"] = plscsp.Description
1601 }
1602 return json.Marshal(objectMap)
1603 }
1604
1605
1606
1607 type ProxyResource struct {
1608
1609 ID *string `json:"id,omitempty"`
1610
1611 Name *string `json:"name,omitempty"`
1612
1613 Type *string `json:"type,omitempty"`
1614 }
1615
1616
1617 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1618 objectMap := make(map[string]interface{})
1619 return json.Marshal(objectMap)
1620 }
1621
1622
1623 type QueryStatistic struct {
1624 autorest.Response `json:"-"`
1625
1626 *QueryStatisticProperties `json:"properties,omitempty"`
1627
1628 ID *string `json:"id,omitempty"`
1629
1630 Name *string `json:"name,omitempty"`
1631
1632 Type *string `json:"type,omitempty"`
1633 }
1634
1635
1636 func (qs QueryStatistic) MarshalJSON() ([]byte, error) {
1637 objectMap := make(map[string]interface{})
1638 if qs.QueryStatisticProperties != nil {
1639 objectMap["properties"] = qs.QueryStatisticProperties
1640 }
1641 return json.Marshal(objectMap)
1642 }
1643
1644
1645 func (qs *QueryStatistic) UnmarshalJSON(body []byte) error {
1646 var m map[string]*json.RawMessage
1647 err := json.Unmarshal(body, &m)
1648 if err != nil {
1649 return err
1650 }
1651 for k, v := range m {
1652 switch k {
1653 case "properties":
1654 if v != nil {
1655 var queryStatisticProperties QueryStatisticProperties
1656 err = json.Unmarshal(*v, &queryStatisticProperties)
1657 if err != nil {
1658 return err
1659 }
1660 qs.QueryStatisticProperties = &queryStatisticProperties
1661 }
1662 case "id":
1663 if v != nil {
1664 var ID string
1665 err = json.Unmarshal(*v, &ID)
1666 if err != nil {
1667 return err
1668 }
1669 qs.ID = &ID
1670 }
1671 case "name":
1672 if v != nil {
1673 var name string
1674 err = json.Unmarshal(*v, &name)
1675 if err != nil {
1676 return err
1677 }
1678 qs.Name = &name
1679 }
1680 case "type":
1681 if v != nil {
1682 var typeVar string
1683 err = json.Unmarshal(*v, &typeVar)
1684 if err != nil {
1685 return err
1686 }
1687 qs.Type = &typeVar
1688 }
1689 }
1690 }
1691
1692 return nil
1693 }
1694
1695
1696 type QueryStatisticProperties struct {
1697
1698 QueryID *string `json:"queryId,omitempty"`
1699
1700 StartTime *date.Time `json:"startTime,omitempty"`
1701
1702 EndTime *date.Time `json:"endTime,omitempty"`
1703
1704 AggregationFunction *string `json:"aggregationFunction,omitempty"`
1705
1706 DatabaseNames *[]string `json:"databaseNames,omitempty"`
1707
1708 QueryExecutionCount *int64 `json:"queryExecutionCount,omitempty"`
1709
1710 MetricName *string `json:"metricName,omitempty"`
1711
1712 MetricDisplayName *string `json:"metricDisplayName,omitempty"`
1713
1714 MetricValue *float64 `json:"metricValue,omitempty"`
1715
1716 MetricValueUnit *string `json:"metricValueUnit,omitempty"`
1717 }
1718
1719
1720 type QueryText struct {
1721 autorest.Response `json:"-"`
1722
1723 *QueryTextProperties `json:"properties,omitempty"`
1724
1725 ID *string `json:"id,omitempty"`
1726
1727 Name *string `json:"name,omitempty"`
1728
1729 Type *string `json:"type,omitempty"`
1730 }
1731
1732
1733 func (qt QueryText) MarshalJSON() ([]byte, error) {
1734 objectMap := make(map[string]interface{})
1735 if qt.QueryTextProperties != nil {
1736 objectMap["properties"] = qt.QueryTextProperties
1737 }
1738 return json.Marshal(objectMap)
1739 }
1740
1741
1742 func (qt *QueryText) UnmarshalJSON(body []byte) error {
1743 var m map[string]*json.RawMessage
1744 err := json.Unmarshal(body, &m)
1745 if err != nil {
1746 return err
1747 }
1748 for k, v := range m {
1749 switch k {
1750 case "properties":
1751 if v != nil {
1752 var queryTextProperties QueryTextProperties
1753 err = json.Unmarshal(*v, &queryTextProperties)
1754 if err != nil {
1755 return err
1756 }
1757 qt.QueryTextProperties = &queryTextProperties
1758 }
1759 case "id":
1760 if v != nil {
1761 var ID string
1762 err = json.Unmarshal(*v, &ID)
1763 if err != nil {
1764 return err
1765 }
1766 qt.ID = &ID
1767 }
1768 case "name":
1769 if v != nil {
1770 var name string
1771 err = json.Unmarshal(*v, &name)
1772 if err != nil {
1773 return err
1774 }
1775 qt.Name = &name
1776 }
1777 case "type":
1778 if v != nil {
1779 var typeVar string
1780 err = json.Unmarshal(*v, &typeVar)
1781 if err != nil {
1782 return err
1783 }
1784 qt.Type = &typeVar
1785 }
1786 }
1787 }
1788
1789 return nil
1790 }
1791
1792
1793 type QueryTextProperties struct {
1794
1795 QueryID *string `json:"queryId,omitempty"`
1796
1797 QueryText *string `json:"queryText,omitempty"`
1798 }
1799
1800
1801 type QueryTextsResultList struct {
1802 autorest.Response `json:"-"`
1803
1804 Value *[]QueryText `json:"value,omitempty"`
1805
1806 NextLink *string `json:"nextLink,omitempty"`
1807 }
1808
1809
1810 func (qtrl QueryTextsResultList) MarshalJSON() ([]byte, error) {
1811 objectMap := make(map[string]interface{})
1812 return json.Marshal(objectMap)
1813 }
1814
1815
1816 type QueryTextsResultListIterator struct {
1817 i int
1818 page QueryTextsResultListPage
1819 }
1820
1821
1822
1823 func (iter *QueryTextsResultListIterator) NextWithContext(ctx context.Context) (err error) {
1824 if tracing.IsEnabled() {
1825 ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListIterator.NextWithContext")
1826 defer func() {
1827 sc := -1
1828 if iter.Response().Response.Response != nil {
1829 sc = iter.Response().Response.Response.StatusCode
1830 }
1831 tracing.EndSpan(ctx, sc, err)
1832 }()
1833 }
1834 iter.i++
1835 if iter.i < len(iter.page.Values()) {
1836 return nil
1837 }
1838 err = iter.page.NextWithContext(ctx)
1839 if err != nil {
1840 iter.i--
1841 return err
1842 }
1843 iter.i = 0
1844 return nil
1845 }
1846
1847
1848
1849
1850 func (iter *QueryTextsResultListIterator) Next() error {
1851 return iter.NextWithContext(context.Background())
1852 }
1853
1854
1855 func (iter QueryTextsResultListIterator) NotDone() bool {
1856 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1857 }
1858
1859
1860 func (iter QueryTextsResultListIterator) Response() QueryTextsResultList {
1861 return iter.page.Response()
1862 }
1863
1864
1865
1866 func (iter QueryTextsResultListIterator) Value() QueryText {
1867 if !iter.page.NotDone() {
1868 return QueryText{}
1869 }
1870 return iter.page.Values()[iter.i]
1871 }
1872
1873
1874 func NewQueryTextsResultListIterator(page QueryTextsResultListPage) QueryTextsResultListIterator {
1875 return QueryTextsResultListIterator{page: page}
1876 }
1877
1878
1879 func (qtrl QueryTextsResultList) IsEmpty() bool {
1880 return qtrl.Value == nil || len(*qtrl.Value) == 0
1881 }
1882
1883
1884 func (qtrl QueryTextsResultList) hasNextLink() bool {
1885 return qtrl.NextLink != nil && len(*qtrl.NextLink) != 0
1886 }
1887
1888
1889
1890 func (qtrl QueryTextsResultList) queryTextsResultListPreparer(ctx context.Context) (*http.Request, error) {
1891 if !qtrl.hasNextLink() {
1892 return nil, nil
1893 }
1894 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1895 autorest.AsJSON(),
1896 autorest.AsGet(),
1897 autorest.WithBaseURL(to.String(qtrl.NextLink)))
1898 }
1899
1900
1901 type QueryTextsResultListPage struct {
1902 fn func(context.Context, QueryTextsResultList) (QueryTextsResultList, error)
1903 qtrl QueryTextsResultList
1904 }
1905
1906
1907
1908 func (page *QueryTextsResultListPage) NextWithContext(ctx context.Context) (err error) {
1909 if tracing.IsEnabled() {
1910 ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListPage.NextWithContext")
1911 defer func() {
1912 sc := -1
1913 if page.Response().Response.Response != nil {
1914 sc = page.Response().Response.Response.StatusCode
1915 }
1916 tracing.EndSpan(ctx, sc, err)
1917 }()
1918 }
1919 for {
1920 next, err := page.fn(ctx, page.qtrl)
1921 if err != nil {
1922 return err
1923 }
1924 page.qtrl = next
1925 if !next.hasNextLink() || !next.IsEmpty() {
1926 break
1927 }
1928 }
1929 return nil
1930 }
1931
1932
1933
1934
1935 func (page *QueryTextsResultListPage) Next() error {
1936 return page.NextWithContext(context.Background())
1937 }
1938
1939
1940 func (page QueryTextsResultListPage) NotDone() bool {
1941 return !page.qtrl.IsEmpty()
1942 }
1943
1944
1945 func (page QueryTextsResultListPage) Response() QueryTextsResultList {
1946 return page.qtrl
1947 }
1948
1949
1950 func (page QueryTextsResultListPage) Values() []QueryText {
1951 if page.qtrl.IsEmpty() {
1952 return nil
1953 }
1954 return *page.qtrl.Value
1955 }
1956
1957
1958 func NewQueryTextsResultListPage(cur QueryTextsResultList, getNextPage func(context.Context, QueryTextsResultList) (QueryTextsResultList, error)) QueryTextsResultListPage {
1959 return QueryTextsResultListPage{
1960 fn: getNextPage,
1961 qtrl: cur,
1962 }
1963 }
1964
1965
1966 type RecommendationAction struct {
1967 autorest.Response `json:"-"`
1968
1969 *RecommendationActionProperties `json:"properties,omitempty"`
1970
1971 ID *string `json:"id,omitempty"`
1972
1973 Name *string `json:"name,omitempty"`
1974
1975 Type *string `json:"type,omitempty"`
1976 }
1977
1978
1979 func (ra RecommendationAction) MarshalJSON() ([]byte, error) {
1980 objectMap := make(map[string]interface{})
1981 if ra.RecommendationActionProperties != nil {
1982 objectMap["properties"] = ra.RecommendationActionProperties
1983 }
1984 return json.Marshal(objectMap)
1985 }
1986
1987
1988 func (ra *RecommendationAction) UnmarshalJSON(body []byte) error {
1989 var m map[string]*json.RawMessage
1990 err := json.Unmarshal(body, &m)
1991 if err != nil {
1992 return err
1993 }
1994 for k, v := range m {
1995 switch k {
1996 case "properties":
1997 if v != nil {
1998 var recommendationActionProperties RecommendationActionProperties
1999 err = json.Unmarshal(*v, &recommendationActionProperties)
2000 if err != nil {
2001 return err
2002 }
2003 ra.RecommendationActionProperties = &recommendationActionProperties
2004 }
2005 case "id":
2006 if v != nil {
2007 var ID string
2008 err = json.Unmarshal(*v, &ID)
2009 if err != nil {
2010 return err
2011 }
2012 ra.ID = &ID
2013 }
2014 case "name":
2015 if v != nil {
2016 var name string
2017 err = json.Unmarshal(*v, &name)
2018 if err != nil {
2019 return err
2020 }
2021 ra.Name = &name
2022 }
2023 case "type":
2024 if v != nil {
2025 var typeVar string
2026 err = json.Unmarshal(*v, &typeVar)
2027 if err != nil {
2028 return err
2029 }
2030 ra.Type = &typeVar
2031 }
2032 }
2033 }
2034
2035 return nil
2036 }
2037
2038
2039 type RecommendationActionProperties struct {
2040
2041 AdvisorName *string `json:"advisorName,omitempty"`
2042
2043 SessionID *string `json:"sessionId,omitempty"`
2044
2045 ActionID *int32 `json:"actionId,omitempty"`
2046
2047 CreatedTime *date.Time `json:"createdTime,omitempty"`
2048
2049 ExpirationTime *date.Time `json:"expirationTime,omitempty"`
2050
2051 Reason *string `json:"reason,omitempty"`
2052
2053 RecommendationType *string `json:"recommendationType,omitempty"`
2054
2055 Details map[string]*string `json:"details"`
2056 }
2057
2058
2059 func (rap RecommendationActionProperties) MarshalJSON() ([]byte, error) {
2060 objectMap := make(map[string]interface{})
2061 if rap.AdvisorName != nil {
2062 objectMap["advisorName"] = rap.AdvisorName
2063 }
2064 if rap.SessionID != nil {
2065 objectMap["sessionId"] = rap.SessionID
2066 }
2067 if rap.ActionID != nil {
2068 objectMap["actionId"] = rap.ActionID
2069 }
2070 if rap.CreatedTime != nil {
2071 objectMap["createdTime"] = rap.CreatedTime
2072 }
2073 if rap.ExpirationTime != nil {
2074 objectMap["expirationTime"] = rap.ExpirationTime
2075 }
2076 if rap.Reason != nil {
2077 objectMap["reason"] = rap.Reason
2078 }
2079 if rap.RecommendationType != nil {
2080 objectMap["recommendationType"] = rap.RecommendationType
2081 }
2082 if rap.Details != nil {
2083 objectMap["details"] = rap.Details
2084 }
2085 return json.Marshal(objectMap)
2086 }
2087
2088
2089 type RecommendationActionsResultList struct {
2090 autorest.Response `json:"-"`
2091
2092 Value *[]RecommendationAction `json:"value,omitempty"`
2093
2094 NextLink *string `json:"nextLink,omitempty"`
2095 }
2096
2097
2098 func (rarl RecommendationActionsResultList) MarshalJSON() ([]byte, error) {
2099 objectMap := make(map[string]interface{})
2100 return json.Marshal(objectMap)
2101 }
2102
2103
2104
2105 type RecommendationActionsResultListIterator struct {
2106 i int
2107 page RecommendationActionsResultListPage
2108 }
2109
2110
2111
2112 func (iter *RecommendationActionsResultListIterator) NextWithContext(ctx context.Context) (err error) {
2113 if tracing.IsEnabled() {
2114 ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListIterator.NextWithContext")
2115 defer func() {
2116 sc := -1
2117 if iter.Response().Response.Response != nil {
2118 sc = iter.Response().Response.Response.StatusCode
2119 }
2120 tracing.EndSpan(ctx, sc, err)
2121 }()
2122 }
2123 iter.i++
2124 if iter.i < len(iter.page.Values()) {
2125 return nil
2126 }
2127 err = iter.page.NextWithContext(ctx)
2128 if err != nil {
2129 iter.i--
2130 return err
2131 }
2132 iter.i = 0
2133 return nil
2134 }
2135
2136
2137
2138
2139 func (iter *RecommendationActionsResultListIterator) Next() error {
2140 return iter.NextWithContext(context.Background())
2141 }
2142
2143
2144 func (iter RecommendationActionsResultListIterator) NotDone() bool {
2145 return iter.page.NotDone() && iter.i < len(iter.page.Values())
2146 }
2147
2148
2149 func (iter RecommendationActionsResultListIterator) Response() RecommendationActionsResultList {
2150 return iter.page.Response()
2151 }
2152
2153
2154
2155 func (iter RecommendationActionsResultListIterator) Value() RecommendationAction {
2156 if !iter.page.NotDone() {
2157 return RecommendationAction{}
2158 }
2159 return iter.page.Values()[iter.i]
2160 }
2161
2162
2163 func NewRecommendationActionsResultListIterator(page RecommendationActionsResultListPage) RecommendationActionsResultListIterator {
2164 return RecommendationActionsResultListIterator{page: page}
2165 }
2166
2167
2168 func (rarl RecommendationActionsResultList) IsEmpty() bool {
2169 return rarl.Value == nil || len(*rarl.Value) == 0
2170 }
2171
2172
2173 func (rarl RecommendationActionsResultList) hasNextLink() bool {
2174 return rarl.NextLink != nil && len(*rarl.NextLink) != 0
2175 }
2176
2177
2178
2179 func (rarl RecommendationActionsResultList) recommendationActionsResultListPreparer(ctx context.Context) (*http.Request, error) {
2180 if !rarl.hasNextLink() {
2181 return nil, nil
2182 }
2183 return autorest.Prepare((&http.Request{}).WithContext(ctx),
2184 autorest.AsJSON(),
2185 autorest.AsGet(),
2186 autorest.WithBaseURL(to.String(rarl.NextLink)))
2187 }
2188
2189
2190 type RecommendationActionsResultListPage struct {
2191 fn func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error)
2192 rarl RecommendationActionsResultList
2193 }
2194
2195
2196
2197 func (page *RecommendationActionsResultListPage) NextWithContext(ctx context.Context) (err error) {
2198 if tracing.IsEnabled() {
2199 ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListPage.NextWithContext")
2200 defer func() {
2201 sc := -1
2202 if page.Response().Response.Response != nil {
2203 sc = page.Response().Response.Response.StatusCode
2204 }
2205 tracing.EndSpan(ctx, sc, err)
2206 }()
2207 }
2208 for {
2209 next, err := page.fn(ctx, page.rarl)
2210 if err != nil {
2211 return err
2212 }
2213 page.rarl = next
2214 if !next.hasNextLink() || !next.IsEmpty() {
2215 break
2216 }
2217 }
2218 return nil
2219 }
2220
2221
2222
2223
2224 func (page *RecommendationActionsResultListPage) Next() error {
2225 return page.NextWithContext(context.Background())
2226 }
2227
2228
2229 func (page RecommendationActionsResultListPage) NotDone() bool {
2230 return !page.rarl.IsEmpty()
2231 }
2232
2233
2234 func (page RecommendationActionsResultListPage) Response() RecommendationActionsResultList {
2235 return page.rarl
2236 }
2237
2238
2239 func (page RecommendationActionsResultListPage) Values() []RecommendationAction {
2240 if page.rarl.IsEmpty() {
2241 return nil
2242 }
2243 return *page.rarl.Value
2244 }
2245
2246
2247 func NewRecommendationActionsResultListPage(cur RecommendationActionsResultList, getNextPage func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error)) RecommendationActionsResultListPage {
2248 return RecommendationActionsResultListPage{
2249 fn: getNextPage,
2250 rarl: cur,
2251 }
2252 }
2253
2254
2255 type RecommendedActionSessionsOperationStatus struct {
2256 autorest.Response `json:"-"`
2257
2258 Name *string `json:"name,omitempty"`
2259
2260 StartTime *date.Time `json:"startTime,omitempty"`
2261
2262 Status *string `json:"status,omitempty"`
2263 }
2264
2265
2266 type Resource struct {
2267
2268 ID *string `json:"id,omitempty"`
2269
2270 Name *string `json:"name,omitempty"`
2271
2272 Type *string `json:"type,omitempty"`
2273 }
2274
2275
2276 func (r Resource) MarshalJSON() ([]byte, error) {
2277 objectMap := make(map[string]interface{})
2278 return json.Marshal(objectMap)
2279 }
2280
2281
2282 type SecurityAlertPolicyProperties struct {
2283
2284 State ServerSecurityAlertPolicyState `json:"state,omitempty"`
2285
2286 DisabledAlerts *[]string `json:"disabledAlerts,omitempty"`
2287
2288 EmailAddresses *[]string `json:"emailAddresses,omitempty"`
2289
2290 EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"`
2291
2292 StorageEndpoint *string `json:"storageEndpoint,omitempty"`
2293
2294 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"`
2295
2296 RetentionDays *int32 `json:"retentionDays,omitempty"`
2297 }
2298
2299
2300 type Server struct {
2301 autorest.Response `json:"-"`
2302
2303 Sku *Sku `json:"sku,omitempty"`
2304
2305 *ServerProperties `json:"properties,omitempty"`
2306
2307 Tags map[string]*string `json:"tags"`
2308
2309 Location *string `json:"location,omitempty"`
2310
2311 ID *string `json:"id,omitempty"`
2312
2313 Name *string `json:"name,omitempty"`
2314
2315 Type *string `json:"type,omitempty"`
2316 }
2317
2318
2319 func (s Server) MarshalJSON() ([]byte, error) {
2320 objectMap := make(map[string]interface{})
2321 if s.Sku != nil {
2322 objectMap["sku"] = s.Sku
2323 }
2324 if s.ServerProperties != nil {
2325 objectMap["properties"] = s.ServerProperties
2326 }
2327 if s.Tags != nil {
2328 objectMap["tags"] = s.Tags
2329 }
2330 if s.Location != nil {
2331 objectMap["location"] = s.Location
2332 }
2333 return json.Marshal(objectMap)
2334 }
2335
2336
2337 func (s *Server) UnmarshalJSON(body []byte) error {
2338 var m map[string]*json.RawMessage
2339 err := json.Unmarshal(body, &m)
2340 if err != nil {
2341 return err
2342 }
2343 for k, v := range m {
2344 switch k {
2345 case "sku":
2346 if v != nil {
2347 var sku Sku
2348 err = json.Unmarshal(*v, &sku)
2349 if err != nil {
2350 return err
2351 }
2352 s.Sku = &sku
2353 }
2354 case "properties":
2355 if v != nil {
2356 var serverProperties ServerProperties
2357 err = json.Unmarshal(*v, &serverProperties)
2358 if err != nil {
2359 return err
2360 }
2361 s.ServerProperties = &serverProperties
2362 }
2363 case "tags":
2364 if v != nil {
2365 var tags map[string]*string
2366 err = json.Unmarshal(*v, &tags)
2367 if err != nil {
2368 return err
2369 }
2370 s.Tags = tags
2371 }
2372 case "location":
2373 if v != nil {
2374 var location string
2375 err = json.Unmarshal(*v, &location)
2376 if err != nil {
2377 return err
2378 }
2379 s.Location = &location
2380 }
2381 case "id":
2382 if v != nil {
2383 var ID string
2384 err = json.Unmarshal(*v, &ID)
2385 if err != nil {
2386 return err
2387 }
2388 s.ID = &ID
2389 }
2390 case "name":
2391 if v != nil {
2392 var name string
2393 err = json.Unmarshal(*v, &name)
2394 if err != nil {
2395 return err
2396 }
2397 s.Name = &name
2398 }
2399 case "type":
2400 if v != nil {
2401 var typeVar string
2402 err = json.Unmarshal(*v, &typeVar)
2403 if err != nil {
2404 return err
2405 }
2406 s.Type = &typeVar
2407 }
2408 }
2409 }
2410
2411 return nil
2412 }
2413
2414
2415 type ServerForCreate struct {
2416
2417 Sku *Sku `json:"sku,omitempty"`
2418
2419 Properties BasicServerPropertiesForCreate `json:"properties,omitempty"`
2420
2421 Location *string `json:"location,omitempty"`
2422
2423 Tags map[string]*string `json:"tags"`
2424 }
2425
2426
2427 func (sfc ServerForCreate) MarshalJSON() ([]byte, error) {
2428 objectMap := make(map[string]interface{})
2429 if sfc.Sku != nil {
2430 objectMap["sku"] = sfc.Sku
2431 }
2432 objectMap["properties"] = sfc.Properties
2433 if sfc.Location != nil {
2434 objectMap["location"] = sfc.Location
2435 }
2436 if sfc.Tags != nil {
2437 objectMap["tags"] = sfc.Tags
2438 }
2439 return json.Marshal(objectMap)
2440 }
2441
2442
2443 func (sfc *ServerForCreate) UnmarshalJSON(body []byte) error {
2444 var m map[string]*json.RawMessage
2445 err := json.Unmarshal(body, &m)
2446 if err != nil {
2447 return err
2448 }
2449 for k, v := range m {
2450 switch k {
2451 case "sku":
2452 if v != nil {
2453 var sku Sku
2454 err = json.Unmarshal(*v, &sku)
2455 if err != nil {
2456 return err
2457 }
2458 sfc.Sku = &sku
2459 }
2460 case "properties":
2461 if v != nil {
2462 properties, err := unmarshalBasicServerPropertiesForCreate(*v)
2463 if err != nil {
2464 return err
2465 }
2466 sfc.Properties = properties
2467 }
2468 case "location":
2469 if v != nil {
2470 var location string
2471 err = json.Unmarshal(*v, &location)
2472 if err != nil {
2473 return err
2474 }
2475 sfc.Location = &location
2476 }
2477 case "tags":
2478 if v != nil {
2479 var tags map[string]*string
2480 err = json.Unmarshal(*v, &tags)
2481 if err != nil {
2482 return err
2483 }
2484 sfc.Tags = tags
2485 }
2486 }
2487 }
2488
2489 return nil
2490 }
2491
2492
2493 type ServerListResult struct {
2494 autorest.Response `json:"-"`
2495
2496 Value *[]Server `json:"value,omitempty"`
2497 }
2498
2499
2500 type ServerPrivateEndpointConnection struct {
2501
2502 ID *string `json:"id,omitempty"`
2503
2504 Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"`
2505 }
2506
2507
2508 func (spec ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) {
2509 objectMap := make(map[string]interface{})
2510 return json.Marshal(objectMap)
2511 }
2512
2513
2514 type ServerPrivateEndpointConnectionProperties struct {
2515
2516 PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"`
2517
2518 PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"`
2519
2520 ProvisioningState PrivateEndpointProvisioningState `json:"provisioningState,omitempty"`
2521 }
2522
2523
2524 func (specp ServerPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) {
2525 objectMap := make(map[string]interface{})
2526 if specp.PrivateEndpoint != nil {
2527 objectMap["privateEndpoint"] = specp.PrivateEndpoint
2528 }
2529 if specp.PrivateLinkServiceConnectionState != nil {
2530 objectMap["privateLinkServiceConnectionState"] = specp.PrivateLinkServiceConnectionState
2531 }
2532 return json.Marshal(objectMap)
2533 }
2534
2535
2536 type ServerPrivateLinkServiceConnectionStateProperty struct {
2537
2538 Status PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"`
2539
2540 Description *string `json:"description,omitempty"`
2541
2542 ActionsRequired PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"`
2543 }
2544
2545
2546 func (splscsp ServerPrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) {
2547 objectMap := make(map[string]interface{})
2548 if splscsp.Status != "" {
2549 objectMap["status"] = splscsp.Status
2550 }
2551 if splscsp.Description != nil {
2552 objectMap["description"] = splscsp.Description
2553 }
2554 return json.Marshal(objectMap)
2555 }
2556
2557
2558 type ServerProperties struct {
2559
2560 AdministratorLogin *string `json:"administratorLogin,omitempty"`
2561
2562 Version ServerVersion `json:"version,omitempty"`
2563
2564 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2565
2566 UserVisibleState ServerState `json:"userVisibleState,omitempty"`
2567
2568 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
2569
2570 EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"`
2571
2572 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2573
2574 ReplicationRole *string `json:"replicationRole,omitempty"`
2575
2576 MasterServerID *string `json:"masterServerId,omitempty"`
2577
2578 ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"`
2579
2580 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2581
2582 PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"`
2583 }
2584
2585
2586 func (sp ServerProperties) MarshalJSON() ([]byte, error) {
2587 objectMap := make(map[string]interface{})
2588 if sp.AdministratorLogin != nil {
2589 objectMap["administratorLogin"] = sp.AdministratorLogin
2590 }
2591 if sp.Version != "" {
2592 objectMap["version"] = sp.Version
2593 }
2594 if sp.SslEnforcement != "" {
2595 objectMap["sslEnforcement"] = sp.SslEnforcement
2596 }
2597 if sp.UserVisibleState != "" {
2598 objectMap["userVisibleState"] = sp.UserVisibleState
2599 }
2600 if sp.FullyQualifiedDomainName != nil {
2601 objectMap["fullyQualifiedDomainName"] = sp.FullyQualifiedDomainName
2602 }
2603 if sp.EarliestRestoreDate != nil {
2604 objectMap["earliestRestoreDate"] = sp.EarliestRestoreDate
2605 }
2606 if sp.StorageProfile != nil {
2607 objectMap["storageProfile"] = sp.StorageProfile
2608 }
2609 if sp.ReplicationRole != nil {
2610 objectMap["replicationRole"] = sp.ReplicationRole
2611 }
2612 if sp.MasterServerID != nil {
2613 objectMap["masterServerId"] = sp.MasterServerID
2614 }
2615 if sp.ReplicaCapacity != nil {
2616 objectMap["replicaCapacity"] = sp.ReplicaCapacity
2617 }
2618 if sp.PublicNetworkAccess != "" {
2619 objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess
2620 }
2621 return json.Marshal(objectMap)
2622 }
2623
2624
2625 type BasicServerPropertiesForCreate interface {
2626 AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool)
2627 AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool)
2628 AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool)
2629 AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool)
2630 AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool)
2631 }
2632
2633
2634 type ServerPropertiesForCreate struct {
2635
2636 Version ServerVersion `json:"version,omitempty"`
2637
2638 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2639
2640 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2641
2642 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2643
2644 CreateMode CreateMode `json:"createMode,omitempty"`
2645 }
2646
2647 func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerPropertiesForCreate, error) {
2648 var m map[string]interface{}
2649 err := json.Unmarshal(body, &m)
2650 if err != nil {
2651 return nil, err
2652 }
2653
2654 switch m["createMode"] {
2655 case string(CreateModeDefault):
2656 var spfdc ServerPropertiesForDefaultCreate
2657 err := json.Unmarshal(body, &spfdc)
2658 return spfdc, err
2659 case string(CreateModePointInTimeRestore):
2660 var spfr ServerPropertiesForRestore
2661 err := json.Unmarshal(body, &spfr)
2662 return spfr, err
2663 case string(CreateModeGeoRestore):
2664 var spfgr ServerPropertiesForGeoRestore
2665 err := json.Unmarshal(body, &spfgr)
2666 return spfgr, err
2667 case string(CreateModeReplica):
2668 var spfr ServerPropertiesForReplica
2669 err := json.Unmarshal(body, &spfr)
2670 return spfr, err
2671 default:
2672 var spfc ServerPropertiesForCreate
2673 err := json.Unmarshal(body, &spfc)
2674 return spfc, err
2675 }
2676 }
2677 func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPropertiesForCreate, error) {
2678 var rawMessages []*json.RawMessage
2679 err := json.Unmarshal(body, &rawMessages)
2680 if err != nil {
2681 return nil, err
2682 }
2683
2684 spfcArray := make([]BasicServerPropertiesForCreate, len(rawMessages))
2685
2686 for index, rawMessage := range rawMessages {
2687 spfc, err := unmarshalBasicServerPropertiesForCreate(*rawMessage)
2688 if err != nil {
2689 return nil, err
2690 }
2691 spfcArray[index] = spfc
2692 }
2693 return spfcArray, nil
2694 }
2695
2696
2697 func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) {
2698 spfc.CreateMode = CreateModeServerPropertiesForCreate
2699 objectMap := make(map[string]interface{})
2700 if spfc.Version != "" {
2701 objectMap["version"] = spfc.Version
2702 }
2703 if spfc.SslEnforcement != "" {
2704 objectMap["sslEnforcement"] = spfc.SslEnforcement
2705 }
2706 if spfc.PublicNetworkAccess != "" {
2707 objectMap["publicNetworkAccess"] = spfc.PublicNetworkAccess
2708 }
2709 if spfc.StorageProfile != nil {
2710 objectMap["storageProfile"] = spfc.StorageProfile
2711 }
2712 if spfc.CreateMode != "" {
2713 objectMap["createMode"] = spfc.CreateMode
2714 }
2715 return json.Marshal(objectMap)
2716 }
2717
2718
2719 func (spfc ServerPropertiesForCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
2720 return nil, false
2721 }
2722
2723
2724 func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
2725 return nil, false
2726 }
2727
2728
2729 func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
2730 return nil, false
2731 }
2732
2733
2734 func (spfc ServerPropertiesForCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
2735 return nil, false
2736 }
2737
2738
2739 func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
2740 return &spfc, true
2741 }
2742
2743
2744 func (spfc ServerPropertiesForCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
2745 return &spfc, true
2746 }
2747
2748
2749 type ServerPropertiesForDefaultCreate struct {
2750
2751 AdministratorLogin *string `json:"administratorLogin,omitempty"`
2752
2753 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
2754
2755 Version ServerVersion `json:"version,omitempty"`
2756
2757 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2758
2759 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2760
2761 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2762
2763 CreateMode CreateMode `json:"createMode,omitempty"`
2764 }
2765
2766
2767 func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) {
2768 spfdc.CreateMode = CreateModeDefault
2769 objectMap := make(map[string]interface{})
2770 if spfdc.AdministratorLogin != nil {
2771 objectMap["administratorLogin"] = spfdc.AdministratorLogin
2772 }
2773 if spfdc.AdministratorLoginPassword != nil {
2774 objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword
2775 }
2776 if spfdc.Version != "" {
2777 objectMap["version"] = spfdc.Version
2778 }
2779 if spfdc.SslEnforcement != "" {
2780 objectMap["sslEnforcement"] = spfdc.SslEnforcement
2781 }
2782 if spfdc.PublicNetworkAccess != "" {
2783 objectMap["publicNetworkAccess"] = spfdc.PublicNetworkAccess
2784 }
2785 if spfdc.StorageProfile != nil {
2786 objectMap["storageProfile"] = spfdc.StorageProfile
2787 }
2788 if spfdc.CreateMode != "" {
2789 objectMap["createMode"] = spfdc.CreateMode
2790 }
2791 return json.Marshal(objectMap)
2792 }
2793
2794
2795 func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
2796 return &spfdc, true
2797 }
2798
2799
2800 func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
2801 return nil, false
2802 }
2803
2804
2805 func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
2806 return nil, false
2807 }
2808
2809
2810 func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
2811 return nil, false
2812 }
2813
2814
2815 func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
2816 return nil, false
2817 }
2818
2819
2820 func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
2821 return &spfdc, true
2822 }
2823
2824
2825
2826 type ServerPropertiesForGeoRestore struct {
2827
2828 SourceServerID *string `json:"sourceServerId,omitempty"`
2829
2830 Version ServerVersion `json:"version,omitempty"`
2831
2832 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2833
2834 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2835
2836 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2837
2838 CreateMode CreateMode `json:"createMode,omitempty"`
2839 }
2840
2841
2842 func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) {
2843 spfgr.CreateMode = CreateModeGeoRestore
2844 objectMap := make(map[string]interface{})
2845 if spfgr.SourceServerID != nil {
2846 objectMap["sourceServerId"] = spfgr.SourceServerID
2847 }
2848 if spfgr.Version != "" {
2849 objectMap["version"] = spfgr.Version
2850 }
2851 if spfgr.SslEnforcement != "" {
2852 objectMap["sslEnforcement"] = spfgr.SslEnforcement
2853 }
2854 if spfgr.PublicNetworkAccess != "" {
2855 objectMap["publicNetworkAccess"] = spfgr.PublicNetworkAccess
2856 }
2857 if spfgr.StorageProfile != nil {
2858 objectMap["storageProfile"] = spfgr.StorageProfile
2859 }
2860 if spfgr.CreateMode != "" {
2861 objectMap["createMode"] = spfgr.CreateMode
2862 }
2863 return json.Marshal(objectMap)
2864 }
2865
2866
2867 func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
2868 return nil, false
2869 }
2870
2871
2872 func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
2873 return nil, false
2874 }
2875
2876
2877 func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
2878 return &spfgr, true
2879 }
2880
2881
2882 func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
2883 return nil, false
2884 }
2885
2886
2887 func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
2888 return nil, false
2889 }
2890
2891
2892 func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
2893 return &spfgr, true
2894 }
2895
2896
2897 type ServerPropertiesForReplica struct {
2898
2899 SourceServerID *string `json:"sourceServerId,omitempty"`
2900
2901 Version ServerVersion `json:"version,omitempty"`
2902
2903 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2904
2905 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2906
2907 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2908
2909 CreateMode CreateMode `json:"createMode,omitempty"`
2910 }
2911
2912
2913 func (spfr ServerPropertiesForReplica) MarshalJSON() ([]byte, error) {
2914 spfr.CreateMode = CreateModeReplica
2915 objectMap := make(map[string]interface{})
2916 if spfr.SourceServerID != nil {
2917 objectMap["sourceServerId"] = spfr.SourceServerID
2918 }
2919 if spfr.Version != "" {
2920 objectMap["version"] = spfr.Version
2921 }
2922 if spfr.SslEnforcement != "" {
2923 objectMap["sslEnforcement"] = spfr.SslEnforcement
2924 }
2925 if spfr.PublicNetworkAccess != "" {
2926 objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess
2927 }
2928 if spfr.StorageProfile != nil {
2929 objectMap["storageProfile"] = spfr.StorageProfile
2930 }
2931 if spfr.CreateMode != "" {
2932 objectMap["createMode"] = spfr.CreateMode
2933 }
2934 return json.Marshal(objectMap)
2935 }
2936
2937
2938 func (spfr ServerPropertiesForReplica) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
2939 return nil, false
2940 }
2941
2942
2943 func (spfr ServerPropertiesForReplica) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
2944 return nil, false
2945 }
2946
2947
2948 func (spfr ServerPropertiesForReplica) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
2949 return nil, false
2950 }
2951
2952
2953 func (spfr ServerPropertiesForReplica) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
2954 return &spfr, true
2955 }
2956
2957
2958 func (spfr ServerPropertiesForReplica) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
2959 return nil, false
2960 }
2961
2962
2963 func (spfr ServerPropertiesForReplica) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
2964 return &spfr, true
2965 }
2966
2967
2968 type ServerPropertiesForRestore struct {
2969
2970 SourceServerID *string `json:"sourceServerId,omitempty"`
2971
2972 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"`
2973
2974 Version ServerVersion `json:"version,omitempty"`
2975
2976 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2977
2978 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2979
2980 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2981
2982 CreateMode CreateMode `json:"createMode,omitempty"`
2983 }
2984
2985
2986 func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) {
2987 spfr.CreateMode = CreateModePointInTimeRestore
2988 objectMap := make(map[string]interface{})
2989 if spfr.SourceServerID != nil {
2990 objectMap["sourceServerId"] = spfr.SourceServerID
2991 }
2992 if spfr.RestorePointInTime != nil {
2993 objectMap["restorePointInTime"] = spfr.RestorePointInTime
2994 }
2995 if spfr.Version != "" {
2996 objectMap["version"] = spfr.Version
2997 }
2998 if spfr.SslEnforcement != "" {
2999 objectMap["sslEnforcement"] = spfr.SslEnforcement
3000 }
3001 if spfr.PublicNetworkAccess != "" {
3002 objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess
3003 }
3004 if spfr.StorageProfile != nil {
3005 objectMap["storageProfile"] = spfr.StorageProfile
3006 }
3007 if spfr.CreateMode != "" {
3008 objectMap["createMode"] = spfr.CreateMode
3009 }
3010 return json.Marshal(objectMap)
3011 }
3012
3013
3014 func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
3015 return nil, false
3016 }
3017
3018
3019 func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
3020 return &spfr, true
3021 }
3022
3023
3024 func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
3025 return nil, false
3026 }
3027
3028
3029 func (spfr ServerPropertiesForRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
3030 return nil, false
3031 }
3032
3033
3034 func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
3035 return nil, false
3036 }
3037
3038
3039 func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
3040 return &spfr, true
3041 }
3042
3043
3044
3045 type ServersCreateFuture struct {
3046 azure.FutureAPI
3047
3048
3049 Result func(ServersClient) (Server, error)
3050 }
3051
3052
3053 func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
3054 var azFuture azure.Future
3055 if err := json.Unmarshal(body, &azFuture); err != nil {
3056 return err
3057 }
3058 future.FutureAPI = &azFuture
3059 future.Result = future.result
3060 return nil
3061 }
3062
3063
3064 func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
3065 var done bool
3066 done, err = future.DoneWithContext(context.Background(), client)
3067 if err != nil {
3068 err = autorest.NewErrorWithError(err, "mariadb.ServersCreateFuture", "Result", future.Response(), "Polling failure")
3069 return
3070 }
3071 if !done {
3072 s.Response.Response = future.Response()
3073 err = azure.NewAsyncOpIncompleteError("mariadb.ServersCreateFuture")
3074 return
3075 }
3076 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3077 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
3078 s, err = client.CreateResponder(s.Response.Response)
3079 if err != nil {
3080 err = autorest.NewErrorWithError(err, "mariadb.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
3081 }
3082 }
3083 return
3084 }
3085
3086
3087
3088 type ServersDeleteFuture struct {
3089 azure.FutureAPI
3090
3091
3092 Result func(ServersClient) (autorest.Response, error)
3093 }
3094
3095
3096 func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
3097 var azFuture azure.Future
3098 if err := json.Unmarshal(body, &azFuture); err != nil {
3099 return err
3100 }
3101 future.FutureAPI = &azFuture
3102 future.Result = future.result
3103 return nil
3104 }
3105
3106
3107 func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
3108 var done bool
3109 done, err = future.DoneWithContext(context.Background(), client)
3110 if err != nil {
3111 err = autorest.NewErrorWithError(err, "mariadb.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
3112 return
3113 }
3114 if !done {
3115 ar.Response = future.Response()
3116 err = azure.NewAsyncOpIncompleteError("mariadb.ServersDeleteFuture")
3117 return
3118 }
3119 ar.Response = future.Response()
3120 return
3121 }
3122
3123
3124
3125 type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct {
3126 azure.FutureAPI
3127
3128
3129 Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error)
3130 }
3131
3132
3133 func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
3134 var azFuture azure.Future
3135 if err := json.Unmarshal(body, &azFuture); err != nil {
3136 return err
3137 }
3138 future.FutureAPI = &azFuture
3139 future.Result = future.result
3140 return nil
3141 }
3142
3143
3144 func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) {
3145 var done bool
3146 done, err = future.DoneWithContext(context.Background(), client)
3147 if err != nil {
3148 err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
3149 return
3150 }
3151 if !done {
3152 ssap.Response.Response = future.Response()
3153 err = azure.NewAsyncOpIncompleteError("mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture")
3154 return
3155 }
3156 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3157 if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent {
3158 ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response)
3159 if err != nil {
3160 err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request")
3161 }
3162 }
3163 return
3164 }
3165
3166
3167 type ServerSecurityAlertPolicy struct {
3168 autorest.Response `json:"-"`
3169
3170 *SecurityAlertPolicyProperties `json:"properties,omitempty"`
3171
3172 ID *string `json:"id,omitempty"`
3173
3174 Name *string `json:"name,omitempty"`
3175
3176 Type *string `json:"type,omitempty"`
3177 }
3178
3179
3180 func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) {
3181 objectMap := make(map[string]interface{})
3182 if ssap.SecurityAlertPolicyProperties != nil {
3183 objectMap["properties"] = ssap.SecurityAlertPolicyProperties
3184 }
3185 return json.Marshal(objectMap)
3186 }
3187
3188
3189 func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error {
3190 var m map[string]*json.RawMessage
3191 err := json.Unmarshal(body, &m)
3192 if err != nil {
3193 return err
3194 }
3195 for k, v := range m {
3196 switch k {
3197 case "properties":
3198 if v != nil {
3199 var securityAlertPolicyProperties SecurityAlertPolicyProperties
3200 err = json.Unmarshal(*v, &securityAlertPolicyProperties)
3201 if err != nil {
3202 return err
3203 }
3204 ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties
3205 }
3206 case "id":
3207 if v != nil {
3208 var ID string
3209 err = json.Unmarshal(*v, &ID)
3210 if err != nil {
3211 return err
3212 }
3213 ssap.ID = &ID
3214 }
3215 case "name":
3216 if v != nil {
3217 var name string
3218 err = json.Unmarshal(*v, &name)
3219 if err != nil {
3220 return err
3221 }
3222 ssap.Name = &name
3223 }
3224 case "type":
3225 if v != nil {
3226 var typeVar string
3227 err = json.Unmarshal(*v, &typeVar)
3228 if err != nil {
3229 return err
3230 }
3231 ssap.Type = &typeVar
3232 }
3233 }
3234 }
3235
3236 return nil
3237 }
3238
3239
3240
3241 type ServersRestartFuture struct {
3242 azure.FutureAPI
3243
3244
3245 Result func(ServersClient) (autorest.Response, error)
3246 }
3247
3248
3249 func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error {
3250 var azFuture azure.Future
3251 if err := json.Unmarshal(body, &azFuture); err != nil {
3252 return err
3253 }
3254 future.FutureAPI = &azFuture
3255 future.Result = future.result
3256 return nil
3257 }
3258
3259
3260 func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {
3261 var done bool
3262 done, err = future.DoneWithContext(context.Background(), client)
3263 if err != nil {
3264 err = autorest.NewErrorWithError(err, "mariadb.ServersRestartFuture", "Result", future.Response(), "Polling failure")
3265 return
3266 }
3267 if !done {
3268 ar.Response = future.Response()
3269 err = azure.NewAsyncOpIncompleteError("mariadb.ServersRestartFuture")
3270 return
3271 }
3272 ar.Response = future.Response()
3273 return
3274 }
3275
3276
3277
3278 type ServersUpdateFuture struct {
3279 azure.FutureAPI
3280
3281
3282 Result func(ServersClient) (Server, error)
3283 }
3284
3285
3286 func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
3287 var azFuture azure.Future
3288 if err := json.Unmarshal(body, &azFuture); err != nil {
3289 return err
3290 }
3291 future.FutureAPI = &azFuture
3292 future.Result = future.result
3293 return nil
3294 }
3295
3296
3297 func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
3298 var done bool
3299 done, err = future.DoneWithContext(context.Background(), client)
3300 if err != nil {
3301 err = autorest.NewErrorWithError(err, "mariadb.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
3302 return
3303 }
3304 if !done {
3305 s.Response.Response = future.Response()
3306 err = azure.NewAsyncOpIncompleteError("mariadb.ServersUpdateFuture")
3307 return
3308 }
3309 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3310 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
3311 s, err = client.UpdateResponder(s.Response.Response)
3312 if err != nil {
3313 err = autorest.NewErrorWithError(err, "mariadb.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
3314 }
3315 }
3316 return
3317 }
3318
3319
3320 type ServerUpdateParameters struct {
3321
3322 Sku *Sku `json:"sku,omitempty"`
3323
3324 *ServerUpdateParametersProperties `json:"properties,omitempty"`
3325
3326 Tags map[string]*string `json:"tags"`
3327 }
3328
3329
3330 func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) {
3331 objectMap := make(map[string]interface{})
3332 if sup.Sku != nil {
3333 objectMap["sku"] = sup.Sku
3334 }
3335 if sup.ServerUpdateParametersProperties != nil {
3336 objectMap["properties"] = sup.ServerUpdateParametersProperties
3337 }
3338 if sup.Tags != nil {
3339 objectMap["tags"] = sup.Tags
3340 }
3341 return json.Marshal(objectMap)
3342 }
3343
3344
3345 func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error {
3346 var m map[string]*json.RawMessage
3347 err := json.Unmarshal(body, &m)
3348 if err != nil {
3349 return err
3350 }
3351 for k, v := range m {
3352 switch k {
3353 case "sku":
3354 if v != nil {
3355 var sku Sku
3356 err = json.Unmarshal(*v, &sku)
3357 if err != nil {
3358 return err
3359 }
3360 sup.Sku = &sku
3361 }
3362 case "properties":
3363 if v != nil {
3364 var serverUpdateParametersProperties ServerUpdateParametersProperties
3365 err = json.Unmarshal(*v, &serverUpdateParametersProperties)
3366 if err != nil {
3367 return err
3368 }
3369 sup.ServerUpdateParametersProperties = &serverUpdateParametersProperties
3370 }
3371 case "tags":
3372 if v != nil {
3373 var tags map[string]*string
3374 err = json.Unmarshal(*v, &tags)
3375 if err != nil {
3376 return err
3377 }
3378 sup.Tags = tags
3379 }
3380 }
3381 }
3382
3383 return nil
3384 }
3385
3386
3387 type ServerUpdateParametersProperties struct {
3388
3389 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
3390
3391 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
3392
3393 Version ServerVersion `json:"version,omitempty"`
3394
3395 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
3396
3397 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
3398
3399 ReplicationRole *string `json:"replicationRole,omitempty"`
3400 }
3401
3402
3403 type Sku struct {
3404
3405 Name *string `json:"name,omitempty"`
3406
3407 Tier SkuTier `json:"tier,omitempty"`
3408
3409 Capacity *int32 `json:"capacity,omitempty"`
3410
3411 Size *string `json:"size,omitempty"`
3412
3413 Family *string `json:"family,omitempty"`
3414 }
3415
3416
3417 type StorageProfile struct {
3418
3419 BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
3420
3421 GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"`
3422
3423 StorageMB *int32 `json:"storageMB,omitempty"`
3424
3425 StorageAutogrow StorageAutogrow `json:"storageAutogrow,omitempty"`
3426 }
3427
3428
3429 type TagsObject struct {
3430
3431 Tags map[string]*string `json:"tags"`
3432 }
3433
3434
3435 func (toVar TagsObject) MarshalJSON() ([]byte, error) {
3436 objectMap := make(map[string]interface{})
3437 if toVar.Tags != nil {
3438 objectMap["tags"] = toVar.Tags
3439 }
3440 return json.Marshal(objectMap)
3441 }
3442
3443
3444 type TopQueryStatisticsInput struct {
3445
3446 *TopQueryStatisticsInputProperties `json:"properties,omitempty"`
3447 }
3448
3449
3450 func (tqsi TopQueryStatisticsInput) MarshalJSON() ([]byte, error) {
3451 objectMap := make(map[string]interface{})
3452 if tqsi.TopQueryStatisticsInputProperties != nil {
3453 objectMap["properties"] = tqsi.TopQueryStatisticsInputProperties
3454 }
3455 return json.Marshal(objectMap)
3456 }
3457
3458
3459 func (tqsi *TopQueryStatisticsInput) UnmarshalJSON(body []byte) error {
3460 var m map[string]*json.RawMessage
3461 err := json.Unmarshal(body, &m)
3462 if err != nil {
3463 return err
3464 }
3465 for k, v := range m {
3466 switch k {
3467 case "properties":
3468 if v != nil {
3469 var topQueryStatisticsInputProperties TopQueryStatisticsInputProperties
3470 err = json.Unmarshal(*v, &topQueryStatisticsInputProperties)
3471 if err != nil {
3472 return err
3473 }
3474 tqsi.TopQueryStatisticsInputProperties = &topQueryStatisticsInputProperties
3475 }
3476 }
3477 }
3478
3479 return nil
3480 }
3481
3482
3483 type TopQueryStatisticsInputProperties struct {
3484
3485 NumberOfTopQueries *int32 `json:"numberOfTopQueries,omitempty"`
3486
3487 AggregationFunction *string `json:"aggregationFunction,omitempty"`
3488
3489 ObservedMetric *string `json:"observedMetric,omitempty"`
3490
3491 ObservationStartTime *date.Time `json:"observationStartTime,omitempty"`
3492
3493 ObservationEndTime *date.Time `json:"observationEndTime,omitempty"`
3494
3495 AggregationWindow *string `json:"aggregationWindow,omitempty"`
3496 }
3497
3498
3499 type TopQueryStatisticsResultList struct {
3500 autorest.Response `json:"-"`
3501
3502 Value *[]QueryStatistic `json:"value,omitempty"`
3503
3504 NextLink *string `json:"nextLink,omitempty"`
3505 }
3506
3507
3508 func (tqsrl TopQueryStatisticsResultList) MarshalJSON() ([]byte, error) {
3509 objectMap := make(map[string]interface{})
3510 return json.Marshal(objectMap)
3511 }
3512
3513
3514 type TopQueryStatisticsResultListIterator struct {
3515 i int
3516 page TopQueryStatisticsResultListPage
3517 }
3518
3519
3520
3521 func (iter *TopQueryStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) {
3522 if tracing.IsEnabled() {
3523 ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListIterator.NextWithContext")
3524 defer func() {
3525 sc := -1
3526 if iter.Response().Response.Response != nil {
3527 sc = iter.Response().Response.Response.StatusCode
3528 }
3529 tracing.EndSpan(ctx, sc, err)
3530 }()
3531 }
3532 iter.i++
3533 if iter.i < len(iter.page.Values()) {
3534 return nil
3535 }
3536 err = iter.page.NextWithContext(ctx)
3537 if err != nil {
3538 iter.i--
3539 return err
3540 }
3541 iter.i = 0
3542 return nil
3543 }
3544
3545
3546
3547
3548 func (iter *TopQueryStatisticsResultListIterator) Next() error {
3549 return iter.NextWithContext(context.Background())
3550 }
3551
3552
3553 func (iter TopQueryStatisticsResultListIterator) NotDone() bool {
3554 return iter.page.NotDone() && iter.i < len(iter.page.Values())
3555 }
3556
3557
3558 func (iter TopQueryStatisticsResultListIterator) Response() TopQueryStatisticsResultList {
3559 return iter.page.Response()
3560 }
3561
3562
3563
3564 func (iter TopQueryStatisticsResultListIterator) Value() QueryStatistic {
3565 if !iter.page.NotDone() {
3566 return QueryStatistic{}
3567 }
3568 return iter.page.Values()[iter.i]
3569 }
3570
3571
3572 func NewTopQueryStatisticsResultListIterator(page TopQueryStatisticsResultListPage) TopQueryStatisticsResultListIterator {
3573 return TopQueryStatisticsResultListIterator{page: page}
3574 }
3575
3576
3577 func (tqsrl TopQueryStatisticsResultList) IsEmpty() bool {
3578 return tqsrl.Value == nil || len(*tqsrl.Value) == 0
3579 }
3580
3581
3582 func (tqsrl TopQueryStatisticsResultList) hasNextLink() bool {
3583 return tqsrl.NextLink != nil && len(*tqsrl.NextLink) != 0
3584 }
3585
3586
3587
3588 func (tqsrl TopQueryStatisticsResultList) topQueryStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) {
3589 if !tqsrl.hasNextLink() {
3590 return nil, nil
3591 }
3592 return autorest.Prepare((&http.Request{}).WithContext(ctx),
3593 autorest.AsJSON(),
3594 autorest.AsGet(),
3595 autorest.WithBaseURL(to.String(tqsrl.NextLink)))
3596 }
3597
3598
3599 type TopQueryStatisticsResultListPage struct {
3600 fn func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error)
3601 tqsrl TopQueryStatisticsResultList
3602 }
3603
3604
3605
3606 func (page *TopQueryStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) {
3607 if tracing.IsEnabled() {
3608 ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListPage.NextWithContext")
3609 defer func() {
3610 sc := -1
3611 if page.Response().Response.Response != nil {
3612 sc = page.Response().Response.Response.StatusCode
3613 }
3614 tracing.EndSpan(ctx, sc, err)
3615 }()
3616 }
3617 for {
3618 next, err := page.fn(ctx, page.tqsrl)
3619 if err != nil {
3620 return err
3621 }
3622 page.tqsrl = next
3623 if !next.hasNextLink() || !next.IsEmpty() {
3624 break
3625 }
3626 }
3627 return nil
3628 }
3629
3630
3631
3632
3633 func (page *TopQueryStatisticsResultListPage) Next() error {
3634 return page.NextWithContext(context.Background())
3635 }
3636
3637
3638 func (page TopQueryStatisticsResultListPage) NotDone() bool {
3639 return !page.tqsrl.IsEmpty()
3640 }
3641
3642
3643 func (page TopQueryStatisticsResultListPage) Response() TopQueryStatisticsResultList {
3644 return page.tqsrl
3645 }
3646
3647
3648 func (page TopQueryStatisticsResultListPage) Values() []QueryStatistic {
3649 if page.tqsrl.IsEmpty() {
3650 return nil
3651 }
3652 return *page.tqsrl.Value
3653 }
3654
3655
3656 func NewTopQueryStatisticsResultListPage(cur TopQueryStatisticsResultList, getNextPage func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error)) TopQueryStatisticsResultListPage {
3657 return TopQueryStatisticsResultListPage{
3658 fn: getNextPage,
3659 tqsrl: cur,
3660 }
3661 }
3662
3663
3664
3665 type TrackedResource struct {
3666
3667 Tags map[string]*string `json:"tags"`
3668
3669 Location *string `json:"location,omitempty"`
3670
3671 ID *string `json:"id,omitempty"`
3672
3673 Name *string `json:"name,omitempty"`
3674
3675 Type *string `json:"type,omitempty"`
3676 }
3677
3678
3679 func (tr TrackedResource) MarshalJSON() ([]byte, error) {
3680 objectMap := make(map[string]interface{})
3681 if tr.Tags != nil {
3682 objectMap["tags"] = tr.Tags
3683 }
3684 if tr.Location != nil {
3685 objectMap["location"] = tr.Location
3686 }
3687 return json.Marshal(objectMap)
3688 }
3689
3690
3691 type VirtualNetworkRule struct {
3692 autorest.Response `json:"-"`
3693
3694 *VirtualNetworkRuleProperties `json:"properties,omitempty"`
3695
3696 ID *string `json:"id,omitempty"`
3697
3698 Name *string `json:"name,omitempty"`
3699
3700 Type *string `json:"type,omitempty"`
3701 }
3702
3703
3704 func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) {
3705 objectMap := make(map[string]interface{})
3706 if vnr.VirtualNetworkRuleProperties != nil {
3707 objectMap["properties"] = vnr.VirtualNetworkRuleProperties
3708 }
3709 return json.Marshal(objectMap)
3710 }
3711
3712
3713 func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error {
3714 var m map[string]*json.RawMessage
3715 err := json.Unmarshal(body, &m)
3716 if err != nil {
3717 return err
3718 }
3719 for k, v := range m {
3720 switch k {
3721 case "properties":
3722 if v != nil {
3723 var virtualNetworkRuleProperties VirtualNetworkRuleProperties
3724 err = json.Unmarshal(*v, &virtualNetworkRuleProperties)
3725 if err != nil {
3726 return err
3727 }
3728 vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties
3729 }
3730 case "id":
3731 if v != nil {
3732 var ID string
3733 err = json.Unmarshal(*v, &ID)
3734 if err != nil {
3735 return err
3736 }
3737 vnr.ID = &ID
3738 }
3739 case "name":
3740 if v != nil {
3741 var name string
3742 err = json.Unmarshal(*v, &name)
3743 if err != nil {
3744 return err
3745 }
3746 vnr.Name = &name
3747 }
3748 case "type":
3749 if v != nil {
3750 var typeVar string
3751 err = json.Unmarshal(*v, &typeVar)
3752 if err != nil {
3753 return err
3754 }
3755 vnr.Type = &typeVar
3756 }
3757 }
3758 }
3759
3760 return nil
3761 }
3762
3763
3764 type VirtualNetworkRuleListResult struct {
3765 autorest.Response `json:"-"`
3766
3767 Value *[]VirtualNetworkRule `json:"value,omitempty"`
3768
3769 NextLink *string `json:"nextLink,omitempty"`
3770 }
3771
3772
3773 func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) {
3774 objectMap := make(map[string]interface{})
3775 return json.Marshal(objectMap)
3776 }
3777
3778
3779 type VirtualNetworkRuleListResultIterator struct {
3780 i int
3781 page VirtualNetworkRuleListResultPage
3782 }
3783
3784
3785
3786 func (iter *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
3787 if tracing.IsEnabled() {
3788 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.NextWithContext")
3789 defer func() {
3790 sc := -1
3791 if iter.Response().Response.Response != nil {
3792 sc = iter.Response().Response.Response.StatusCode
3793 }
3794 tracing.EndSpan(ctx, sc, err)
3795 }()
3796 }
3797 iter.i++
3798 if iter.i < len(iter.page.Values()) {
3799 return nil
3800 }
3801 err = iter.page.NextWithContext(ctx)
3802 if err != nil {
3803 iter.i--
3804 return err
3805 }
3806 iter.i = 0
3807 return nil
3808 }
3809
3810
3811
3812
3813 func (iter *VirtualNetworkRuleListResultIterator) Next() error {
3814 return iter.NextWithContext(context.Background())
3815 }
3816
3817
3818 func (iter VirtualNetworkRuleListResultIterator) NotDone() bool {
3819 return iter.page.NotDone() && iter.i < len(iter.page.Values())
3820 }
3821
3822
3823 func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult {
3824 return iter.page.Response()
3825 }
3826
3827
3828
3829 func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule {
3830 if !iter.page.NotDone() {
3831 return VirtualNetworkRule{}
3832 }
3833 return iter.page.Values()[iter.i]
3834 }
3835
3836
3837 func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator {
3838 return VirtualNetworkRuleListResultIterator{page: page}
3839 }
3840
3841
3842 func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool {
3843 return vnrlr.Value == nil || len(*vnrlr.Value) == 0
3844 }
3845
3846
3847 func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool {
3848 return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0
3849 }
3850
3851
3852
3853 func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
3854 if !vnrlr.hasNextLink() {
3855 return nil, nil
3856 }
3857 return autorest.Prepare((&http.Request{}).WithContext(ctx),
3858 autorest.AsJSON(),
3859 autorest.AsGet(),
3860 autorest.WithBaseURL(to.String(vnrlr.NextLink)))
3861 }
3862
3863
3864 type VirtualNetworkRuleListResultPage struct {
3865 fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)
3866 vnrlr VirtualNetworkRuleListResult
3867 }
3868
3869
3870
3871 func (page *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
3872 if tracing.IsEnabled() {
3873 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.NextWithContext")
3874 defer func() {
3875 sc := -1
3876 if page.Response().Response.Response != nil {
3877 sc = page.Response().Response.Response.StatusCode
3878 }
3879 tracing.EndSpan(ctx, sc, err)
3880 }()
3881 }
3882 for {
3883 next, err := page.fn(ctx, page.vnrlr)
3884 if err != nil {
3885 return err
3886 }
3887 page.vnrlr = next
3888 if !next.hasNextLink() || !next.IsEmpty() {
3889 break
3890 }
3891 }
3892 return nil
3893 }
3894
3895
3896
3897
3898 func (page *VirtualNetworkRuleListResultPage) Next() error {
3899 return page.NextWithContext(context.Background())
3900 }
3901
3902
3903 func (page VirtualNetworkRuleListResultPage) NotDone() bool {
3904 return !page.vnrlr.IsEmpty()
3905 }
3906
3907
3908 func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult {
3909 return page.vnrlr
3910 }
3911
3912
3913 func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule {
3914 if page.vnrlr.IsEmpty() {
3915 return nil
3916 }
3917 return *page.vnrlr.Value
3918 }
3919
3920
3921 func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage {
3922 return VirtualNetworkRuleListResultPage{
3923 fn: getNextPage,
3924 vnrlr: cur,
3925 }
3926 }
3927
3928
3929 type VirtualNetworkRuleProperties struct {
3930
3931 VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"`
3932
3933 IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"`
3934
3935 State VirtualNetworkRuleState `json:"state,omitempty"`
3936 }
3937
3938
3939 func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) {
3940 objectMap := make(map[string]interface{})
3941 if vnrp.VirtualNetworkSubnetID != nil {
3942 objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID
3943 }
3944 if vnrp.IgnoreMissingVnetServiceEndpoint != nil {
3945 objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint
3946 }
3947 return json.Marshal(objectMap)
3948 }
3949
3950
3951
3952 type VirtualNetworkRulesCreateOrUpdateFuture struct {
3953 azure.FutureAPI
3954
3955
3956 Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error)
3957 }
3958
3959
3960 func (future *VirtualNetworkRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
3961 var azFuture azure.Future
3962 if err := json.Unmarshal(body, &azFuture); err != nil {
3963 return err
3964 }
3965 future.FutureAPI = &azFuture
3966 future.Result = future.result
3967 return nil
3968 }
3969
3970
3971 func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) {
3972 var done bool
3973 done, err = future.DoneWithContext(context.Background(), client)
3974 if err != nil {
3975 err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
3976 return
3977 }
3978 if !done {
3979 vnr.Response.Response = future.Response()
3980 err = azure.NewAsyncOpIncompleteError("mariadb.VirtualNetworkRulesCreateOrUpdateFuture")
3981 return
3982 }
3983 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3984 if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent {
3985 vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response)
3986 if err != nil {
3987 err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request")
3988 }
3989 }
3990 return
3991 }
3992
3993
3994
3995 type VirtualNetworkRulesDeleteFuture struct {
3996 azure.FutureAPI
3997
3998
3999 Result func(VirtualNetworkRulesClient) (autorest.Response, error)
4000 }
4001
4002
4003 func (future *VirtualNetworkRulesDeleteFuture) UnmarshalJSON(body []byte) error {
4004 var azFuture azure.Future
4005 if err := json.Unmarshal(body, &azFuture); err != nil {
4006 return err
4007 }
4008 future.FutureAPI = &azFuture
4009 future.Result = future.result
4010 return nil
4011 }
4012
4013
4014 func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) {
4015 var done bool
4016 done, err = future.DoneWithContext(context.Background(), client)
4017 if err != nil {
4018 err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure")
4019 return
4020 }
4021 if !done {
4022 ar.Response = future.Response()
4023 err = azure.NewAsyncOpIncompleteError("mariadb.VirtualNetworkRulesDeleteFuture")
4024 return
4025 }
4026 ar.Response = future.Response()
4027 return
4028 }
4029
4030
4031 type WaitStatistic struct {
4032 autorest.Response `json:"-"`
4033
4034 *WaitStatisticProperties `json:"properties,omitempty"`
4035
4036 ID *string `json:"id,omitempty"`
4037
4038 Name *string `json:"name,omitempty"`
4039
4040 Type *string `json:"type,omitempty"`
4041 }
4042
4043
4044 func (ws WaitStatistic) MarshalJSON() ([]byte, error) {
4045 objectMap := make(map[string]interface{})
4046 if ws.WaitStatisticProperties != nil {
4047 objectMap["properties"] = ws.WaitStatisticProperties
4048 }
4049 return json.Marshal(objectMap)
4050 }
4051
4052
4053 func (ws *WaitStatistic) UnmarshalJSON(body []byte) error {
4054 var m map[string]*json.RawMessage
4055 err := json.Unmarshal(body, &m)
4056 if err != nil {
4057 return err
4058 }
4059 for k, v := range m {
4060 switch k {
4061 case "properties":
4062 if v != nil {
4063 var waitStatisticProperties WaitStatisticProperties
4064 err = json.Unmarshal(*v, &waitStatisticProperties)
4065 if err != nil {
4066 return err
4067 }
4068 ws.WaitStatisticProperties = &waitStatisticProperties
4069 }
4070 case "id":
4071 if v != nil {
4072 var ID string
4073 err = json.Unmarshal(*v, &ID)
4074 if err != nil {
4075 return err
4076 }
4077 ws.ID = &ID
4078 }
4079 case "name":
4080 if v != nil {
4081 var name string
4082 err = json.Unmarshal(*v, &name)
4083 if err != nil {
4084 return err
4085 }
4086 ws.Name = &name
4087 }
4088 case "type":
4089 if v != nil {
4090 var typeVar string
4091 err = json.Unmarshal(*v, &typeVar)
4092 if err != nil {
4093 return err
4094 }
4095 ws.Type = &typeVar
4096 }
4097 }
4098 }
4099
4100 return nil
4101 }
4102
4103
4104 type WaitStatisticProperties struct {
4105
4106 StartTime *date.Time `json:"startTime,omitempty"`
4107
4108 EndTime *date.Time `json:"endTime,omitempty"`
4109
4110 EventName *string `json:"eventName,omitempty"`
4111
4112 EventTypeName *string `json:"eventTypeName,omitempty"`
4113
4114 QueryID *int64 `json:"queryId,omitempty"`
4115
4116 DatabaseName *string `json:"databaseName,omitempty"`
4117
4118 UserID *int64 `json:"userId,omitempty"`
4119
4120 Count *int64 `json:"count,omitempty"`
4121
4122 TotalTimeInMs *float64 `json:"totalTimeInMs,omitempty"`
4123 }
4124
4125
4126 type WaitStatisticsInput struct {
4127
4128 *WaitStatisticsInputProperties `json:"properties,omitempty"`
4129 }
4130
4131
4132 func (wsi WaitStatisticsInput) MarshalJSON() ([]byte, error) {
4133 objectMap := make(map[string]interface{})
4134 if wsi.WaitStatisticsInputProperties != nil {
4135 objectMap["properties"] = wsi.WaitStatisticsInputProperties
4136 }
4137 return json.Marshal(objectMap)
4138 }
4139
4140
4141 func (wsi *WaitStatisticsInput) UnmarshalJSON(body []byte) error {
4142 var m map[string]*json.RawMessage
4143 err := json.Unmarshal(body, &m)
4144 if err != nil {
4145 return err
4146 }
4147 for k, v := range m {
4148 switch k {
4149 case "properties":
4150 if v != nil {
4151 var waitStatisticsInputProperties WaitStatisticsInputProperties
4152 err = json.Unmarshal(*v, &waitStatisticsInputProperties)
4153 if err != nil {
4154 return err
4155 }
4156 wsi.WaitStatisticsInputProperties = &waitStatisticsInputProperties
4157 }
4158 }
4159 }
4160
4161 return nil
4162 }
4163
4164
4165 type WaitStatisticsInputProperties struct {
4166
4167 ObservationStartTime *date.Time `json:"observationStartTime,omitempty"`
4168
4169 ObservationEndTime *date.Time `json:"observationEndTime,omitempty"`
4170
4171 AggregationWindow *string `json:"aggregationWindow,omitempty"`
4172 }
4173
4174
4175 type WaitStatisticsResultList struct {
4176 autorest.Response `json:"-"`
4177
4178 Value *[]WaitStatistic `json:"value,omitempty"`
4179
4180 NextLink *string `json:"nextLink,omitempty"`
4181 }
4182
4183
4184 func (wsrl WaitStatisticsResultList) MarshalJSON() ([]byte, error) {
4185 objectMap := make(map[string]interface{})
4186 return json.Marshal(objectMap)
4187 }
4188
4189
4190 type WaitStatisticsResultListIterator struct {
4191 i int
4192 page WaitStatisticsResultListPage
4193 }
4194
4195
4196
4197 func (iter *WaitStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) {
4198 if tracing.IsEnabled() {
4199 ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListIterator.NextWithContext")
4200 defer func() {
4201 sc := -1
4202 if iter.Response().Response.Response != nil {
4203 sc = iter.Response().Response.Response.StatusCode
4204 }
4205 tracing.EndSpan(ctx, sc, err)
4206 }()
4207 }
4208 iter.i++
4209 if iter.i < len(iter.page.Values()) {
4210 return nil
4211 }
4212 err = iter.page.NextWithContext(ctx)
4213 if err != nil {
4214 iter.i--
4215 return err
4216 }
4217 iter.i = 0
4218 return nil
4219 }
4220
4221
4222
4223
4224 func (iter *WaitStatisticsResultListIterator) Next() error {
4225 return iter.NextWithContext(context.Background())
4226 }
4227
4228
4229 func (iter WaitStatisticsResultListIterator) NotDone() bool {
4230 return iter.page.NotDone() && iter.i < len(iter.page.Values())
4231 }
4232
4233
4234 func (iter WaitStatisticsResultListIterator) Response() WaitStatisticsResultList {
4235 return iter.page.Response()
4236 }
4237
4238
4239
4240 func (iter WaitStatisticsResultListIterator) Value() WaitStatistic {
4241 if !iter.page.NotDone() {
4242 return WaitStatistic{}
4243 }
4244 return iter.page.Values()[iter.i]
4245 }
4246
4247
4248 func NewWaitStatisticsResultListIterator(page WaitStatisticsResultListPage) WaitStatisticsResultListIterator {
4249 return WaitStatisticsResultListIterator{page: page}
4250 }
4251
4252
4253 func (wsrl WaitStatisticsResultList) IsEmpty() bool {
4254 return wsrl.Value == nil || len(*wsrl.Value) == 0
4255 }
4256
4257
4258 func (wsrl WaitStatisticsResultList) hasNextLink() bool {
4259 return wsrl.NextLink != nil && len(*wsrl.NextLink) != 0
4260 }
4261
4262
4263
4264 func (wsrl WaitStatisticsResultList) waitStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) {
4265 if !wsrl.hasNextLink() {
4266 return nil, nil
4267 }
4268 return autorest.Prepare((&http.Request{}).WithContext(ctx),
4269 autorest.AsJSON(),
4270 autorest.AsGet(),
4271 autorest.WithBaseURL(to.String(wsrl.NextLink)))
4272 }
4273
4274
4275 type WaitStatisticsResultListPage struct {
4276 fn func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error)
4277 wsrl WaitStatisticsResultList
4278 }
4279
4280
4281
4282 func (page *WaitStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) {
4283 if tracing.IsEnabled() {
4284 ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListPage.NextWithContext")
4285 defer func() {
4286 sc := -1
4287 if page.Response().Response.Response != nil {
4288 sc = page.Response().Response.Response.StatusCode
4289 }
4290 tracing.EndSpan(ctx, sc, err)
4291 }()
4292 }
4293 for {
4294 next, err := page.fn(ctx, page.wsrl)
4295 if err != nil {
4296 return err
4297 }
4298 page.wsrl = next
4299 if !next.hasNextLink() || !next.IsEmpty() {
4300 break
4301 }
4302 }
4303 return nil
4304 }
4305
4306
4307
4308
4309 func (page *WaitStatisticsResultListPage) Next() error {
4310 return page.NextWithContext(context.Background())
4311 }
4312
4313
4314 func (page WaitStatisticsResultListPage) NotDone() bool {
4315 return !page.wsrl.IsEmpty()
4316 }
4317
4318
4319 func (page WaitStatisticsResultListPage) Response() WaitStatisticsResultList {
4320 return page.wsrl
4321 }
4322
4323
4324 func (page WaitStatisticsResultListPage) Values() []WaitStatistic {
4325 if page.wsrl.IsEmpty() {
4326 return nil
4327 }
4328 return *page.wsrl.Value
4329 }
4330
4331
4332 func NewWaitStatisticsResultListPage(cur WaitStatisticsResultList, getNextPage func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error)) WaitStatisticsResultListPage {
4333 return WaitStatisticsResultListPage{
4334 fn: getNextPage,
4335 wsrl: cur,
4336 }
4337 }
4338
View as plain text