1 package postgresqlflexibleservers
2
3
4
5
6
7
8
9 import (
10 "context"
11 "encoding/json"
12 "github.com/Azure/go-autorest/autorest"
13 "github.com/Azure/go-autorest/autorest/azure"
14 "github.com/Azure/go-autorest/autorest/date"
15 "github.com/Azure/go-autorest/autorest/to"
16 "github.com/Azure/go-autorest/tracing"
17 "net/http"
18 )
19
20
21 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers"
22
23
24 type AzureEntityResource struct {
25
26 Etag *string `json:"etag,omitempty"`
27
28 ID *string `json:"id,omitempty"`
29
30 Name *string `json:"name,omitempty"`
31
32 Type *string `json:"type,omitempty"`
33 }
34
35
36 func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
37 objectMap := make(map[string]interface{})
38 return json.Marshal(objectMap)
39 }
40
41
42 type CapabilitiesListResult struct {
43 autorest.Response `json:"-"`
44
45 Value *[]CapabilityProperties `json:"value,omitempty"`
46
47 NextLink *string `json:"nextLink,omitempty"`
48 }
49
50
51 func (clr CapabilitiesListResult) MarshalJSON() ([]byte, error) {
52 objectMap := make(map[string]interface{})
53 return json.Marshal(objectMap)
54 }
55
56
57 type CapabilitiesListResultIterator struct {
58 i int
59 page CapabilitiesListResultPage
60 }
61
62
63
64 func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) {
65 if tracing.IsEnabled() {
66 ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext")
67 defer func() {
68 sc := -1
69 if iter.Response().Response.Response != nil {
70 sc = iter.Response().Response.Response.StatusCode
71 }
72 tracing.EndSpan(ctx, sc, err)
73 }()
74 }
75 iter.i++
76 if iter.i < len(iter.page.Values()) {
77 return nil
78 }
79 err = iter.page.NextWithContext(ctx)
80 if err != nil {
81 iter.i--
82 return err
83 }
84 iter.i = 0
85 return nil
86 }
87
88
89
90
91 func (iter *CapabilitiesListResultIterator) Next() error {
92 return iter.NextWithContext(context.Background())
93 }
94
95
96 func (iter CapabilitiesListResultIterator) NotDone() bool {
97 return iter.page.NotDone() && iter.i < len(iter.page.Values())
98 }
99
100
101 func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult {
102 return iter.page.Response()
103 }
104
105
106
107 func (iter CapabilitiesListResultIterator) Value() CapabilityProperties {
108 if !iter.page.NotDone() {
109 return CapabilityProperties{}
110 }
111 return iter.page.Values()[iter.i]
112 }
113
114
115 func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator {
116 return CapabilitiesListResultIterator{page: page}
117 }
118
119
120 func (clr CapabilitiesListResult) IsEmpty() bool {
121 return clr.Value == nil || len(*clr.Value) == 0
122 }
123
124
125 func (clr CapabilitiesListResult) hasNextLink() bool {
126 return clr.NextLink != nil && len(*clr.NextLink) != 0
127 }
128
129
130
131 func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) {
132 if !clr.hasNextLink() {
133 return nil, nil
134 }
135 return autorest.Prepare((&http.Request{}).WithContext(ctx),
136 autorest.AsJSON(),
137 autorest.AsGet(),
138 autorest.WithBaseURL(to.String(clr.NextLink)))
139 }
140
141
142 type CapabilitiesListResultPage struct {
143 fn func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)
144 clr CapabilitiesListResult
145 }
146
147
148
149 func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) {
150 if tracing.IsEnabled() {
151 ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext")
152 defer func() {
153 sc := -1
154 if page.Response().Response.Response != nil {
155 sc = page.Response().Response.Response.StatusCode
156 }
157 tracing.EndSpan(ctx, sc, err)
158 }()
159 }
160 for {
161 next, err := page.fn(ctx, page.clr)
162 if err != nil {
163 return err
164 }
165 page.clr = next
166 if !next.hasNextLink() || !next.IsEmpty() {
167 break
168 }
169 }
170 return nil
171 }
172
173
174
175
176 func (page *CapabilitiesListResultPage) Next() error {
177 return page.NextWithContext(context.Background())
178 }
179
180
181 func (page CapabilitiesListResultPage) NotDone() bool {
182 return !page.clr.IsEmpty()
183 }
184
185
186 func (page CapabilitiesListResultPage) Response() CapabilitiesListResult {
187 return page.clr
188 }
189
190
191 func (page CapabilitiesListResultPage) Values() []CapabilityProperties {
192 if page.clr.IsEmpty() {
193 return nil
194 }
195 return *page.clr.Value
196 }
197
198
199 func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage {
200 return CapabilitiesListResultPage{
201 fn: getNextPage,
202 clr: cur,
203 }
204 }
205
206
207 type CapabilityProperties struct {
208
209 Zone *string `json:"zone,omitempty"`
210
211 SupportedFlexibleServerEditions *[]ServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"`
212 }
213
214
215 func (cp CapabilityProperties) MarshalJSON() ([]byte, error) {
216 objectMap := make(map[string]interface{})
217 return json.Marshal(objectMap)
218 }
219
220
221 type CloudError struct {
222 Error *ErrorResponse `json:"error,omitempty"`
223 }
224
225
226 type Configuration struct {
227 autorest.Response `json:"-"`
228
229 *ConfigurationProperties `json:"properties,omitempty"`
230
231 ID *string `json:"id,omitempty"`
232
233 Name *string `json:"name,omitempty"`
234
235 Type *string `json:"type,omitempty"`
236 }
237
238
239 func (c Configuration) MarshalJSON() ([]byte, error) {
240 objectMap := make(map[string]interface{})
241 if c.ConfigurationProperties != nil {
242 objectMap["properties"] = c.ConfigurationProperties
243 }
244 return json.Marshal(objectMap)
245 }
246
247
248 func (c *Configuration) UnmarshalJSON(body []byte) error {
249 var m map[string]*json.RawMessage
250 err := json.Unmarshal(body, &m)
251 if err != nil {
252 return err
253 }
254 for k, v := range m {
255 switch k {
256 case "properties":
257 if v != nil {
258 var configurationProperties ConfigurationProperties
259 err = json.Unmarshal(*v, &configurationProperties)
260 if err != nil {
261 return err
262 }
263 c.ConfigurationProperties = &configurationProperties
264 }
265 case "id":
266 if v != nil {
267 var ID string
268 err = json.Unmarshal(*v, &ID)
269 if err != nil {
270 return err
271 }
272 c.ID = &ID
273 }
274 case "name":
275 if v != nil {
276 var name string
277 err = json.Unmarshal(*v, &name)
278 if err != nil {
279 return err
280 }
281 c.Name = &name
282 }
283 case "type":
284 if v != nil {
285 var typeVar string
286 err = json.Unmarshal(*v, &typeVar)
287 if err != nil {
288 return err
289 }
290 c.Type = &typeVar
291 }
292 }
293 }
294
295 return nil
296 }
297
298
299 type ConfigurationListResult struct {
300 autorest.Response `json:"-"`
301
302 Value *[]Configuration `json:"value,omitempty"`
303
304 NextLink *string `json:"nextLink,omitempty"`
305 }
306
307
308 type ConfigurationListResultIterator struct {
309 i int
310 page ConfigurationListResultPage
311 }
312
313
314
315 func (iter *ConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) {
316 if tracing.IsEnabled() {
317 ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultIterator.NextWithContext")
318 defer func() {
319 sc := -1
320 if iter.Response().Response.Response != nil {
321 sc = iter.Response().Response.Response.StatusCode
322 }
323 tracing.EndSpan(ctx, sc, err)
324 }()
325 }
326 iter.i++
327 if iter.i < len(iter.page.Values()) {
328 return nil
329 }
330 err = iter.page.NextWithContext(ctx)
331 if err != nil {
332 iter.i--
333 return err
334 }
335 iter.i = 0
336 return nil
337 }
338
339
340
341
342 func (iter *ConfigurationListResultIterator) Next() error {
343 return iter.NextWithContext(context.Background())
344 }
345
346
347 func (iter ConfigurationListResultIterator) NotDone() bool {
348 return iter.page.NotDone() && iter.i < len(iter.page.Values())
349 }
350
351
352 func (iter ConfigurationListResultIterator) Response() ConfigurationListResult {
353 return iter.page.Response()
354 }
355
356
357
358 func (iter ConfigurationListResultIterator) Value() Configuration {
359 if !iter.page.NotDone() {
360 return Configuration{}
361 }
362 return iter.page.Values()[iter.i]
363 }
364
365
366 func NewConfigurationListResultIterator(page ConfigurationListResultPage) ConfigurationListResultIterator {
367 return ConfigurationListResultIterator{page: page}
368 }
369
370
371 func (clr ConfigurationListResult) IsEmpty() bool {
372 return clr.Value == nil || len(*clr.Value) == 0
373 }
374
375
376 func (clr ConfigurationListResult) hasNextLink() bool {
377 return clr.NextLink != nil && len(*clr.NextLink) != 0
378 }
379
380
381
382 func (clr ConfigurationListResult) configurationListResultPreparer(ctx context.Context) (*http.Request, error) {
383 if !clr.hasNextLink() {
384 return nil, nil
385 }
386 return autorest.Prepare((&http.Request{}).WithContext(ctx),
387 autorest.AsJSON(),
388 autorest.AsGet(),
389 autorest.WithBaseURL(to.String(clr.NextLink)))
390 }
391
392
393 type ConfigurationListResultPage struct {
394 fn func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)
395 clr ConfigurationListResult
396 }
397
398
399
400 func (page *ConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) {
401 if tracing.IsEnabled() {
402 ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultPage.NextWithContext")
403 defer func() {
404 sc := -1
405 if page.Response().Response.Response != nil {
406 sc = page.Response().Response.Response.StatusCode
407 }
408 tracing.EndSpan(ctx, sc, err)
409 }()
410 }
411 for {
412 next, err := page.fn(ctx, page.clr)
413 if err != nil {
414 return err
415 }
416 page.clr = next
417 if !next.hasNextLink() || !next.IsEmpty() {
418 break
419 }
420 }
421 return nil
422 }
423
424
425
426
427 func (page *ConfigurationListResultPage) Next() error {
428 return page.NextWithContext(context.Background())
429 }
430
431
432 func (page ConfigurationListResultPage) NotDone() bool {
433 return !page.clr.IsEmpty()
434 }
435
436
437 func (page ConfigurationListResultPage) Response() ConfigurationListResult {
438 return page.clr
439 }
440
441
442 func (page ConfigurationListResultPage) Values() []Configuration {
443 if page.clr.IsEmpty() {
444 return nil
445 }
446 return *page.clr.Value
447 }
448
449
450 func NewConfigurationListResultPage(cur ConfigurationListResult, getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage {
451 return ConfigurationListResultPage{
452 fn: getNextPage,
453 clr: cur,
454 }
455 }
456
457
458 type ConfigurationProperties struct {
459
460 Value *string `json:"value,omitempty"`
461
462 Description *string `json:"description,omitempty"`
463
464 DefaultValue *string `json:"defaultValue,omitempty"`
465
466 DataType ConfigurationDataType `json:"dataType,omitempty"`
467
468 AllowedValues *string `json:"allowedValues,omitempty"`
469
470 Source *string `json:"source,omitempty"`
471 }
472
473
474 func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) {
475 objectMap := make(map[string]interface{})
476 if cp.Value != nil {
477 objectMap["value"] = cp.Value
478 }
479 if cp.Source != nil {
480 objectMap["source"] = cp.Source
481 }
482 return json.Marshal(objectMap)
483 }
484
485
486
487 type ConfigurationsUpdateFuture struct {
488 azure.FutureAPI
489
490
491 Result func(ConfigurationsClient) (Configuration, error)
492 }
493
494
495 func (future *ConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error {
496 var azFuture azure.Future
497 if err := json.Unmarshal(body, &azFuture); err != nil {
498 return err
499 }
500 future.FutureAPI = &azFuture
501 future.Result = future.result
502 return nil
503 }
504
505
506 func (future *ConfigurationsUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) {
507 var done bool
508 done, err = future.DoneWithContext(context.Background(), client)
509 if err != nil {
510 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure")
511 return
512 }
513 if !done {
514 c.Response.Response = future.Response()
515 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ConfigurationsUpdateFuture")
516 return
517 }
518 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
519 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
520 c, err = client.UpdateResponder(c.Response.Response)
521 if err != nil {
522 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
523 }
524 }
525 return
526 }
527
528
529 type DelegatedSubnetUsage struct {
530
531 SubnetName *string `json:"subnetName,omitempty"`
532
533 Usage *int64 `json:"usage,omitempty"`
534 }
535
536
537 func (dsu DelegatedSubnetUsage) MarshalJSON() ([]byte, error) {
538 objectMap := make(map[string]interface{})
539 return json.Marshal(objectMap)
540 }
541
542
543 type ErrorAdditionalInfo struct {
544
545 Type *string `json:"type,omitempty"`
546
547 Info interface{} `json:"info,omitempty"`
548 }
549
550
551 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
552 objectMap := make(map[string]interface{})
553 return json.Marshal(objectMap)
554 }
555
556
557
558 type ErrorResponse struct {
559
560 Code *string `json:"code,omitempty"`
561
562 Message *string `json:"message,omitempty"`
563
564 Target *string `json:"target,omitempty"`
565
566 Details *[]ErrorResponse `json:"details,omitempty"`
567
568 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
569 }
570
571
572 func (er ErrorResponse) MarshalJSON() ([]byte, error) {
573 objectMap := make(map[string]interface{})
574 return json.Marshal(objectMap)
575 }
576
577
578 type FirewallRule struct {
579 autorest.Response `json:"-"`
580
581 *FirewallRuleProperties `json:"properties,omitempty"`
582
583 ID *string `json:"id,omitempty"`
584
585 Name *string `json:"name,omitempty"`
586
587 Type *string `json:"type,omitempty"`
588 }
589
590
591 func (fr FirewallRule) MarshalJSON() ([]byte, error) {
592 objectMap := make(map[string]interface{})
593 if fr.FirewallRuleProperties != nil {
594 objectMap["properties"] = fr.FirewallRuleProperties
595 }
596 return json.Marshal(objectMap)
597 }
598
599
600 func (fr *FirewallRule) UnmarshalJSON(body []byte) error {
601 var m map[string]*json.RawMessage
602 err := json.Unmarshal(body, &m)
603 if err != nil {
604 return err
605 }
606 for k, v := range m {
607 switch k {
608 case "properties":
609 if v != nil {
610 var firewallRuleProperties FirewallRuleProperties
611 err = json.Unmarshal(*v, &firewallRuleProperties)
612 if err != nil {
613 return err
614 }
615 fr.FirewallRuleProperties = &firewallRuleProperties
616 }
617 case "id":
618 if v != nil {
619 var ID string
620 err = json.Unmarshal(*v, &ID)
621 if err != nil {
622 return err
623 }
624 fr.ID = &ID
625 }
626 case "name":
627 if v != nil {
628 var name string
629 err = json.Unmarshal(*v, &name)
630 if err != nil {
631 return err
632 }
633 fr.Name = &name
634 }
635 case "type":
636 if v != nil {
637 var typeVar string
638 err = json.Unmarshal(*v, &typeVar)
639 if err != nil {
640 return err
641 }
642 fr.Type = &typeVar
643 }
644 }
645 }
646
647 return nil
648 }
649
650
651 type FirewallRuleListResult struct {
652 autorest.Response `json:"-"`
653
654 Value *[]FirewallRule `json:"value,omitempty"`
655
656 NextLink *string `json:"nextLink,omitempty"`
657 }
658
659
660 type FirewallRuleListResultIterator struct {
661 i int
662 page FirewallRuleListResultPage
663 }
664
665
666
667 func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
668 if tracing.IsEnabled() {
669 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext")
670 defer func() {
671 sc := -1
672 if iter.Response().Response.Response != nil {
673 sc = iter.Response().Response.Response.StatusCode
674 }
675 tracing.EndSpan(ctx, sc, err)
676 }()
677 }
678 iter.i++
679 if iter.i < len(iter.page.Values()) {
680 return nil
681 }
682 err = iter.page.NextWithContext(ctx)
683 if err != nil {
684 iter.i--
685 return err
686 }
687 iter.i = 0
688 return nil
689 }
690
691
692
693
694 func (iter *FirewallRuleListResultIterator) Next() error {
695 return iter.NextWithContext(context.Background())
696 }
697
698
699 func (iter FirewallRuleListResultIterator) NotDone() bool {
700 return iter.page.NotDone() && iter.i < len(iter.page.Values())
701 }
702
703
704 func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult {
705 return iter.page.Response()
706 }
707
708
709
710 func (iter FirewallRuleListResultIterator) Value() FirewallRule {
711 if !iter.page.NotDone() {
712 return FirewallRule{}
713 }
714 return iter.page.Values()[iter.i]
715 }
716
717
718 func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator {
719 return FirewallRuleListResultIterator{page: page}
720 }
721
722
723 func (frlr FirewallRuleListResult) IsEmpty() bool {
724 return frlr.Value == nil || len(*frlr.Value) == 0
725 }
726
727
728 func (frlr FirewallRuleListResult) hasNextLink() bool {
729 return frlr.NextLink != nil && len(*frlr.NextLink) != 0
730 }
731
732
733
734 func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
735 if !frlr.hasNextLink() {
736 return nil, nil
737 }
738 return autorest.Prepare((&http.Request{}).WithContext(ctx),
739 autorest.AsJSON(),
740 autorest.AsGet(),
741 autorest.WithBaseURL(to.String(frlr.NextLink)))
742 }
743
744
745 type FirewallRuleListResultPage struct {
746 fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)
747 frlr FirewallRuleListResult
748 }
749
750
751
752 func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
753 if tracing.IsEnabled() {
754 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext")
755 defer func() {
756 sc := -1
757 if page.Response().Response.Response != nil {
758 sc = page.Response().Response.Response.StatusCode
759 }
760 tracing.EndSpan(ctx, sc, err)
761 }()
762 }
763 for {
764 next, err := page.fn(ctx, page.frlr)
765 if err != nil {
766 return err
767 }
768 page.frlr = next
769 if !next.hasNextLink() || !next.IsEmpty() {
770 break
771 }
772 }
773 return nil
774 }
775
776
777
778
779 func (page *FirewallRuleListResultPage) Next() error {
780 return page.NextWithContext(context.Background())
781 }
782
783
784 func (page FirewallRuleListResultPage) NotDone() bool {
785 return !page.frlr.IsEmpty()
786 }
787
788
789 func (page FirewallRuleListResultPage) Response() FirewallRuleListResult {
790 return page.frlr
791 }
792
793
794 func (page FirewallRuleListResultPage) Values() []FirewallRule {
795 if page.frlr.IsEmpty() {
796 return nil
797 }
798 return *page.frlr.Value
799 }
800
801
802 func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {
803 return FirewallRuleListResultPage{
804 fn: getNextPage,
805 frlr: cur,
806 }
807 }
808
809
810 type FirewallRuleProperties struct {
811
812 StartIPAddress *string `json:"startIpAddress,omitempty"`
813
814 EndIPAddress *string `json:"endIpAddress,omitempty"`
815 }
816
817
818
819 type FirewallRulesCreateOrUpdateFuture struct {
820 azure.FutureAPI
821
822
823 Result func(FirewallRulesClient) (FirewallRule, error)
824 }
825
826
827 func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
828 var azFuture azure.Future
829 if err := json.Unmarshal(body, &azFuture); err != nil {
830 return err
831 }
832 future.FutureAPI = &azFuture
833 future.Result = future.result
834 return nil
835 }
836
837
838 func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) {
839 var done bool
840 done, err = future.DoneWithContext(context.Background(), client)
841 if err != nil {
842 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
843 return
844 }
845 if !done {
846 fr.Response.Response = future.Response()
847 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture")
848 return
849 }
850 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
851 if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent {
852 fr, err = client.CreateOrUpdateResponder(fr.Response.Response)
853 if err != nil {
854 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request")
855 }
856 }
857 return
858 }
859
860
861
862 type FirewallRulesDeleteFuture struct {
863 azure.FutureAPI
864
865
866 Result func(FirewallRulesClient) (autorest.Response, error)
867 }
868
869
870 func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error {
871 var azFuture azure.Future
872 if err := json.Unmarshal(body, &azFuture); err != nil {
873 return err
874 }
875 future.FutureAPI = &azFuture
876 future.Result = future.result
877 return nil
878 }
879
880
881 func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) {
882 var done bool
883 done, err = future.DoneWithContext(context.Background(), client)
884 if err != nil {
885 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure")
886 return
887 }
888 if !done {
889 ar.Response = future.Response()
890 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.FirewallRulesDeleteFuture")
891 return
892 }
893 ar.Response = future.Response()
894 return
895 }
896
897
898 type Identity struct {
899
900 PrincipalID *string `json:"principalId,omitempty"`
901
902 TenantID *string `json:"tenantId,omitempty"`
903
904 Type ResourceIdentityType `json:"type,omitempty"`
905 }
906
907
908 func (i Identity) MarshalJSON() ([]byte, error) {
909 objectMap := make(map[string]interface{})
910 if i.Type != "" {
911 objectMap["type"] = i.Type
912 }
913 return json.Marshal(objectMap)
914 }
915
916
917 type MaintenanceWindow struct {
918
919 CustomWindow *string `json:"customWindow,omitempty"`
920
921 StartHour *int32 `json:"startHour,omitempty"`
922
923 StartMinute *int32 `json:"startMinute,omitempty"`
924
925 DayOfWeek *int32 `json:"dayOfWeek,omitempty"`
926 }
927
928
929 type NameAvailability struct {
930 autorest.Response `json:"-"`
931
932 Message *string `json:"message,omitempty"`
933
934 NameAvailable *bool `json:"nameAvailable,omitempty"`
935
936 Name *string `json:"name,omitempty"`
937
938 Type *string `json:"type,omitempty"`
939 }
940
941
942 type NameAvailabilityRequest struct {
943
944 Name *string `json:"name,omitempty"`
945
946 Type *string `json:"type,omitempty"`
947 }
948
949
950 type Operation struct {
951
952 Name *string `json:"name,omitempty"`
953
954 Display *OperationDisplay `json:"display,omitempty"`
955
956 IsDataAction *bool `json:"isDataAction,omitempty"`
957
958 Origin OperationOrigin `json:"origin,omitempty"`
959
960 Properties map[string]interface{} `json:"properties"`
961 }
962
963
964 func (o Operation) MarshalJSON() ([]byte, error) {
965 objectMap := make(map[string]interface{})
966 if o.IsDataAction != nil {
967 objectMap["isDataAction"] = o.IsDataAction
968 }
969 return json.Marshal(objectMap)
970 }
971
972
973 type OperationDisplay struct {
974
975 Provider *string `json:"provider,omitempty"`
976
977 Resource *string `json:"resource,omitempty"`
978
979 Operation *string `json:"operation,omitempty"`
980
981 Description *string `json:"description,omitempty"`
982 }
983
984
985 func (od OperationDisplay) MarshalJSON() ([]byte, error) {
986 objectMap := make(map[string]interface{})
987 return json.Marshal(objectMap)
988 }
989
990
991 type OperationListResult struct {
992 autorest.Response `json:"-"`
993
994 Value *[]Operation `json:"value,omitempty"`
995
996
997 NextLink *string `json:"nextLink,omitempty"`
998 }
999
1000
1001 type Plan struct {
1002
1003 Name *string `json:"name,omitempty"`
1004
1005 Publisher *string `json:"publisher,omitempty"`
1006
1007 Product *string `json:"product,omitempty"`
1008
1009 PromotionCode *string `json:"promotionCode,omitempty"`
1010
1011 Version *string `json:"version,omitempty"`
1012 }
1013
1014
1015
1016 type ProxyResource struct {
1017
1018 ID *string `json:"id,omitempty"`
1019
1020 Name *string `json:"name,omitempty"`
1021
1022 Type *string `json:"type,omitempty"`
1023 }
1024
1025
1026 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1027 objectMap := make(map[string]interface{})
1028 return json.Marshal(objectMap)
1029 }
1030
1031
1032 type Resource struct {
1033
1034 ID *string `json:"id,omitempty"`
1035
1036 Name *string `json:"name,omitempty"`
1037
1038 Type *string `json:"type,omitempty"`
1039 }
1040
1041
1042 func (r Resource) MarshalJSON() ([]byte, error) {
1043 objectMap := make(map[string]interface{})
1044 return json.Marshal(objectMap)
1045 }
1046
1047
1048
1049
1050 type ResourceModelWithAllowedPropertySet struct {
1051
1052 ID *string `json:"id,omitempty"`
1053
1054 Name *string `json:"name,omitempty"`
1055
1056 Type *string `json:"type,omitempty"`
1057
1058 Location *string `json:"location,omitempty"`
1059
1060 ManagedBy *string `json:"managedBy,omitempty"`
1061
1062 Kind *string `json:"kind,omitempty"`
1063
1064 Etag *string `json:"etag,omitempty"`
1065
1066 Tags map[string]*string `json:"tags"`
1067 Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"`
1068 Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"`
1069 Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"`
1070 }
1071
1072
1073 func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) {
1074 objectMap := make(map[string]interface{})
1075 if rmwaps.Location != nil {
1076 objectMap["location"] = rmwaps.Location
1077 }
1078 if rmwaps.ManagedBy != nil {
1079 objectMap["managedBy"] = rmwaps.ManagedBy
1080 }
1081 if rmwaps.Kind != nil {
1082 objectMap["kind"] = rmwaps.Kind
1083 }
1084 if rmwaps.Tags != nil {
1085 objectMap["tags"] = rmwaps.Tags
1086 }
1087 if rmwaps.Identity != nil {
1088 objectMap["identity"] = rmwaps.Identity
1089 }
1090 if rmwaps.Sku != nil {
1091 objectMap["sku"] = rmwaps.Sku
1092 }
1093 if rmwaps.Plan != nil {
1094 objectMap["plan"] = rmwaps.Plan
1095 }
1096 return json.Marshal(objectMap)
1097 }
1098
1099
1100 type ResourceModelWithAllowedPropertySetIdentity struct {
1101
1102 PrincipalID *string `json:"principalId,omitempty"`
1103
1104 TenantID *string `json:"tenantId,omitempty"`
1105
1106 Type ResourceIdentityType `json:"type,omitempty"`
1107 }
1108
1109
1110 func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) {
1111 objectMap := make(map[string]interface{})
1112 if rmwaps.Type != "" {
1113 objectMap["type"] = rmwaps.Type
1114 }
1115 return json.Marshal(objectMap)
1116 }
1117
1118
1119 type ResourceModelWithAllowedPropertySetPlan struct {
1120
1121 Name *string `json:"name,omitempty"`
1122
1123 Publisher *string `json:"publisher,omitempty"`
1124
1125 Product *string `json:"product,omitempty"`
1126
1127 PromotionCode *string `json:"promotionCode,omitempty"`
1128
1129 Version *string `json:"version,omitempty"`
1130 }
1131
1132
1133 type ResourceModelWithAllowedPropertySetSku struct {
1134
1135 Name *string `json:"name,omitempty"`
1136
1137 Tier SkuTier `json:"tier,omitempty"`
1138 }
1139
1140
1141 type Server struct {
1142 autorest.Response `json:"-"`
1143
1144 Identity *Identity `json:"identity,omitempty"`
1145
1146 Sku *Sku `json:"sku,omitempty"`
1147
1148 *ServerProperties `json:"properties,omitempty"`
1149
1150 Tags map[string]*string `json:"tags"`
1151
1152 Location *string `json:"location,omitempty"`
1153
1154 ID *string `json:"id,omitempty"`
1155
1156 Name *string `json:"name,omitempty"`
1157
1158 Type *string `json:"type,omitempty"`
1159 }
1160
1161
1162 func (s Server) MarshalJSON() ([]byte, error) {
1163 objectMap := make(map[string]interface{})
1164 if s.Identity != nil {
1165 objectMap["identity"] = s.Identity
1166 }
1167 if s.Sku != nil {
1168 objectMap["sku"] = s.Sku
1169 }
1170 if s.ServerProperties != nil {
1171 objectMap["properties"] = s.ServerProperties
1172 }
1173 if s.Tags != nil {
1174 objectMap["tags"] = s.Tags
1175 }
1176 if s.Location != nil {
1177 objectMap["location"] = s.Location
1178 }
1179 return json.Marshal(objectMap)
1180 }
1181
1182
1183 func (s *Server) UnmarshalJSON(body []byte) error {
1184 var m map[string]*json.RawMessage
1185 err := json.Unmarshal(body, &m)
1186 if err != nil {
1187 return err
1188 }
1189 for k, v := range m {
1190 switch k {
1191 case "identity":
1192 if v != nil {
1193 var identity Identity
1194 err = json.Unmarshal(*v, &identity)
1195 if err != nil {
1196 return err
1197 }
1198 s.Identity = &identity
1199 }
1200 case "sku":
1201 if v != nil {
1202 var sku Sku
1203 err = json.Unmarshal(*v, &sku)
1204 if err != nil {
1205 return err
1206 }
1207 s.Sku = &sku
1208 }
1209 case "properties":
1210 if v != nil {
1211 var serverProperties ServerProperties
1212 err = json.Unmarshal(*v, &serverProperties)
1213 if err != nil {
1214 return err
1215 }
1216 s.ServerProperties = &serverProperties
1217 }
1218 case "tags":
1219 if v != nil {
1220 var tags map[string]*string
1221 err = json.Unmarshal(*v, &tags)
1222 if err != nil {
1223 return err
1224 }
1225 s.Tags = tags
1226 }
1227 case "location":
1228 if v != nil {
1229 var location string
1230 err = json.Unmarshal(*v, &location)
1231 if err != nil {
1232 return err
1233 }
1234 s.Location = &location
1235 }
1236 case "id":
1237 if v != nil {
1238 var ID string
1239 err = json.Unmarshal(*v, &ID)
1240 if err != nil {
1241 return err
1242 }
1243 s.ID = &ID
1244 }
1245 case "name":
1246 if v != nil {
1247 var name string
1248 err = json.Unmarshal(*v, &name)
1249 if err != nil {
1250 return err
1251 }
1252 s.Name = &name
1253 }
1254 case "type":
1255 if v != nil {
1256 var typeVar string
1257 err = json.Unmarshal(*v, &typeVar)
1258 if err != nil {
1259 return err
1260 }
1261 s.Type = &typeVar
1262 }
1263 }
1264 }
1265
1266 return nil
1267 }
1268
1269
1270 type ServerEditionCapability struct {
1271
1272 Name *string `json:"name,omitempty"`
1273
1274 SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"`
1275
1276 SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"`
1277 }
1278
1279
1280 func (sec ServerEditionCapability) MarshalJSON() ([]byte, error) {
1281 objectMap := make(map[string]interface{})
1282 return json.Marshal(objectMap)
1283 }
1284
1285
1286 type ServerForUpdate struct {
1287
1288 Location *string `json:"location,omitempty"`
1289
1290 Sku *Sku `json:"sku,omitempty"`
1291
1292 *ServerPropertiesForUpdate `json:"properties,omitempty"`
1293
1294 Tags map[string]*string `json:"tags"`
1295 }
1296
1297
1298 func (sfu ServerForUpdate) MarshalJSON() ([]byte, error) {
1299 objectMap := make(map[string]interface{})
1300 if sfu.Location != nil {
1301 objectMap["location"] = sfu.Location
1302 }
1303 if sfu.Sku != nil {
1304 objectMap["sku"] = sfu.Sku
1305 }
1306 if sfu.ServerPropertiesForUpdate != nil {
1307 objectMap["properties"] = sfu.ServerPropertiesForUpdate
1308 }
1309 if sfu.Tags != nil {
1310 objectMap["tags"] = sfu.Tags
1311 }
1312 return json.Marshal(objectMap)
1313 }
1314
1315
1316 func (sfu *ServerForUpdate) UnmarshalJSON(body []byte) error {
1317 var m map[string]*json.RawMessage
1318 err := json.Unmarshal(body, &m)
1319 if err != nil {
1320 return err
1321 }
1322 for k, v := range m {
1323 switch k {
1324 case "location":
1325 if v != nil {
1326 var location string
1327 err = json.Unmarshal(*v, &location)
1328 if err != nil {
1329 return err
1330 }
1331 sfu.Location = &location
1332 }
1333 case "sku":
1334 if v != nil {
1335 var sku Sku
1336 err = json.Unmarshal(*v, &sku)
1337 if err != nil {
1338 return err
1339 }
1340 sfu.Sku = &sku
1341 }
1342 case "properties":
1343 if v != nil {
1344 var serverPropertiesForUpdate ServerPropertiesForUpdate
1345 err = json.Unmarshal(*v, &serverPropertiesForUpdate)
1346 if err != nil {
1347 return err
1348 }
1349 sfu.ServerPropertiesForUpdate = &serverPropertiesForUpdate
1350 }
1351 case "tags":
1352 if v != nil {
1353 var tags map[string]*string
1354 err = json.Unmarshal(*v, &tags)
1355 if err != nil {
1356 return err
1357 }
1358 sfu.Tags = tags
1359 }
1360 }
1361 }
1362
1363 return nil
1364 }
1365
1366
1367 type ServerListResult struct {
1368 autorest.Response `json:"-"`
1369
1370 Value *[]Server `json:"value,omitempty"`
1371
1372 NextLink *string `json:"nextLink,omitempty"`
1373 }
1374
1375
1376 type ServerListResultIterator struct {
1377 i int
1378 page ServerListResultPage
1379 }
1380
1381
1382
1383 func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) {
1384 if tracing.IsEnabled() {
1385 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext")
1386 defer func() {
1387 sc := -1
1388 if iter.Response().Response.Response != nil {
1389 sc = iter.Response().Response.Response.StatusCode
1390 }
1391 tracing.EndSpan(ctx, sc, err)
1392 }()
1393 }
1394 iter.i++
1395 if iter.i < len(iter.page.Values()) {
1396 return nil
1397 }
1398 err = iter.page.NextWithContext(ctx)
1399 if err != nil {
1400 iter.i--
1401 return err
1402 }
1403 iter.i = 0
1404 return nil
1405 }
1406
1407
1408
1409
1410 func (iter *ServerListResultIterator) Next() error {
1411 return iter.NextWithContext(context.Background())
1412 }
1413
1414
1415 func (iter ServerListResultIterator) NotDone() bool {
1416 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1417 }
1418
1419
1420 func (iter ServerListResultIterator) Response() ServerListResult {
1421 return iter.page.Response()
1422 }
1423
1424
1425
1426 func (iter ServerListResultIterator) Value() Server {
1427 if !iter.page.NotDone() {
1428 return Server{}
1429 }
1430 return iter.page.Values()[iter.i]
1431 }
1432
1433
1434 func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator {
1435 return ServerListResultIterator{page: page}
1436 }
1437
1438
1439 func (slr ServerListResult) IsEmpty() bool {
1440 return slr.Value == nil || len(*slr.Value) == 0
1441 }
1442
1443
1444 func (slr ServerListResult) hasNextLink() bool {
1445 return slr.NextLink != nil && len(*slr.NextLink) != 0
1446 }
1447
1448
1449
1450 func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) {
1451 if !slr.hasNextLink() {
1452 return nil, nil
1453 }
1454 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1455 autorest.AsJSON(),
1456 autorest.AsGet(),
1457 autorest.WithBaseURL(to.String(slr.NextLink)))
1458 }
1459
1460
1461 type ServerListResultPage struct {
1462 fn func(context.Context, ServerListResult) (ServerListResult, error)
1463 slr ServerListResult
1464 }
1465
1466
1467
1468 func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) {
1469 if tracing.IsEnabled() {
1470 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext")
1471 defer func() {
1472 sc := -1
1473 if page.Response().Response.Response != nil {
1474 sc = page.Response().Response.Response.StatusCode
1475 }
1476 tracing.EndSpan(ctx, sc, err)
1477 }()
1478 }
1479 for {
1480 next, err := page.fn(ctx, page.slr)
1481 if err != nil {
1482 return err
1483 }
1484 page.slr = next
1485 if !next.hasNextLink() || !next.IsEmpty() {
1486 break
1487 }
1488 }
1489 return nil
1490 }
1491
1492
1493
1494
1495 func (page *ServerListResultPage) Next() error {
1496 return page.NextWithContext(context.Background())
1497 }
1498
1499
1500 func (page ServerListResultPage) NotDone() bool {
1501 return !page.slr.IsEmpty()
1502 }
1503
1504
1505 func (page ServerListResultPage) Response() ServerListResult {
1506 return page.slr
1507 }
1508
1509
1510 func (page ServerListResultPage) Values() []Server {
1511 if page.slr.IsEmpty() {
1512 return nil
1513 }
1514 return *page.slr.Value
1515 }
1516
1517
1518 func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage {
1519 return ServerListResultPage{
1520 fn: getNextPage,
1521 slr: cur,
1522 }
1523 }
1524
1525
1526 type ServerProperties struct {
1527
1528 AdministratorLogin *string `json:"administratorLogin,omitempty"`
1529
1530 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
1531
1532 Version ServerVersion `json:"version,omitempty"`
1533
1534 State ServerState `json:"state,omitempty"`
1535
1536 HaState ServerHAState `json:"haState,omitempty"`
1537
1538 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
1539
1540 DisplayName *string `json:"displayName,omitempty"`
1541
1542 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
1543
1544 PublicNetworkAccess ServerPublicNetworkAccessState `json:"publicNetworkAccess,omitempty"`
1545
1546 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
1547
1548 HaEnabled HAEnabledEnum `json:"haEnabled,omitempty"`
1549
1550 SourceServerName *string `json:"sourceServerName,omitempty"`
1551
1552 SourceSubscriptionID *string `json:"sourceSubscriptionId,omitempty"`
1553
1554 SourceResourceGroupName *string `json:"sourceResourceGroupName,omitempty"`
1555
1556 PointInTimeUTC *date.Time `json:"pointInTimeUTC,omitempty"`
1557
1558 AvailabilityZone *string `json:"availabilityZone,omitempty"`
1559
1560 StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"`
1561
1562 ByokEnforcement *string `json:"byokEnforcement,omitempty"`
1563 DelegatedSubnetArguments *ServerPropertiesDelegatedSubnetArguments `json:"delegatedSubnetArguments,omitempty"`
1564 PrivateDNSZoneArguments *ServerPropertiesPrivateDNSZoneArguments `json:"privateDnsZoneArguments,omitempty"`
1565
1566 CreateMode CreateMode `json:"createMode,omitempty"`
1567
1568 Tags map[string]*string `json:"tags"`
1569 }
1570
1571
1572 func (sp ServerProperties) MarshalJSON() ([]byte, error) {
1573 objectMap := make(map[string]interface{})
1574 if sp.AdministratorLogin != nil {
1575 objectMap["administratorLogin"] = sp.AdministratorLogin
1576 }
1577 if sp.AdministratorLoginPassword != nil {
1578 objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword
1579 }
1580 if sp.Version != "" {
1581 objectMap["version"] = sp.Version
1582 }
1583 if sp.DisplayName != nil {
1584 objectMap["displayName"] = sp.DisplayName
1585 }
1586 if sp.StorageProfile != nil {
1587 objectMap["storageProfile"] = sp.StorageProfile
1588 }
1589 if sp.MaintenanceWindow != nil {
1590 objectMap["maintenanceWindow"] = sp.MaintenanceWindow
1591 }
1592 if sp.HaEnabled != "" {
1593 objectMap["haEnabled"] = sp.HaEnabled
1594 }
1595 if sp.SourceServerName != nil {
1596 objectMap["sourceServerName"] = sp.SourceServerName
1597 }
1598 if sp.SourceSubscriptionID != nil {
1599 objectMap["sourceSubscriptionId"] = sp.SourceSubscriptionID
1600 }
1601 if sp.SourceResourceGroupName != nil {
1602 objectMap["sourceResourceGroupName"] = sp.SourceResourceGroupName
1603 }
1604 if sp.PointInTimeUTC != nil {
1605 objectMap["pointInTimeUTC"] = sp.PointInTimeUTC
1606 }
1607 if sp.AvailabilityZone != nil {
1608 objectMap["availabilityZone"] = sp.AvailabilityZone
1609 }
1610 if sp.DelegatedSubnetArguments != nil {
1611 objectMap["delegatedSubnetArguments"] = sp.DelegatedSubnetArguments
1612 }
1613 if sp.PrivateDNSZoneArguments != nil {
1614 objectMap["privateDnsZoneArguments"] = sp.PrivateDNSZoneArguments
1615 }
1616 if sp.CreateMode != "" {
1617 objectMap["createMode"] = sp.CreateMode
1618 }
1619 if sp.Tags != nil {
1620 objectMap["tags"] = sp.Tags
1621 }
1622 return json.Marshal(objectMap)
1623 }
1624
1625
1626 type ServerPropertiesDelegatedSubnetArguments struct {
1627
1628 SubnetArmResourceID *string `json:"subnetArmResourceId,omitempty"`
1629 }
1630
1631
1632 type ServerPropertiesForUpdate struct {
1633
1634 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
1635
1636 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
1637
1638 HaEnabled HAEnabledEnum `json:"haEnabled,omitempty"`
1639
1640 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
1641 }
1642
1643
1644 type ServerPropertiesPrivateDNSZoneArguments struct {
1645
1646 PrivateDNSZoneArmResourceID *string `json:"privateDnsZoneArmResourceId,omitempty"`
1647 }
1648
1649
1650
1651 type ServersCreateFuture struct {
1652 azure.FutureAPI
1653
1654
1655 Result func(ServersClient) (Server, error)
1656 }
1657
1658
1659 func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
1660 var azFuture azure.Future
1661 if err := json.Unmarshal(body, &azFuture); err != nil {
1662 return err
1663 }
1664 future.FutureAPI = &azFuture
1665 future.Result = future.result
1666 return nil
1667 }
1668
1669
1670 func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
1671 var done bool
1672 done, err = future.DoneWithContext(context.Background(), client)
1673 if err != nil {
1674 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersCreateFuture", "Result", future.Response(), "Polling failure")
1675 return
1676 }
1677 if !done {
1678 s.Response.Response = future.Response()
1679 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersCreateFuture")
1680 return
1681 }
1682 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1683 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
1684 s, err = client.CreateResponder(s.Response.Response)
1685 if err != nil {
1686 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
1687 }
1688 }
1689 return
1690 }
1691
1692
1693
1694 type ServersDeleteFuture struct {
1695 azure.FutureAPI
1696
1697
1698 Result func(ServersClient) (autorest.Response, error)
1699 }
1700
1701
1702 func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
1703 var azFuture azure.Future
1704 if err := json.Unmarshal(body, &azFuture); err != nil {
1705 return err
1706 }
1707 future.FutureAPI = &azFuture
1708 future.Result = future.result
1709 return nil
1710 }
1711
1712
1713 func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
1714 var done bool
1715 done, err = future.DoneWithContext(context.Background(), client)
1716 if err != nil {
1717 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
1718 return
1719 }
1720 if !done {
1721 ar.Response = future.Response()
1722 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersDeleteFuture")
1723 return
1724 }
1725 ar.Response = future.Response()
1726 return
1727 }
1728
1729
1730
1731 type ServersRestartFuture struct {
1732 azure.FutureAPI
1733
1734
1735 Result func(ServersClient) (autorest.Response, error)
1736 }
1737
1738
1739 func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error {
1740 var azFuture azure.Future
1741 if err := json.Unmarshal(body, &azFuture); err != nil {
1742 return err
1743 }
1744 future.FutureAPI = &azFuture
1745 future.Result = future.result
1746 return nil
1747 }
1748
1749
1750 func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {
1751 var done bool
1752 done, err = future.DoneWithContext(context.Background(), client)
1753 if err != nil {
1754 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersRestartFuture", "Result", future.Response(), "Polling failure")
1755 return
1756 }
1757 if !done {
1758 ar.Response = future.Response()
1759 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersRestartFuture")
1760 return
1761 }
1762 ar.Response = future.Response()
1763 return
1764 }
1765
1766
1767 type ServersStartFuture struct {
1768 azure.FutureAPI
1769
1770
1771 Result func(ServersClient) (autorest.Response, error)
1772 }
1773
1774
1775 func (future *ServersStartFuture) UnmarshalJSON(body []byte) error {
1776 var azFuture azure.Future
1777 if err := json.Unmarshal(body, &azFuture); err != nil {
1778 return err
1779 }
1780 future.FutureAPI = &azFuture
1781 future.Result = future.result
1782 return nil
1783 }
1784
1785
1786 func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) {
1787 var done bool
1788 done, err = future.DoneWithContext(context.Background(), client)
1789 if err != nil {
1790 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersStartFuture", "Result", future.Response(), "Polling failure")
1791 return
1792 }
1793 if !done {
1794 ar.Response = future.Response()
1795 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersStartFuture")
1796 return
1797 }
1798 ar.Response = future.Response()
1799 return
1800 }
1801
1802
1803 type ServersStopFuture struct {
1804 azure.FutureAPI
1805
1806
1807 Result func(ServersClient) (autorest.Response, error)
1808 }
1809
1810
1811 func (future *ServersStopFuture) UnmarshalJSON(body []byte) error {
1812 var azFuture azure.Future
1813 if err := json.Unmarshal(body, &azFuture); err != nil {
1814 return err
1815 }
1816 future.FutureAPI = &azFuture
1817 future.Result = future.result
1818 return nil
1819 }
1820
1821
1822 func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) {
1823 var done bool
1824 done, err = future.DoneWithContext(context.Background(), client)
1825 if err != nil {
1826 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersStopFuture", "Result", future.Response(), "Polling failure")
1827 return
1828 }
1829 if !done {
1830 ar.Response = future.Response()
1831 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersStopFuture")
1832 return
1833 }
1834 ar.Response = future.Response()
1835 return
1836 }
1837
1838
1839
1840 type ServersUpdateFuture struct {
1841 azure.FutureAPI
1842
1843
1844 Result func(ServersClient) (Server, error)
1845 }
1846
1847
1848 func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
1849 var azFuture azure.Future
1850 if err := json.Unmarshal(body, &azFuture); err != nil {
1851 return err
1852 }
1853 future.FutureAPI = &azFuture
1854 future.Result = future.result
1855 return nil
1856 }
1857
1858
1859 func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
1860 var done bool
1861 done, err = future.DoneWithContext(context.Background(), client)
1862 if err != nil {
1863 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
1864 return
1865 }
1866 if !done {
1867 s.Response.Response = future.Response()
1868 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersUpdateFuture")
1869 return
1870 }
1871 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1872 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
1873 s, err = client.UpdateResponder(s.Response.Response)
1874 if err != nil {
1875 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
1876 }
1877 }
1878 return
1879 }
1880
1881
1882 type ServerVersionCapability struct {
1883
1884 Name *string `json:"name,omitempty"`
1885
1886 SupportedVcores *[]VcoreCapability `json:"supportedVcores,omitempty"`
1887 }
1888
1889
1890 func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) {
1891 objectMap := make(map[string]interface{})
1892 return json.Marshal(objectMap)
1893 }
1894
1895
1896 type Sku struct {
1897
1898 Name *string `json:"name,omitempty"`
1899
1900 Tier SkuTier `json:"tier,omitempty"`
1901 }
1902
1903
1904 type StorageEditionCapability struct {
1905
1906 Name *string `json:"name,omitempty"`
1907
1908 SupportedStorageMB *[]StorageMBCapability `json:"supportedStorageMB,omitempty"`
1909 }
1910
1911
1912 func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) {
1913 objectMap := make(map[string]interface{})
1914 return json.Marshal(objectMap)
1915 }
1916
1917
1918 type StorageMBCapability struct {
1919
1920 Name *string `json:"name,omitempty"`
1921
1922 SupportedIops *int64 `json:"supportedIops,omitempty"`
1923
1924 StorageSizeMB *int64 `json:"storageSizeMB,omitempty"`
1925 }
1926
1927
1928 func (smc StorageMBCapability) MarshalJSON() ([]byte, error) {
1929 objectMap := make(map[string]interface{})
1930 return json.Marshal(objectMap)
1931 }
1932
1933
1934 type StorageProfile struct {
1935
1936 BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
1937
1938 StorageMB *int32 `json:"storageMB,omitempty"`
1939 }
1940
1941
1942
1943 type TrackedResource struct {
1944
1945 Tags map[string]*string `json:"tags"`
1946
1947 Location *string `json:"location,omitempty"`
1948
1949 ID *string `json:"id,omitempty"`
1950
1951 Name *string `json:"name,omitempty"`
1952
1953 Type *string `json:"type,omitempty"`
1954 }
1955
1956
1957 func (tr TrackedResource) MarshalJSON() ([]byte, error) {
1958 objectMap := make(map[string]interface{})
1959 if tr.Tags != nil {
1960 objectMap["tags"] = tr.Tags
1961 }
1962 if tr.Location != nil {
1963 objectMap["location"] = tr.Location
1964 }
1965 return json.Marshal(objectMap)
1966 }
1967
1968
1969 type VcoreCapability struct {
1970
1971 Name *string `json:"name,omitempty"`
1972
1973 VCores *int64 `json:"vCores,omitempty"`
1974
1975 SupportedIops *int64 `json:"supportedIops,omitempty"`
1976
1977 SupportedMemoryPerVcoreMB *int64 `json:"supportedMemoryPerVcoreMB,omitempty"`
1978 }
1979
1980
1981 func (vc VcoreCapability) MarshalJSON() ([]byte, error) {
1982 objectMap := make(map[string]interface{})
1983 return json.Marshal(objectMap)
1984 }
1985
1986
1987 type VirtualNetworkSubnetUsageParameter struct {
1988
1989 VirtualNetworkArmResourceID *string `json:"virtualNetworkArmResourceId,omitempty"`
1990 }
1991
1992
1993 type VirtualNetworkSubnetUsageResult struct {
1994 autorest.Response `json:"-"`
1995
1996 DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"`
1997 }
1998
1999
2000 func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) {
2001 objectMap := make(map[string]interface{})
2002 return json.Marshal(objectMap)
2003 }
2004
View as plain text