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-11-05-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 Database struct {
530 autorest.Response `json:"-"`
531
532 *DatabaseProperties `json:"properties,omitempty"`
533
534 ID *string `json:"id,omitempty"`
535
536 Name *string `json:"name,omitempty"`
537
538 Type *string `json:"type,omitempty"`
539 }
540
541
542 func (d Database) MarshalJSON() ([]byte, error) {
543 objectMap := make(map[string]interface{})
544 if d.DatabaseProperties != nil {
545 objectMap["properties"] = d.DatabaseProperties
546 }
547 return json.Marshal(objectMap)
548 }
549
550
551 func (d *Database) UnmarshalJSON(body []byte) error {
552 var m map[string]*json.RawMessage
553 err := json.Unmarshal(body, &m)
554 if err != nil {
555 return err
556 }
557 for k, v := range m {
558 switch k {
559 case "properties":
560 if v != nil {
561 var databaseProperties DatabaseProperties
562 err = json.Unmarshal(*v, &databaseProperties)
563 if err != nil {
564 return err
565 }
566 d.DatabaseProperties = &databaseProperties
567 }
568 case "id":
569 if v != nil {
570 var ID string
571 err = json.Unmarshal(*v, &ID)
572 if err != nil {
573 return err
574 }
575 d.ID = &ID
576 }
577 case "name":
578 if v != nil {
579 var name string
580 err = json.Unmarshal(*v, &name)
581 if err != nil {
582 return err
583 }
584 d.Name = &name
585 }
586 case "type":
587 if v != nil {
588 var typeVar string
589 err = json.Unmarshal(*v, &typeVar)
590 if err != nil {
591 return err
592 }
593 d.Type = &typeVar
594 }
595 }
596 }
597
598 return nil
599 }
600
601
602 type DatabaseListResult struct {
603 autorest.Response `json:"-"`
604
605 Value *[]Database `json:"value,omitempty"`
606
607 NextLink *string `json:"nextLink,omitempty"`
608 }
609
610
611 type DatabaseListResultIterator struct {
612 i int
613 page DatabaseListResultPage
614 }
615
616
617
618 func (iter *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) {
619 if tracing.IsEnabled() {
620 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.NextWithContext")
621 defer func() {
622 sc := -1
623 if iter.Response().Response.Response != nil {
624 sc = iter.Response().Response.Response.StatusCode
625 }
626 tracing.EndSpan(ctx, sc, err)
627 }()
628 }
629 iter.i++
630 if iter.i < len(iter.page.Values()) {
631 return nil
632 }
633 err = iter.page.NextWithContext(ctx)
634 if err != nil {
635 iter.i--
636 return err
637 }
638 iter.i = 0
639 return nil
640 }
641
642
643
644
645 func (iter *DatabaseListResultIterator) Next() error {
646 return iter.NextWithContext(context.Background())
647 }
648
649
650 func (iter DatabaseListResultIterator) NotDone() bool {
651 return iter.page.NotDone() && iter.i < len(iter.page.Values())
652 }
653
654
655 func (iter DatabaseListResultIterator) Response() DatabaseListResult {
656 return iter.page.Response()
657 }
658
659
660
661 func (iter DatabaseListResultIterator) Value() Database {
662 if !iter.page.NotDone() {
663 return Database{}
664 }
665 return iter.page.Values()[iter.i]
666 }
667
668
669 func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator {
670 return DatabaseListResultIterator{page: page}
671 }
672
673
674 func (dlr DatabaseListResult) IsEmpty() bool {
675 return dlr.Value == nil || len(*dlr.Value) == 0
676 }
677
678
679 func (dlr DatabaseListResult) hasNextLink() bool {
680 return dlr.NextLink != nil && len(*dlr.NextLink) != 0
681 }
682
683
684
685 func (dlr DatabaseListResult) databaseListResultPreparer(ctx context.Context) (*http.Request, error) {
686 if !dlr.hasNextLink() {
687 return nil, nil
688 }
689 return autorest.Prepare((&http.Request{}).WithContext(ctx),
690 autorest.AsJSON(),
691 autorest.AsGet(),
692 autorest.WithBaseURL(to.String(dlr.NextLink)))
693 }
694
695
696 type DatabaseListResultPage struct {
697 fn func(context.Context, DatabaseListResult) (DatabaseListResult, error)
698 dlr DatabaseListResult
699 }
700
701
702
703 func (page *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) {
704 if tracing.IsEnabled() {
705 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.NextWithContext")
706 defer func() {
707 sc := -1
708 if page.Response().Response.Response != nil {
709 sc = page.Response().Response.Response.StatusCode
710 }
711 tracing.EndSpan(ctx, sc, err)
712 }()
713 }
714 for {
715 next, err := page.fn(ctx, page.dlr)
716 if err != nil {
717 return err
718 }
719 page.dlr = next
720 if !next.hasNextLink() || !next.IsEmpty() {
721 break
722 }
723 }
724 return nil
725 }
726
727
728
729
730 func (page *DatabaseListResultPage) Next() error {
731 return page.NextWithContext(context.Background())
732 }
733
734
735 func (page DatabaseListResultPage) NotDone() bool {
736 return !page.dlr.IsEmpty()
737 }
738
739
740 func (page DatabaseListResultPage) Response() DatabaseListResult {
741 return page.dlr
742 }
743
744
745 func (page DatabaseListResultPage) Values() []Database {
746 if page.dlr.IsEmpty() {
747 return nil
748 }
749 return *page.dlr.Value
750 }
751
752
753 func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage {
754 return DatabaseListResultPage{
755 fn: getNextPage,
756 dlr: cur,
757 }
758 }
759
760
761 type DatabaseProperties struct {
762
763 Charset *string `json:"charset,omitempty"`
764
765 Collation *string `json:"collation,omitempty"`
766 }
767
768
769
770 type DatabasesCreateFuture struct {
771 azure.FutureAPI
772
773
774 Result func(DatabasesClient) (Database, error)
775 }
776
777
778 func (future *DatabasesCreateFuture) UnmarshalJSON(body []byte) error {
779 var azFuture azure.Future
780 if err := json.Unmarshal(body, &azFuture); err != nil {
781 return err
782 }
783 future.FutureAPI = &azFuture
784 future.Result = future.result
785 return nil
786 }
787
788
789 func (future *DatabasesCreateFuture) result(client DatabasesClient) (d Database, err error) {
790 var done bool
791 done, err = future.DoneWithContext(context.Background(), client)
792 if err != nil {
793 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesCreateFuture", "Result", future.Response(), "Polling failure")
794 return
795 }
796 if !done {
797 d.Response.Response = future.Response()
798 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.DatabasesCreateFuture")
799 return
800 }
801 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
802 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
803 d, err = client.CreateResponder(d.Response.Response)
804 if err != nil {
805 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesCreateFuture", "Result", d.Response.Response, "Failure responding to request")
806 }
807 }
808 return
809 }
810
811
812
813 type DatabasesDeleteFuture struct {
814 azure.FutureAPI
815
816
817 Result func(DatabasesClient) (autorest.Response, error)
818 }
819
820
821 func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error {
822 var azFuture azure.Future
823 if err := json.Unmarshal(body, &azFuture); err != nil {
824 return err
825 }
826 future.FutureAPI = &azFuture
827 future.Result = future.result
828 return nil
829 }
830
831
832 func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) {
833 var done bool
834 done, err = future.DoneWithContext(context.Background(), client)
835 if err != nil {
836 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
837 return
838 }
839 if !done {
840 ar.Response = future.Response()
841 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.DatabasesDeleteFuture")
842 return
843 }
844 ar.Response = future.Response()
845 return
846 }
847
848
849 type DelegatedSubnetUsage struct {
850
851 SubnetName *string `json:"subnetName,omitempty"`
852
853 Usage *int64 `json:"usage,omitempty"`
854 }
855
856
857 func (dsu DelegatedSubnetUsage) MarshalJSON() ([]byte, error) {
858 objectMap := make(map[string]interface{})
859 return json.Marshal(objectMap)
860 }
861
862
863 type ErrorAdditionalInfo struct {
864
865 Type *string `json:"type,omitempty"`
866
867 Info interface{} `json:"info,omitempty"`
868 }
869
870
871 func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
872 objectMap := make(map[string]interface{})
873 return json.Marshal(objectMap)
874 }
875
876
877
878 type ErrorResponse struct {
879
880 Code *string `json:"code,omitempty"`
881
882 Message *string `json:"message,omitempty"`
883
884 Target *string `json:"target,omitempty"`
885
886 Details *[]ErrorResponse `json:"details,omitempty"`
887
888 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
889 }
890
891
892 func (er ErrorResponse) MarshalJSON() ([]byte, error) {
893 objectMap := make(map[string]interface{})
894 return json.Marshal(objectMap)
895 }
896
897
898 type FirewallRule struct {
899 autorest.Response `json:"-"`
900
901 *FirewallRuleProperties `json:"properties,omitempty"`
902
903 ID *string `json:"id,omitempty"`
904
905 Name *string `json:"name,omitempty"`
906
907 Type *string `json:"type,omitempty"`
908 }
909
910
911 func (fr FirewallRule) MarshalJSON() ([]byte, error) {
912 objectMap := make(map[string]interface{})
913 if fr.FirewallRuleProperties != nil {
914 objectMap["properties"] = fr.FirewallRuleProperties
915 }
916 return json.Marshal(objectMap)
917 }
918
919
920 func (fr *FirewallRule) UnmarshalJSON(body []byte) error {
921 var m map[string]*json.RawMessage
922 err := json.Unmarshal(body, &m)
923 if err != nil {
924 return err
925 }
926 for k, v := range m {
927 switch k {
928 case "properties":
929 if v != nil {
930 var firewallRuleProperties FirewallRuleProperties
931 err = json.Unmarshal(*v, &firewallRuleProperties)
932 if err != nil {
933 return err
934 }
935 fr.FirewallRuleProperties = &firewallRuleProperties
936 }
937 case "id":
938 if v != nil {
939 var ID string
940 err = json.Unmarshal(*v, &ID)
941 if err != nil {
942 return err
943 }
944 fr.ID = &ID
945 }
946 case "name":
947 if v != nil {
948 var name string
949 err = json.Unmarshal(*v, &name)
950 if err != nil {
951 return err
952 }
953 fr.Name = &name
954 }
955 case "type":
956 if v != nil {
957 var typeVar string
958 err = json.Unmarshal(*v, &typeVar)
959 if err != nil {
960 return err
961 }
962 fr.Type = &typeVar
963 }
964 }
965 }
966
967 return nil
968 }
969
970
971 type FirewallRuleListResult struct {
972 autorest.Response `json:"-"`
973
974 Value *[]FirewallRule `json:"value,omitempty"`
975
976 NextLink *string `json:"nextLink,omitempty"`
977 }
978
979
980 type FirewallRuleListResultIterator struct {
981 i int
982 page FirewallRuleListResultPage
983 }
984
985
986
987 func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
988 if tracing.IsEnabled() {
989 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext")
990 defer func() {
991 sc := -1
992 if iter.Response().Response.Response != nil {
993 sc = iter.Response().Response.Response.StatusCode
994 }
995 tracing.EndSpan(ctx, sc, err)
996 }()
997 }
998 iter.i++
999 if iter.i < len(iter.page.Values()) {
1000 return nil
1001 }
1002 err = iter.page.NextWithContext(ctx)
1003 if err != nil {
1004 iter.i--
1005 return err
1006 }
1007 iter.i = 0
1008 return nil
1009 }
1010
1011
1012
1013
1014 func (iter *FirewallRuleListResultIterator) Next() error {
1015 return iter.NextWithContext(context.Background())
1016 }
1017
1018
1019 func (iter FirewallRuleListResultIterator) NotDone() bool {
1020 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1021 }
1022
1023
1024 func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult {
1025 return iter.page.Response()
1026 }
1027
1028
1029
1030 func (iter FirewallRuleListResultIterator) Value() FirewallRule {
1031 if !iter.page.NotDone() {
1032 return FirewallRule{}
1033 }
1034 return iter.page.Values()[iter.i]
1035 }
1036
1037
1038 func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator {
1039 return FirewallRuleListResultIterator{page: page}
1040 }
1041
1042
1043 func (frlr FirewallRuleListResult) IsEmpty() bool {
1044 return frlr.Value == nil || len(*frlr.Value) == 0
1045 }
1046
1047
1048 func (frlr FirewallRuleListResult) hasNextLink() bool {
1049 return frlr.NextLink != nil && len(*frlr.NextLink) != 0
1050 }
1051
1052
1053
1054 func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
1055 if !frlr.hasNextLink() {
1056 return nil, nil
1057 }
1058 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1059 autorest.AsJSON(),
1060 autorest.AsGet(),
1061 autorest.WithBaseURL(to.String(frlr.NextLink)))
1062 }
1063
1064
1065 type FirewallRuleListResultPage struct {
1066 fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)
1067 frlr FirewallRuleListResult
1068 }
1069
1070
1071
1072 func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
1073 if tracing.IsEnabled() {
1074 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext")
1075 defer func() {
1076 sc := -1
1077 if page.Response().Response.Response != nil {
1078 sc = page.Response().Response.Response.StatusCode
1079 }
1080 tracing.EndSpan(ctx, sc, err)
1081 }()
1082 }
1083 for {
1084 next, err := page.fn(ctx, page.frlr)
1085 if err != nil {
1086 return err
1087 }
1088 page.frlr = next
1089 if !next.hasNextLink() || !next.IsEmpty() {
1090 break
1091 }
1092 }
1093 return nil
1094 }
1095
1096
1097
1098
1099 func (page *FirewallRuleListResultPage) Next() error {
1100 return page.NextWithContext(context.Background())
1101 }
1102
1103
1104 func (page FirewallRuleListResultPage) NotDone() bool {
1105 return !page.frlr.IsEmpty()
1106 }
1107
1108
1109 func (page FirewallRuleListResultPage) Response() FirewallRuleListResult {
1110 return page.frlr
1111 }
1112
1113
1114 func (page FirewallRuleListResultPage) Values() []FirewallRule {
1115 if page.frlr.IsEmpty() {
1116 return nil
1117 }
1118 return *page.frlr.Value
1119 }
1120
1121
1122 func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {
1123 return FirewallRuleListResultPage{
1124 fn: getNextPage,
1125 frlr: cur,
1126 }
1127 }
1128
1129
1130 type FirewallRuleProperties struct {
1131
1132 StartIPAddress *string `json:"startIpAddress,omitempty"`
1133
1134 EndIPAddress *string `json:"endIpAddress,omitempty"`
1135 }
1136
1137
1138
1139 type FirewallRulesCreateOrUpdateFuture struct {
1140 azure.FutureAPI
1141
1142
1143 Result func(FirewallRulesClient) (FirewallRule, error)
1144 }
1145
1146
1147 func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1148 var azFuture azure.Future
1149 if err := json.Unmarshal(body, &azFuture); err != nil {
1150 return err
1151 }
1152 future.FutureAPI = &azFuture
1153 future.Result = future.result
1154 return nil
1155 }
1156
1157
1158 func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) {
1159 var done bool
1160 done, err = future.DoneWithContext(context.Background(), client)
1161 if err != nil {
1162 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1163 return
1164 }
1165 if !done {
1166 fr.Response.Response = future.Response()
1167 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture")
1168 return
1169 }
1170 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1171 if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent {
1172 fr, err = client.CreateOrUpdateResponder(fr.Response.Response)
1173 if err != nil {
1174 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request")
1175 }
1176 }
1177 return
1178 }
1179
1180
1181
1182 type FirewallRulesDeleteFuture struct {
1183 azure.FutureAPI
1184
1185
1186 Result func(FirewallRulesClient) (autorest.Response, error)
1187 }
1188
1189
1190 func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error {
1191 var azFuture azure.Future
1192 if err := json.Unmarshal(body, &azFuture); err != nil {
1193 return err
1194 }
1195 future.FutureAPI = &azFuture
1196 future.Result = future.result
1197 return nil
1198 }
1199
1200
1201 func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) {
1202 var done bool
1203 done, err = future.DoneWithContext(context.Background(), client)
1204 if err != nil {
1205 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure")
1206 return
1207 }
1208 if !done {
1209 ar.Response = future.Response()
1210 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.FirewallRulesDeleteFuture")
1211 return
1212 }
1213 ar.Response = future.Response()
1214 return
1215 }
1216
1217
1218 type Identity struct {
1219
1220 PrincipalID *string `json:"principalId,omitempty"`
1221
1222 TenantID *string `json:"tenantId,omitempty"`
1223
1224 Type ResourceIdentityType `json:"type,omitempty"`
1225 }
1226
1227
1228 func (i Identity) MarshalJSON() ([]byte, error) {
1229 objectMap := make(map[string]interface{})
1230 if i.Type != "" {
1231 objectMap["type"] = i.Type
1232 }
1233 return json.Marshal(objectMap)
1234 }
1235
1236
1237 type MaintenanceWindow struct {
1238
1239 CustomWindow *string `json:"customWindow,omitempty"`
1240
1241 StartHour *int32 `json:"startHour,omitempty"`
1242
1243 StartMinute *int32 `json:"startMinute,omitempty"`
1244
1245 DayOfWeek *int32 `json:"dayOfWeek,omitempty"`
1246 }
1247
1248
1249 type NameAvailability struct {
1250 autorest.Response `json:"-"`
1251
1252 Message *string `json:"message,omitempty"`
1253
1254 NameAvailable *bool `json:"nameAvailable,omitempty"`
1255
1256 Name *string `json:"name,omitempty"`
1257
1258 Type *string `json:"type,omitempty"`
1259 }
1260
1261
1262 type NameAvailabilityRequest struct {
1263
1264 Name *string `json:"name,omitempty"`
1265
1266 Type *string `json:"type,omitempty"`
1267 }
1268
1269
1270 type Operation struct {
1271
1272 Name *string `json:"name,omitempty"`
1273
1274 Display *OperationDisplay `json:"display,omitempty"`
1275
1276 IsDataAction *bool `json:"isDataAction,omitempty"`
1277
1278 Origin OperationOrigin `json:"origin,omitempty"`
1279
1280 Properties map[string]interface{} `json:"properties"`
1281 }
1282
1283
1284 func (o Operation) MarshalJSON() ([]byte, error) {
1285 objectMap := make(map[string]interface{})
1286 if o.IsDataAction != nil {
1287 objectMap["isDataAction"] = o.IsDataAction
1288 }
1289 return json.Marshal(objectMap)
1290 }
1291
1292
1293 type OperationDisplay struct {
1294
1295 Provider *string `json:"provider,omitempty"`
1296
1297 Resource *string `json:"resource,omitempty"`
1298
1299 Operation *string `json:"operation,omitempty"`
1300
1301 Description *string `json:"description,omitempty"`
1302 }
1303
1304
1305 func (od OperationDisplay) MarshalJSON() ([]byte, error) {
1306 objectMap := make(map[string]interface{})
1307 return json.Marshal(objectMap)
1308 }
1309
1310
1311 type OperationListResult struct {
1312 autorest.Response `json:"-"`
1313
1314 Value *[]Operation `json:"value,omitempty"`
1315
1316
1317 NextLink *string `json:"nextLink,omitempty"`
1318 }
1319
1320
1321 type Plan struct {
1322
1323 Name *string `json:"name,omitempty"`
1324
1325 Publisher *string `json:"publisher,omitempty"`
1326
1327 Product *string `json:"product,omitempty"`
1328
1329 PromotionCode *string `json:"promotionCode,omitempty"`
1330
1331 Version *string `json:"version,omitempty"`
1332 }
1333
1334
1335
1336 type ProxyResource struct {
1337
1338 ID *string `json:"id,omitempty"`
1339
1340 Name *string `json:"name,omitempty"`
1341
1342 Type *string `json:"type,omitempty"`
1343 }
1344
1345
1346 func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1347 objectMap := make(map[string]interface{})
1348 return json.Marshal(objectMap)
1349 }
1350
1351
1352 type Resource struct {
1353
1354 ID *string `json:"id,omitempty"`
1355
1356 Name *string `json:"name,omitempty"`
1357
1358 Type *string `json:"type,omitempty"`
1359 }
1360
1361
1362 func (r Resource) MarshalJSON() ([]byte, error) {
1363 objectMap := make(map[string]interface{})
1364 return json.Marshal(objectMap)
1365 }
1366
1367
1368
1369
1370 type ResourceModelWithAllowedPropertySet struct {
1371
1372 ID *string `json:"id,omitempty"`
1373
1374 Name *string `json:"name,omitempty"`
1375
1376 Type *string `json:"type,omitempty"`
1377
1378 Location *string `json:"location,omitempty"`
1379
1380 ManagedBy *string `json:"managedBy,omitempty"`
1381
1382 Kind *string `json:"kind,omitempty"`
1383
1384 Etag *string `json:"etag,omitempty"`
1385
1386 Tags map[string]*string `json:"tags"`
1387 Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"`
1388 Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"`
1389 Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"`
1390 }
1391
1392
1393 func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) {
1394 objectMap := make(map[string]interface{})
1395 if rmwaps.Location != nil {
1396 objectMap["location"] = rmwaps.Location
1397 }
1398 if rmwaps.ManagedBy != nil {
1399 objectMap["managedBy"] = rmwaps.ManagedBy
1400 }
1401 if rmwaps.Kind != nil {
1402 objectMap["kind"] = rmwaps.Kind
1403 }
1404 if rmwaps.Tags != nil {
1405 objectMap["tags"] = rmwaps.Tags
1406 }
1407 if rmwaps.Identity != nil {
1408 objectMap["identity"] = rmwaps.Identity
1409 }
1410 if rmwaps.Sku != nil {
1411 objectMap["sku"] = rmwaps.Sku
1412 }
1413 if rmwaps.Plan != nil {
1414 objectMap["plan"] = rmwaps.Plan
1415 }
1416 return json.Marshal(objectMap)
1417 }
1418
1419
1420 type ResourceModelWithAllowedPropertySetIdentity struct {
1421
1422 PrincipalID *string `json:"principalId,omitempty"`
1423
1424 TenantID *string `json:"tenantId,omitempty"`
1425
1426 Type ResourceIdentityType `json:"type,omitempty"`
1427 }
1428
1429
1430 func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) {
1431 objectMap := make(map[string]interface{})
1432 if rmwaps.Type != "" {
1433 objectMap["type"] = rmwaps.Type
1434 }
1435 return json.Marshal(objectMap)
1436 }
1437
1438
1439 type ResourceModelWithAllowedPropertySetPlan struct {
1440
1441 Name *string `json:"name,omitempty"`
1442
1443 Publisher *string `json:"publisher,omitempty"`
1444
1445 Product *string `json:"product,omitempty"`
1446
1447 PromotionCode *string `json:"promotionCode,omitempty"`
1448
1449 Version *string `json:"version,omitempty"`
1450 }
1451
1452
1453 type ResourceModelWithAllowedPropertySetSku struct {
1454
1455 Name *string `json:"name,omitempty"`
1456
1457 Tier SkuTier `json:"tier,omitempty"`
1458 }
1459
1460
1461 type Server struct {
1462 autorest.Response `json:"-"`
1463
1464 Identity *Identity `json:"identity,omitempty"`
1465
1466 Sku *Sku `json:"sku,omitempty"`
1467
1468 *ServerProperties `json:"properties,omitempty"`
1469
1470 Tags map[string]*string `json:"tags"`
1471
1472 Location *string `json:"location,omitempty"`
1473
1474 ID *string `json:"id,omitempty"`
1475
1476 Name *string `json:"name,omitempty"`
1477
1478 Type *string `json:"type,omitempty"`
1479 }
1480
1481
1482 func (s Server) MarshalJSON() ([]byte, error) {
1483 objectMap := make(map[string]interface{})
1484 if s.Identity != nil {
1485 objectMap["identity"] = s.Identity
1486 }
1487 if s.Sku != nil {
1488 objectMap["sku"] = s.Sku
1489 }
1490 if s.ServerProperties != nil {
1491 objectMap["properties"] = s.ServerProperties
1492 }
1493 if s.Tags != nil {
1494 objectMap["tags"] = s.Tags
1495 }
1496 if s.Location != nil {
1497 objectMap["location"] = s.Location
1498 }
1499 return json.Marshal(objectMap)
1500 }
1501
1502
1503 func (s *Server) UnmarshalJSON(body []byte) error {
1504 var m map[string]*json.RawMessage
1505 err := json.Unmarshal(body, &m)
1506 if err != nil {
1507 return err
1508 }
1509 for k, v := range m {
1510 switch k {
1511 case "identity":
1512 if v != nil {
1513 var identity Identity
1514 err = json.Unmarshal(*v, &identity)
1515 if err != nil {
1516 return err
1517 }
1518 s.Identity = &identity
1519 }
1520 case "sku":
1521 if v != nil {
1522 var sku Sku
1523 err = json.Unmarshal(*v, &sku)
1524 if err != nil {
1525 return err
1526 }
1527 s.Sku = &sku
1528 }
1529 case "properties":
1530 if v != nil {
1531 var serverProperties ServerProperties
1532 err = json.Unmarshal(*v, &serverProperties)
1533 if err != nil {
1534 return err
1535 }
1536 s.ServerProperties = &serverProperties
1537 }
1538 case "tags":
1539 if v != nil {
1540 var tags map[string]*string
1541 err = json.Unmarshal(*v, &tags)
1542 if err != nil {
1543 return err
1544 }
1545 s.Tags = tags
1546 }
1547 case "location":
1548 if v != nil {
1549 var location string
1550 err = json.Unmarshal(*v, &location)
1551 if err != nil {
1552 return err
1553 }
1554 s.Location = &location
1555 }
1556 case "id":
1557 if v != nil {
1558 var ID string
1559 err = json.Unmarshal(*v, &ID)
1560 if err != nil {
1561 return err
1562 }
1563 s.ID = &ID
1564 }
1565 case "name":
1566 if v != nil {
1567 var name string
1568 err = json.Unmarshal(*v, &name)
1569 if err != nil {
1570 return err
1571 }
1572 s.Name = &name
1573 }
1574 case "type":
1575 if v != nil {
1576 var typeVar string
1577 err = json.Unmarshal(*v, &typeVar)
1578 if err != nil {
1579 return err
1580 }
1581 s.Type = &typeVar
1582 }
1583 }
1584 }
1585
1586 return nil
1587 }
1588
1589
1590 type ServerEditionCapability struct {
1591
1592 Name *string `json:"name,omitempty"`
1593
1594 SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"`
1595
1596 SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"`
1597 }
1598
1599
1600 func (sec ServerEditionCapability) MarshalJSON() ([]byte, error) {
1601 objectMap := make(map[string]interface{})
1602 return json.Marshal(objectMap)
1603 }
1604
1605
1606 type ServerForUpdate struct {
1607
1608 Location *string `json:"location,omitempty"`
1609
1610 Sku *Sku `json:"sku,omitempty"`
1611
1612 *ServerPropertiesForUpdate `json:"properties,omitempty"`
1613
1614 Tags map[string]*string `json:"tags"`
1615 }
1616
1617
1618 func (sfu ServerForUpdate) MarshalJSON() ([]byte, error) {
1619 objectMap := make(map[string]interface{})
1620 if sfu.Location != nil {
1621 objectMap["location"] = sfu.Location
1622 }
1623 if sfu.Sku != nil {
1624 objectMap["sku"] = sfu.Sku
1625 }
1626 if sfu.ServerPropertiesForUpdate != nil {
1627 objectMap["properties"] = sfu.ServerPropertiesForUpdate
1628 }
1629 if sfu.Tags != nil {
1630 objectMap["tags"] = sfu.Tags
1631 }
1632 return json.Marshal(objectMap)
1633 }
1634
1635
1636 func (sfu *ServerForUpdate) UnmarshalJSON(body []byte) error {
1637 var m map[string]*json.RawMessage
1638 err := json.Unmarshal(body, &m)
1639 if err != nil {
1640 return err
1641 }
1642 for k, v := range m {
1643 switch k {
1644 case "location":
1645 if v != nil {
1646 var location string
1647 err = json.Unmarshal(*v, &location)
1648 if err != nil {
1649 return err
1650 }
1651 sfu.Location = &location
1652 }
1653 case "sku":
1654 if v != nil {
1655 var sku Sku
1656 err = json.Unmarshal(*v, &sku)
1657 if err != nil {
1658 return err
1659 }
1660 sfu.Sku = &sku
1661 }
1662 case "properties":
1663 if v != nil {
1664 var serverPropertiesForUpdate ServerPropertiesForUpdate
1665 err = json.Unmarshal(*v, &serverPropertiesForUpdate)
1666 if err != nil {
1667 return err
1668 }
1669 sfu.ServerPropertiesForUpdate = &serverPropertiesForUpdate
1670 }
1671 case "tags":
1672 if v != nil {
1673 var tags map[string]*string
1674 err = json.Unmarshal(*v, &tags)
1675 if err != nil {
1676 return err
1677 }
1678 sfu.Tags = tags
1679 }
1680 }
1681 }
1682
1683 return nil
1684 }
1685
1686
1687 type ServerListResult struct {
1688 autorest.Response `json:"-"`
1689
1690 Value *[]Server `json:"value,omitempty"`
1691
1692 NextLink *string `json:"nextLink,omitempty"`
1693 }
1694
1695
1696 type ServerListResultIterator struct {
1697 i int
1698 page ServerListResultPage
1699 }
1700
1701
1702
1703 func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) {
1704 if tracing.IsEnabled() {
1705 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext")
1706 defer func() {
1707 sc := -1
1708 if iter.Response().Response.Response != nil {
1709 sc = iter.Response().Response.Response.StatusCode
1710 }
1711 tracing.EndSpan(ctx, sc, err)
1712 }()
1713 }
1714 iter.i++
1715 if iter.i < len(iter.page.Values()) {
1716 return nil
1717 }
1718 err = iter.page.NextWithContext(ctx)
1719 if err != nil {
1720 iter.i--
1721 return err
1722 }
1723 iter.i = 0
1724 return nil
1725 }
1726
1727
1728
1729
1730 func (iter *ServerListResultIterator) Next() error {
1731 return iter.NextWithContext(context.Background())
1732 }
1733
1734
1735 func (iter ServerListResultIterator) NotDone() bool {
1736 return iter.page.NotDone() && iter.i < len(iter.page.Values())
1737 }
1738
1739
1740 func (iter ServerListResultIterator) Response() ServerListResult {
1741 return iter.page.Response()
1742 }
1743
1744
1745
1746 func (iter ServerListResultIterator) Value() Server {
1747 if !iter.page.NotDone() {
1748 return Server{}
1749 }
1750 return iter.page.Values()[iter.i]
1751 }
1752
1753
1754 func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator {
1755 return ServerListResultIterator{page: page}
1756 }
1757
1758
1759 func (slr ServerListResult) IsEmpty() bool {
1760 return slr.Value == nil || len(*slr.Value) == 0
1761 }
1762
1763
1764 func (slr ServerListResult) hasNextLink() bool {
1765 return slr.NextLink != nil && len(*slr.NextLink) != 0
1766 }
1767
1768
1769
1770 func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) {
1771 if !slr.hasNextLink() {
1772 return nil, nil
1773 }
1774 return autorest.Prepare((&http.Request{}).WithContext(ctx),
1775 autorest.AsJSON(),
1776 autorest.AsGet(),
1777 autorest.WithBaseURL(to.String(slr.NextLink)))
1778 }
1779
1780
1781 type ServerListResultPage struct {
1782 fn func(context.Context, ServerListResult) (ServerListResult, error)
1783 slr ServerListResult
1784 }
1785
1786
1787
1788 func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) {
1789 if tracing.IsEnabled() {
1790 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext")
1791 defer func() {
1792 sc := -1
1793 if page.Response().Response.Response != nil {
1794 sc = page.Response().Response.Response.StatusCode
1795 }
1796 tracing.EndSpan(ctx, sc, err)
1797 }()
1798 }
1799 for {
1800 next, err := page.fn(ctx, page.slr)
1801 if err != nil {
1802 return err
1803 }
1804 page.slr = next
1805 if !next.hasNextLink() || !next.IsEmpty() {
1806 break
1807 }
1808 }
1809 return nil
1810 }
1811
1812
1813
1814
1815 func (page *ServerListResultPage) Next() error {
1816 return page.NextWithContext(context.Background())
1817 }
1818
1819
1820 func (page ServerListResultPage) NotDone() bool {
1821 return !page.slr.IsEmpty()
1822 }
1823
1824
1825 func (page ServerListResultPage) Response() ServerListResult {
1826 return page.slr
1827 }
1828
1829
1830 func (page ServerListResultPage) Values() []Server {
1831 if page.slr.IsEmpty() {
1832 return nil
1833 }
1834 return *page.slr.Value
1835 }
1836
1837
1838 func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage {
1839 return ServerListResultPage{
1840 fn: getNextPage,
1841 slr: cur,
1842 }
1843 }
1844
1845
1846 type ServerProperties struct {
1847
1848 AdministratorLogin *string `json:"administratorLogin,omitempty"`
1849
1850 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
1851
1852 Version ServerVersion `json:"version,omitempty"`
1853
1854 State ServerState `json:"state,omitempty"`
1855
1856 HaState ServerHAState `json:"haState,omitempty"`
1857
1858 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
1859
1860 DisplayName *string `json:"displayName,omitempty"`
1861
1862 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
1863
1864 PublicNetworkAccess ServerPublicNetworkAccessState `json:"publicNetworkAccess,omitempty"`
1865
1866 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
1867
1868 HaEnabled HAEnabledEnum `json:"haEnabled,omitempty"`
1869
1870 SourceServerName *string `json:"sourceServerName,omitempty"`
1871
1872 PointInTimeUTC *date.Time `json:"pointInTimeUTC,omitempty"`
1873
1874 AvailabilityZone *string `json:"availabilityZone,omitempty"`
1875
1876 StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"`
1877
1878 ByokEnforcement *string `json:"byokEnforcement,omitempty"`
1879 DelegatedSubnetArguments *ServerPropertiesDelegatedSubnetArguments `json:"delegatedSubnetArguments,omitempty"`
1880
1881 CreateMode CreateMode `json:"createMode,omitempty"`
1882
1883 Tags map[string]*string `json:"tags"`
1884 }
1885
1886
1887 func (sp ServerProperties) MarshalJSON() ([]byte, error) {
1888 objectMap := make(map[string]interface{})
1889 if sp.AdministratorLogin != nil {
1890 objectMap["administratorLogin"] = sp.AdministratorLogin
1891 }
1892 if sp.AdministratorLoginPassword != nil {
1893 objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword
1894 }
1895 if sp.Version != "" {
1896 objectMap["version"] = sp.Version
1897 }
1898 if sp.DisplayName != nil {
1899 objectMap["displayName"] = sp.DisplayName
1900 }
1901 if sp.StorageProfile != nil {
1902 objectMap["storageProfile"] = sp.StorageProfile
1903 }
1904 if sp.MaintenanceWindow != nil {
1905 objectMap["maintenanceWindow"] = sp.MaintenanceWindow
1906 }
1907 if sp.HaEnabled != "" {
1908 objectMap["haEnabled"] = sp.HaEnabled
1909 }
1910 if sp.SourceServerName != nil {
1911 objectMap["sourceServerName"] = sp.SourceServerName
1912 }
1913 if sp.PointInTimeUTC != nil {
1914 objectMap["pointInTimeUTC"] = sp.PointInTimeUTC
1915 }
1916 if sp.AvailabilityZone != nil {
1917 objectMap["availabilityZone"] = sp.AvailabilityZone
1918 }
1919 if sp.DelegatedSubnetArguments != nil {
1920 objectMap["delegatedSubnetArguments"] = sp.DelegatedSubnetArguments
1921 }
1922 if sp.CreateMode != "" {
1923 objectMap["createMode"] = sp.CreateMode
1924 }
1925 if sp.Tags != nil {
1926 objectMap["tags"] = sp.Tags
1927 }
1928 return json.Marshal(objectMap)
1929 }
1930
1931
1932 type ServerPropertiesDelegatedSubnetArguments struct {
1933
1934 SubnetArmResourceID *string `json:"subnetArmResourceId,omitempty"`
1935 }
1936
1937
1938 type ServerPropertiesForUpdate struct {
1939
1940 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
1941
1942 StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
1943
1944 HaEnabled HAEnabledEnum `json:"haEnabled,omitempty"`
1945
1946 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
1947 }
1948
1949
1950
1951 type ServersCreateFuture struct {
1952 azure.FutureAPI
1953
1954
1955 Result func(ServersClient) (Server, error)
1956 }
1957
1958
1959 func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
1960 var azFuture azure.Future
1961 if err := json.Unmarshal(body, &azFuture); err != nil {
1962 return err
1963 }
1964 future.FutureAPI = &azFuture
1965 future.Result = future.result
1966 return nil
1967 }
1968
1969
1970 func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
1971 var done bool
1972 done, err = future.DoneWithContext(context.Background(), client)
1973 if err != nil {
1974 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersCreateFuture", "Result", future.Response(), "Polling failure")
1975 return
1976 }
1977 if !done {
1978 s.Response.Response = future.Response()
1979 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersCreateFuture")
1980 return
1981 }
1982 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1983 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
1984 s, err = client.CreateResponder(s.Response.Response)
1985 if err != nil {
1986 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
1987 }
1988 }
1989 return
1990 }
1991
1992
1993
1994 type ServersDeleteFuture struct {
1995 azure.FutureAPI
1996
1997
1998 Result func(ServersClient) (autorest.Response, error)
1999 }
2000
2001
2002 func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
2003 var azFuture azure.Future
2004 if err := json.Unmarshal(body, &azFuture); err != nil {
2005 return err
2006 }
2007 future.FutureAPI = &azFuture
2008 future.Result = future.result
2009 return nil
2010 }
2011
2012
2013 func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
2014 var done bool
2015 done, err = future.DoneWithContext(context.Background(), client)
2016 if err != nil {
2017 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
2018 return
2019 }
2020 if !done {
2021 ar.Response = future.Response()
2022 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersDeleteFuture")
2023 return
2024 }
2025 ar.Response = future.Response()
2026 return
2027 }
2028
2029
2030
2031 type ServersRestartFuture struct {
2032 azure.FutureAPI
2033
2034
2035 Result func(ServersClient) (autorest.Response, error)
2036 }
2037
2038
2039 func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error {
2040 var azFuture azure.Future
2041 if err := json.Unmarshal(body, &azFuture); err != nil {
2042 return err
2043 }
2044 future.FutureAPI = &azFuture
2045 future.Result = future.result
2046 return nil
2047 }
2048
2049
2050 func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {
2051 var done bool
2052 done, err = future.DoneWithContext(context.Background(), client)
2053 if err != nil {
2054 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersRestartFuture", "Result", future.Response(), "Polling failure")
2055 return
2056 }
2057 if !done {
2058 ar.Response = future.Response()
2059 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersRestartFuture")
2060 return
2061 }
2062 ar.Response = future.Response()
2063 return
2064 }
2065
2066
2067 type ServersStartFuture struct {
2068 azure.FutureAPI
2069
2070
2071 Result func(ServersClient) (autorest.Response, error)
2072 }
2073
2074
2075 func (future *ServersStartFuture) UnmarshalJSON(body []byte) error {
2076 var azFuture azure.Future
2077 if err := json.Unmarshal(body, &azFuture); err != nil {
2078 return err
2079 }
2080 future.FutureAPI = &azFuture
2081 future.Result = future.result
2082 return nil
2083 }
2084
2085
2086 func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) {
2087 var done bool
2088 done, err = future.DoneWithContext(context.Background(), client)
2089 if err != nil {
2090 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersStartFuture", "Result", future.Response(), "Polling failure")
2091 return
2092 }
2093 if !done {
2094 ar.Response = future.Response()
2095 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersStartFuture")
2096 return
2097 }
2098 ar.Response = future.Response()
2099 return
2100 }
2101
2102
2103 type ServersStopFuture struct {
2104 azure.FutureAPI
2105
2106
2107 Result func(ServersClient) (autorest.Response, error)
2108 }
2109
2110
2111 func (future *ServersStopFuture) UnmarshalJSON(body []byte) error {
2112 var azFuture azure.Future
2113 if err := json.Unmarshal(body, &azFuture); err != nil {
2114 return err
2115 }
2116 future.FutureAPI = &azFuture
2117 future.Result = future.result
2118 return nil
2119 }
2120
2121
2122 func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) {
2123 var done bool
2124 done, err = future.DoneWithContext(context.Background(), client)
2125 if err != nil {
2126 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersStopFuture", "Result", future.Response(), "Polling failure")
2127 return
2128 }
2129 if !done {
2130 ar.Response = future.Response()
2131 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersStopFuture")
2132 return
2133 }
2134 ar.Response = future.Response()
2135 return
2136 }
2137
2138
2139
2140 type ServersUpdateFuture struct {
2141 azure.FutureAPI
2142
2143
2144 Result func(ServersClient) (Server, error)
2145 }
2146
2147
2148 func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
2149 var azFuture azure.Future
2150 if err := json.Unmarshal(body, &azFuture); err != nil {
2151 return err
2152 }
2153 future.FutureAPI = &azFuture
2154 future.Result = future.result
2155 return nil
2156 }
2157
2158
2159 func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
2160 var done bool
2161 done, err = future.DoneWithContext(context.Background(), client)
2162 if err != nil {
2163 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
2164 return
2165 }
2166 if !done {
2167 s.Response.Response = future.Response()
2168 err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersUpdateFuture")
2169 return
2170 }
2171 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2172 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
2173 s, err = client.UpdateResponder(s.Response.Response)
2174 if err != nil {
2175 err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
2176 }
2177 }
2178 return
2179 }
2180
2181
2182 type ServerVersionCapability struct {
2183
2184 Name *string `json:"name,omitempty"`
2185
2186 SupportedVcores *[]VcoreCapability `json:"supportedVcores,omitempty"`
2187 }
2188
2189
2190 func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) {
2191 objectMap := make(map[string]interface{})
2192 return json.Marshal(objectMap)
2193 }
2194
2195
2196 type Sku struct {
2197
2198 Name *string `json:"name,omitempty"`
2199
2200 Tier SkuTier `json:"tier,omitempty"`
2201 }
2202
2203
2204 type StorageEditionCapability struct {
2205
2206 Name *string `json:"name,omitempty"`
2207
2208 SupportedStorageMB *[]StorageMBCapability `json:"supportedStorageMB,omitempty"`
2209 }
2210
2211
2212 func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) {
2213 objectMap := make(map[string]interface{})
2214 return json.Marshal(objectMap)
2215 }
2216
2217
2218 type StorageMBCapability struct {
2219
2220 Name *string `json:"name,omitempty"`
2221
2222 SupportedIops *int64 `json:"supportedIops,omitempty"`
2223
2224 StorageSizeMB *int64 `json:"storageSizeMB,omitempty"`
2225 }
2226
2227
2228 func (smc StorageMBCapability) MarshalJSON() ([]byte, error) {
2229 objectMap := make(map[string]interface{})
2230 return json.Marshal(objectMap)
2231 }
2232
2233
2234 type StorageProfile struct {
2235
2236 BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
2237
2238 StorageMB *int32 `json:"storageMB,omitempty"`
2239 }
2240
2241
2242
2243 type TrackedResource struct {
2244
2245 Tags map[string]*string `json:"tags"`
2246
2247 Location *string `json:"location,omitempty"`
2248
2249 ID *string `json:"id,omitempty"`
2250
2251 Name *string `json:"name,omitempty"`
2252
2253 Type *string `json:"type,omitempty"`
2254 }
2255
2256
2257 func (tr TrackedResource) MarshalJSON() ([]byte, error) {
2258 objectMap := make(map[string]interface{})
2259 if tr.Tags != nil {
2260 objectMap["tags"] = tr.Tags
2261 }
2262 if tr.Location != nil {
2263 objectMap["location"] = tr.Location
2264 }
2265 return json.Marshal(objectMap)
2266 }
2267
2268
2269 type VcoreCapability struct {
2270
2271 Name *string `json:"name,omitempty"`
2272
2273 VCores *int64 `json:"vCores,omitempty"`
2274
2275 SupportedIops *int64 `json:"supportedIops,omitempty"`
2276
2277 SupportedMemoryPerVcoreMB *int64 `json:"supportedMemoryPerVcoreMB,omitempty"`
2278 }
2279
2280
2281 func (vc VcoreCapability) MarshalJSON() ([]byte, error) {
2282 objectMap := make(map[string]interface{})
2283 return json.Marshal(objectMap)
2284 }
2285
2286
2287 type VirtualNetworkSubnetUsageParameter struct {
2288
2289 VirtualNetworkArmResourceID *string `json:"virtualNetworkArmResourceId,omitempty"`
2290 }
2291
2292
2293 type VirtualNetworkSubnetUsageResult struct {
2294 autorest.Response `json:"-"`
2295
2296 DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"`
2297 }
2298
2299
2300 func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) {
2301 objectMap := make(map[string]interface{})
2302 return json.Marshal(objectMap)
2303 }
2304
View as plain text