1package postgresqlflexibleservers
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
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// The package's fully qualified name.
21const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers"
22
23// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag.
24type AzureEntityResource struct {
25	// Etag - READ-ONLY; Resource Etag.
26	Etag *string `json:"etag,omitempty"`
27	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
28	ID *string `json:"id,omitempty"`
29	// Name - READ-ONLY; The name of the resource
30	Name *string `json:"name,omitempty"`
31	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
32	Type *string `json:"type,omitempty"`
33}
34
35// MarshalJSON is the custom marshaler for AzureEntityResource.
36func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
37	objectMap := make(map[string]interface{})
38	return json.Marshal(objectMap)
39}
40
41// CapabilitiesListResult location capability
42type CapabilitiesListResult struct {
43	autorest.Response `json:"-"`
44	// Value - READ-ONLY; A list of supported capabilities.
45	Value *[]CapabilityProperties `json:"value,omitempty"`
46	// NextLink - READ-ONLY; Link to retrieve next page of results.
47	NextLink *string `json:"nextLink,omitempty"`
48}
49
50// MarshalJSON is the custom marshaler for CapabilitiesListResult.
51func (clr CapabilitiesListResult) MarshalJSON() ([]byte, error) {
52	objectMap := make(map[string]interface{})
53	return json.Marshal(objectMap)
54}
55
56// CapabilitiesListResultIterator provides access to a complete listing of CapabilityProperties values.
57type CapabilitiesListResultIterator struct {
58	i    int
59	page CapabilitiesListResultPage
60}
61
62// NextWithContext advances to the next value.  If there was an error making
63// the request the iterator does not advance and the error is returned.
64func (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// Next advances to the next value.  If there was an error making
89// the request the iterator does not advance and the error is returned.
90// Deprecated: Use NextWithContext() instead.
91func (iter *CapabilitiesListResultIterator) Next() error {
92	return iter.NextWithContext(context.Background())
93}
94
95// NotDone returns true if the enumeration should be started or is not yet complete.
96func (iter CapabilitiesListResultIterator) NotDone() bool {
97	return iter.page.NotDone() && iter.i < len(iter.page.Values())
98}
99
100// Response returns the raw server response from the last page request.
101func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult {
102	return iter.page.Response()
103}
104
105// Value returns the current value or a zero-initialized value if the
106// iterator has advanced beyond the end of the collection.
107func (iter CapabilitiesListResultIterator) Value() CapabilityProperties {
108	if !iter.page.NotDone() {
109		return CapabilityProperties{}
110	}
111	return iter.page.Values()[iter.i]
112}
113
114// Creates a new instance of the CapabilitiesListResultIterator type.
115func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator {
116	return CapabilitiesListResultIterator{page: page}
117}
118
119// IsEmpty returns true if the ListResult contains no values.
120func (clr CapabilitiesListResult) IsEmpty() bool {
121	return clr.Value == nil || len(*clr.Value) == 0
122}
123
124// hasNextLink returns true if the NextLink is not empty.
125func (clr CapabilitiesListResult) hasNextLink() bool {
126	return clr.NextLink != nil && len(*clr.NextLink) != 0
127}
128
129// capabilitiesListResultPreparer prepares a request to retrieve the next set of results.
130// It returns nil if no more results exist.
131func (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// CapabilitiesListResultPage contains a page of CapabilityProperties values.
142type CapabilitiesListResultPage struct {
143	fn  func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)
144	clr CapabilitiesListResult
145}
146
147// NextWithContext advances to the next page of values.  If there was an error making
148// the request the page does not advance and the error is returned.
149func (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// Next advances to the next page of values.  If there was an error making
174// the request the page does not advance and the error is returned.
175// Deprecated: Use NextWithContext() instead.
176func (page *CapabilitiesListResultPage) Next() error {
177	return page.NextWithContext(context.Background())
178}
179
180// NotDone returns true if the page enumeration should be started or is not yet complete.
181func (page CapabilitiesListResultPage) NotDone() bool {
182	return !page.clr.IsEmpty()
183}
184
185// Response returns the raw server response from the last page request.
186func (page CapabilitiesListResultPage) Response() CapabilitiesListResult {
187	return page.clr
188}
189
190// Values returns the slice of values for the current page or nil if there are no values.
191func (page CapabilitiesListResultPage) Values() []CapabilityProperties {
192	if page.clr.IsEmpty() {
193		return nil
194	}
195	return *page.clr.Value
196}
197
198// Creates a new instance of the CapabilitiesListResultPage type.
199func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage {
200	return CapabilitiesListResultPage{
201		fn:  getNextPage,
202		clr: cur,
203	}
204}
205
206// CapabilityProperties location capabilities.
207type CapabilityProperties struct {
208	// Zone - READ-ONLY; zone name
209	Zone *string `json:"zone,omitempty"`
210	// SupportedFlexibleServerEditions - READ-ONLY
211	SupportedFlexibleServerEditions *[]ServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"`
212}
213
214// MarshalJSON is the custom marshaler for CapabilityProperties.
215func (cp CapabilityProperties) MarshalJSON() ([]byte, error) {
216	objectMap := make(map[string]interface{})
217	return json.Marshal(objectMap)
218}
219
220// CloudError an error response from the Batch service.
221type CloudError struct {
222	Error *ErrorResponse `json:"error,omitempty"`
223}
224
225// Configuration represents a Configuration.
226type Configuration struct {
227	autorest.Response `json:"-"`
228	// ConfigurationProperties - The properties of a configuration.
229	*ConfigurationProperties `json:"properties,omitempty"`
230	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
231	ID *string `json:"id,omitempty"`
232	// Name - READ-ONLY; The name of the resource
233	Name *string `json:"name,omitempty"`
234	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
235	Type *string `json:"type,omitempty"`
236}
237
238// MarshalJSON is the custom marshaler for Configuration.
239func (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// UnmarshalJSON is the custom unmarshaler for Configuration struct.
248func (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// ConfigurationListResult a list of server configurations.
299type ConfigurationListResult struct {
300	autorest.Response `json:"-"`
301	// Value - The list of server configurations.
302	Value *[]Configuration `json:"value,omitempty"`
303	// NextLink - The link used to get the next page of operations.
304	NextLink *string `json:"nextLink,omitempty"`
305}
306
307// ConfigurationListResultIterator provides access to a complete listing of Configuration values.
308type ConfigurationListResultIterator struct {
309	i    int
310	page ConfigurationListResultPage
311}
312
313// NextWithContext advances to the next value.  If there was an error making
314// the request the iterator does not advance and the error is returned.
315func (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// Next advances to the next value.  If there was an error making
340// the request the iterator does not advance and the error is returned.
341// Deprecated: Use NextWithContext() instead.
342func (iter *ConfigurationListResultIterator) Next() error {
343	return iter.NextWithContext(context.Background())
344}
345
346// NotDone returns true if the enumeration should be started or is not yet complete.
347func (iter ConfigurationListResultIterator) NotDone() bool {
348	return iter.page.NotDone() && iter.i < len(iter.page.Values())
349}
350
351// Response returns the raw server response from the last page request.
352func (iter ConfigurationListResultIterator) Response() ConfigurationListResult {
353	return iter.page.Response()
354}
355
356// Value returns the current value or a zero-initialized value if the
357// iterator has advanced beyond the end of the collection.
358func (iter ConfigurationListResultIterator) Value() Configuration {
359	if !iter.page.NotDone() {
360		return Configuration{}
361	}
362	return iter.page.Values()[iter.i]
363}
364
365// Creates a new instance of the ConfigurationListResultIterator type.
366func NewConfigurationListResultIterator(page ConfigurationListResultPage) ConfigurationListResultIterator {
367	return ConfigurationListResultIterator{page: page}
368}
369
370// IsEmpty returns true if the ListResult contains no values.
371func (clr ConfigurationListResult) IsEmpty() bool {
372	return clr.Value == nil || len(*clr.Value) == 0
373}
374
375// hasNextLink returns true if the NextLink is not empty.
376func (clr ConfigurationListResult) hasNextLink() bool {
377	return clr.NextLink != nil && len(*clr.NextLink) != 0
378}
379
380// configurationListResultPreparer prepares a request to retrieve the next set of results.
381// It returns nil if no more results exist.
382func (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// ConfigurationListResultPage contains a page of Configuration values.
393type ConfigurationListResultPage struct {
394	fn  func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)
395	clr ConfigurationListResult
396}
397
398// NextWithContext advances to the next page of values.  If there was an error making
399// the request the page does not advance and the error is returned.
400func (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// Next advances to the next page of values.  If there was an error making
425// the request the page does not advance and the error is returned.
426// Deprecated: Use NextWithContext() instead.
427func (page *ConfigurationListResultPage) Next() error {
428	return page.NextWithContext(context.Background())
429}
430
431// NotDone returns true if the page enumeration should be started or is not yet complete.
432func (page ConfigurationListResultPage) NotDone() bool {
433	return !page.clr.IsEmpty()
434}
435
436// Response returns the raw server response from the last page request.
437func (page ConfigurationListResultPage) Response() ConfigurationListResult {
438	return page.clr
439}
440
441// Values returns the slice of values for the current page or nil if there are no values.
442func (page ConfigurationListResultPage) Values() []Configuration {
443	if page.clr.IsEmpty() {
444		return nil
445	}
446	return *page.clr.Value
447}
448
449// Creates a new instance of the ConfigurationListResultPage type.
450func NewConfigurationListResultPage(cur ConfigurationListResult, getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage {
451	return ConfigurationListResultPage{
452		fn:  getNextPage,
453		clr: cur,
454	}
455}
456
457// ConfigurationProperties the properties of a configuration.
458type ConfigurationProperties struct {
459	// Value - Value of the configuration.
460	Value *string `json:"value,omitempty"`
461	// Description - READ-ONLY; Description of the configuration.
462	Description *string `json:"description,omitempty"`
463	// DefaultValue - READ-ONLY; Default value of the configuration.
464	DefaultValue *string `json:"defaultValue,omitempty"`
465	// DataType - READ-ONLY; Data type of the configuration. Possible values include: 'Boolean', 'Numeric', 'Integer', 'Enumeration'
466	DataType ConfigurationDataType `json:"dataType,omitempty"`
467	// AllowedValues - READ-ONLY; Allowed values of the configuration.
468	AllowedValues *string `json:"allowedValues,omitempty"`
469	// Source - Source of the configuration.
470	Source *string `json:"source,omitempty"`
471}
472
473// MarshalJSON is the custom marshaler for ConfigurationProperties.
474func (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// ConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
486// operation.
487type ConfigurationsUpdateFuture struct {
488	azure.FutureAPI
489	// Result returns the result of the asynchronous operation.
490	// If the operation has not completed it will return an error.
491	Result func(ConfigurationsClient) (Configuration, error)
492}
493
494// UnmarshalJSON is the custom unmarshaller for CreateFuture.
495func (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// result is the default implementation for ConfigurationsUpdateFuture.Result.
506func (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// DelegatedSubnetUsage delegated subnet usage data.
529type DelegatedSubnetUsage struct {
530	// SubnetName - READ-ONLY; name of the subnet
531	SubnetName *string `json:"subnetName,omitempty"`
532	// Usage - READ-ONLY; Number of used delegated subnets
533	Usage *int64 `json:"usage,omitempty"`
534}
535
536// MarshalJSON is the custom marshaler for DelegatedSubnetUsage.
537func (dsu DelegatedSubnetUsage) MarshalJSON() ([]byte, error) {
538	objectMap := make(map[string]interface{})
539	return json.Marshal(objectMap)
540}
541
542// ErrorAdditionalInfo the resource management error additional info.
543type ErrorAdditionalInfo struct {
544	// Type - READ-ONLY; The additional info type.
545	Type *string `json:"type,omitempty"`
546	// Info - READ-ONLY; The additional info.
547	Info interface{} `json:"info,omitempty"`
548}
549
550// MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
551func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
552	objectMap := make(map[string]interface{})
553	return json.Marshal(objectMap)
554}
555
556// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
557// failed operations. (This also follows the OData error response format.)
558type ErrorResponse struct {
559	// Code - READ-ONLY; The error code.
560	Code *string `json:"code,omitempty"`
561	// Message - READ-ONLY; The error message.
562	Message *string `json:"message,omitempty"`
563	// Target - READ-ONLY; The error target.
564	Target *string `json:"target,omitempty"`
565	// Details - READ-ONLY; The error details.
566	Details *[]ErrorResponse `json:"details,omitempty"`
567	// AdditionalInfo - READ-ONLY; The error additional info.
568	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
569}
570
571// MarshalJSON is the custom marshaler for ErrorResponse.
572func (er ErrorResponse) MarshalJSON() ([]byte, error) {
573	objectMap := make(map[string]interface{})
574	return json.Marshal(objectMap)
575}
576
577// FirewallRule represents a server firewall rule.
578type FirewallRule struct {
579	autorest.Response `json:"-"`
580	// FirewallRuleProperties - The properties of a firewall rule.
581	*FirewallRuleProperties `json:"properties,omitempty"`
582	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
583	ID *string `json:"id,omitempty"`
584	// Name - READ-ONLY; The name of the resource
585	Name *string `json:"name,omitempty"`
586	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
587	Type *string `json:"type,omitempty"`
588}
589
590// MarshalJSON is the custom marshaler for FirewallRule.
591func (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// UnmarshalJSON is the custom unmarshaler for FirewallRule struct.
600func (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// FirewallRuleListResult a list of firewall rules.
651type FirewallRuleListResult struct {
652	autorest.Response `json:"-"`
653	// Value - The list of firewall rules in a server.
654	Value *[]FirewallRule `json:"value,omitempty"`
655	// NextLink - The link used to get the next page of operations.
656	NextLink *string `json:"nextLink,omitempty"`
657}
658
659// FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values.
660type FirewallRuleListResultIterator struct {
661	i    int
662	page FirewallRuleListResultPage
663}
664
665// NextWithContext advances to the next value.  If there was an error making
666// the request the iterator does not advance and the error is returned.
667func (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// Next advances to the next value.  If there was an error making
692// the request the iterator does not advance and the error is returned.
693// Deprecated: Use NextWithContext() instead.
694func (iter *FirewallRuleListResultIterator) Next() error {
695	return iter.NextWithContext(context.Background())
696}
697
698// NotDone returns true if the enumeration should be started or is not yet complete.
699func (iter FirewallRuleListResultIterator) NotDone() bool {
700	return iter.page.NotDone() && iter.i < len(iter.page.Values())
701}
702
703// Response returns the raw server response from the last page request.
704func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult {
705	return iter.page.Response()
706}
707
708// Value returns the current value or a zero-initialized value if the
709// iterator has advanced beyond the end of the collection.
710func (iter FirewallRuleListResultIterator) Value() FirewallRule {
711	if !iter.page.NotDone() {
712		return FirewallRule{}
713	}
714	return iter.page.Values()[iter.i]
715}
716
717// Creates a new instance of the FirewallRuleListResultIterator type.
718func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator {
719	return FirewallRuleListResultIterator{page: page}
720}
721
722// IsEmpty returns true if the ListResult contains no values.
723func (frlr FirewallRuleListResult) IsEmpty() bool {
724	return frlr.Value == nil || len(*frlr.Value) == 0
725}
726
727// hasNextLink returns true if the NextLink is not empty.
728func (frlr FirewallRuleListResult) hasNextLink() bool {
729	return frlr.NextLink != nil && len(*frlr.NextLink) != 0
730}
731
732// firewallRuleListResultPreparer prepares a request to retrieve the next set of results.
733// It returns nil if no more results exist.
734func (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// FirewallRuleListResultPage contains a page of FirewallRule values.
745type FirewallRuleListResultPage struct {
746	fn   func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)
747	frlr FirewallRuleListResult
748}
749
750// NextWithContext advances to the next page of values.  If there was an error making
751// the request the page does not advance and the error is returned.
752func (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// Next advances to the next page of values.  If there was an error making
777// the request the page does not advance and the error is returned.
778// Deprecated: Use NextWithContext() instead.
779func (page *FirewallRuleListResultPage) Next() error {
780	return page.NextWithContext(context.Background())
781}
782
783// NotDone returns true if the page enumeration should be started or is not yet complete.
784func (page FirewallRuleListResultPage) NotDone() bool {
785	return !page.frlr.IsEmpty()
786}
787
788// Response returns the raw server response from the last page request.
789func (page FirewallRuleListResultPage) Response() FirewallRuleListResult {
790	return page.frlr
791}
792
793// Values returns the slice of values for the current page or nil if there are no values.
794func (page FirewallRuleListResultPage) Values() []FirewallRule {
795	if page.frlr.IsEmpty() {
796		return nil
797	}
798	return *page.frlr.Value
799}
800
801// Creates a new instance of the FirewallRuleListResultPage type.
802func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {
803	return FirewallRuleListResultPage{
804		fn:   getNextPage,
805		frlr: cur,
806	}
807}
808
809// FirewallRuleProperties the properties of a server firewall rule.
810type FirewallRuleProperties struct {
811	// StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format.
812	StartIPAddress *string `json:"startIpAddress,omitempty"`
813	// EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format.
814	EndIPAddress *string `json:"endIpAddress,omitempty"`
815}
816
817// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
818// long-running operation.
819type FirewallRulesCreateOrUpdateFuture struct {
820	azure.FutureAPI
821	// Result returns the result of the asynchronous operation.
822	// If the operation has not completed it will return an error.
823	Result func(FirewallRulesClient) (FirewallRule, error)
824}
825
826// UnmarshalJSON is the custom unmarshaller for CreateFuture.
827func (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// result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result.
838func (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// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
861// operation.
862type FirewallRulesDeleteFuture struct {
863	azure.FutureAPI
864	// Result returns the result of the asynchronous operation.
865	// If the operation has not completed it will return an error.
866	Result func(FirewallRulesClient) (autorest.Response, error)
867}
868
869// UnmarshalJSON is the custom unmarshaller for CreateFuture.
870func (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// result is the default implementation for FirewallRulesDeleteFuture.Result.
881func (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// Identity identity for the resource.
898type Identity struct {
899	// PrincipalID - READ-ONLY; The principal ID of resource identity.
900	PrincipalID *string `json:"principalId,omitempty"`
901	// TenantID - READ-ONLY; The tenant ID of resource.
902	TenantID *string `json:"tenantId,omitempty"`
903	// Type - The identity type. Possible values include: 'SystemAssigned'
904	Type ResourceIdentityType `json:"type,omitempty"`
905}
906
907// MarshalJSON is the custom marshaler for Identity.
908func (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// MaintenanceWindow maintenance window of a server.
917type MaintenanceWindow struct {
918	// CustomWindow - indicates whether custom window is enabled or disabled
919	CustomWindow *string `json:"customWindow,omitempty"`
920	// StartHour - start hour for maintenance window
921	StartHour *int32 `json:"startHour,omitempty"`
922	// StartMinute - start minute for maintenance window
923	StartMinute *int32 `json:"startMinute,omitempty"`
924	// DayOfWeek - day of week for maintenance window
925	DayOfWeek *int32 `json:"dayOfWeek,omitempty"`
926}
927
928// NameAvailability represents a resource name availability.
929type NameAvailability struct {
930	autorest.Response `json:"-"`
931	// Message - Error Message.
932	Message *string `json:"message,omitempty"`
933	// NameAvailable - Indicates whether the resource name is available.
934	NameAvailable *bool `json:"nameAvailable,omitempty"`
935	// Name - name of the PostgreSQL server.
936	Name *string `json:"name,omitempty"`
937	// Type - type of the server
938	Type *string `json:"type,omitempty"`
939}
940
941// NameAvailabilityRequest request from client to check resource name availability.
942type NameAvailabilityRequest struct {
943	// Name - Resource name to verify.
944	Name *string `json:"name,omitempty"`
945	// Type - Resource type used for verification.
946	Type *string `json:"type,omitempty"`
947}
948
949// Operation REST API operation definition.
950type Operation struct {
951	// Name - READ-ONLY; The name of the operation being performed on this particular object.
952	Name *string `json:"name,omitempty"`
953	// Display - READ-ONLY; The localized display information for this particular operation or action.
954	Display *OperationDisplay `json:"display,omitempty"`
955	// IsDataAction - Indicates whether the operation is a data action
956	IsDataAction *bool `json:"isDataAction,omitempty"`
957	// Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System'
958	Origin OperationOrigin `json:"origin,omitempty"`
959	// Properties - READ-ONLY; Additional descriptions for the operation.
960	Properties map[string]interface{} `json:"properties"`
961}
962
963// MarshalJSON is the custom marshaler for Operation.
964func (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// OperationDisplay display metadata associated with the operation.
973type OperationDisplay struct {
974	// Provider - READ-ONLY; Operation resource provider name.
975	Provider *string `json:"provider,omitempty"`
976	// Resource - READ-ONLY; Resource on which the operation is performed.
977	Resource *string `json:"resource,omitempty"`
978	// Operation - READ-ONLY; Localized friendly name for the operation.
979	Operation *string `json:"operation,omitempty"`
980	// Description - READ-ONLY; Operation description.
981	Description *string `json:"description,omitempty"`
982}
983
984// MarshalJSON is the custom marshaler for OperationDisplay.
985func (od OperationDisplay) MarshalJSON() ([]byte, error) {
986	objectMap := make(map[string]interface{})
987	return json.Marshal(objectMap)
988}
989
990// OperationListResult a list of resource provider operations.
991type OperationListResult struct {
992	autorest.Response `json:"-"`
993	// Value - Collection of available operation details
994	Value *[]Operation `json:"value,omitempty"`
995	// NextLink - URL client should use to fetch the next page (per server side paging).
996	// It's null for now, added for future use.
997	NextLink *string `json:"nextLink,omitempty"`
998}
999
1000// Plan plan for the resource.
1001type Plan struct {
1002	// Name - A user defined name of the 3rd Party Artifact that is being procured.
1003	Name *string `json:"name,omitempty"`
1004	// Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic
1005	Publisher *string `json:"publisher,omitempty"`
1006	// Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding.
1007	Product *string `json:"product,omitempty"`
1008	// PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact.
1009	PromotionCode *string `json:"promotionCode,omitempty"`
1010	// Version - The version of the desired product/artifact.
1011	Version *string `json:"version,omitempty"`
1012}
1013
1014// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not
1015// have tags and a location
1016type ProxyResource struct {
1017	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1018	ID *string `json:"id,omitempty"`
1019	// Name - READ-ONLY; The name of the resource
1020	Name *string `json:"name,omitempty"`
1021	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1022	Type *string `json:"type,omitempty"`
1023}
1024
1025// MarshalJSON is the custom marshaler for ProxyResource.
1026func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1027	objectMap := make(map[string]interface{})
1028	return json.Marshal(objectMap)
1029}
1030
1031// Resource common fields that are returned in the response for all Azure Resource Manager resources
1032type Resource struct {
1033	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1034	ID *string `json:"id,omitempty"`
1035	// Name - READ-ONLY; The name of the resource
1036	Name *string `json:"name,omitempty"`
1037	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1038	Type *string `json:"type,omitempty"`
1039}
1040
1041// MarshalJSON is the custom marshaler for Resource.
1042func (r Resource) MarshalJSON() ([]byte, error) {
1043	objectMap := make(map[string]interface{})
1044	return json.Marshal(objectMap)
1045}
1046
1047// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed
1048// properties for a resource. Except properties bag, there cannot be a top level property outside of this
1049// set.
1050type ResourceModelWithAllowedPropertySet struct {
1051	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1052	ID *string `json:"id,omitempty"`
1053	// Name - READ-ONLY; The name of the resource
1054	Name *string `json:"name,omitempty"`
1055	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1056	Type *string `json:"type,omitempty"`
1057	// Location - The geo-location where the resource lives
1058	Location *string `json:"location,omitempty"`
1059	// ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource.
1060	ManagedBy *string `json:"managedBy,omitempty"`
1061	// Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource provider must validate and persist this value.
1062	Kind *string `json:"kind,omitempty"`
1063	// Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention.  Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.
1064	Etag *string `json:"etag,omitempty"`
1065	// Tags - Resource tags.
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// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet.
1073func (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// ResourceModelWithAllowedPropertySetIdentity ...
1100type ResourceModelWithAllowedPropertySetIdentity struct {
1101	// PrincipalID - READ-ONLY; The principal ID of resource identity.
1102	PrincipalID *string `json:"principalId,omitempty"`
1103	// TenantID - READ-ONLY; The tenant ID of resource.
1104	TenantID *string `json:"tenantId,omitempty"`
1105	// Type - The identity type. Possible values include: 'SystemAssigned'
1106	Type ResourceIdentityType `json:"type,omitempty"`
1107}
1108
1109// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity.
1110func (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// ResourceModelWithAllowedPropertySetPlan ...
1119type ResourceModelWithAllowedPropertySetPlan struct {
1120	// Name - A user defined name of the 3rd Party Artifact that is being procured.
1121	Name *string `json:"name,omitempty"`
1122	// Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic
1123	Publisher *string `json:"publisher,omitempty"`
1124	// Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding.
1125	Product *string `json:"product,omitempty"`
1126	// PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact.
1127	PromotionCode *string `json:"promotionCode,omitempty"`
1128	// Version - The version of the desired product/artifact.
1129	Version *string `json:"version,omitempty"`
1130}
1131
1132// ResourceModelWithAllowedPropertySetSku ...
1133type ResourceModelWithAllowedPropertySetSku struct {
1134	// Name - The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3.
1135	Name *string `json:"name,omitempty"`
1136	// Tier - The tier of the particular SKU, e.g. Burstable. Possible values include: 'Burstable', 'GeneralPurpose', 'MemoryOptimized'
1137	Tier SkuTier `json:"tier,omitempty"`
1138}
1139
1140// Server represents a server.
1141type Server struct {
1142	autorest.Response `json:"-"`
1143	// Identity - The Azure Active Directory identity of the server.
1144	Identity *Identity `json:"identity,omitempty"`
1145	// Sku - The SKU (pricing tier) of the server.
1146	Sku *Sku `json:"sku,omitempty"`
1147	// ServerProperties - Properties of the server.
1148	*ServerProperties `json:"properties,omitempty"`
1149	// Tags - Resource tags.
1150	Tags map[string]*string `json:"tags"`
1151	// Location - The geo-location where the resource lives
1152	Location *string `json:"location,omitempty"`
1153	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1154	ID *string `json:"id,omitempty"`
1155	// Name - READ-ONLY; The name of the resource
1156	Name *string `json:"name,omitempty"`
1157	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1158	Type *string `json:"type,omitempty"`
1159}
1160
1161// MarshalJSON is the custom marshaler for Server.
1162func (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// UnmarshalJSON is the custom unmarshaler for Server struct.
1183func (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// ServerEditionCapability server edition capabilities.
1270type ServerEditionCapability struct {
1271	// Name - READ-ONLY; Server edition name
1272	Name *string `json:"name,omitempty"`
1273	// SupportedStorageEditions - READ-ONLY
1274	SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"`
1275	// SupportedServerVersions - READ-ONLY
1276	SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"`
1277}
1278
1279// MarshalJSON is the custom marshaler for ServerEditionCapability.
1280func (sec ServerEditionCapability) MarshalJSON() ([]byte, error) {
1281	objectMap := make(map[string]interface{})
1282	return json.Marshal(objectMap)
1283}
1284
1285// ServerForUpdate represents a server to be updated.
1286type ServerForUpdate struct {
1287	// Location - The location the resource resides in.
1288	Location *string `json:"location,omitempty"`
1289	// Sku - The SKU (pricing tier) of the server.
1290	Sku *Sku `json:"sku,omitempty"`
1291	// ServerPropertiesForUpdate - Properties of the server.
1292	*ServerPropertiesForUpdate `json:"properties,omitempty"`
1293	// Tags - Application-specific metadata in the form of key-value pairs.
1294	Tags map[string]*string `json:"tags"`
1295}
1296
1297// MarshalJSON is the custom marshaler for ServerForUpdate.
1298func (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// UnmarshalJSON is the custom unmarshaler for ServerForUpdate struct.
1316func (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// ServerListResult a list of servers.
1367type ServerListResult struct {
1368	autorest.Response `json:"-"`
1369	// Value - The list of flexible servers
1370	Value *[]Server `json:"value,omitempty"`
1371	// NextLink - The link used to get the next page of operations.
1372	NextLink *string `json:"nextLink,omitempty"`
1373}
1374
1375// ServerListResultIterator provides access to a complete listing of Server values.
1376type ServerListResultIterator struct {
1377	i    int
1378	page ServerListResultPage
1379}
1380
1381// NextWithContext advances to the next value.  If there was an error making
1382// the request the iterator does not advance and the error is returned.
1383func (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// Next advances to the next value.  If there was an error making
1408// the request the iterator does not advance and the error is returned.
1409// Deprecated: Use NextWithContext() instead.
1410func (iter *ServerListResultIterator) Next() error {
1411	return iter.NextWithContext(context.Background())
1412}
1413
1414// NotDone returns true if the enumeration should be started or is not yet complete.
1415func (iter ServerListResultIterator) NotDone() bool {
1416	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1417}
1418
1419// Response returns the raw server response from the last page request.
1420func (iter ServerListResultIterator) Response() ServerListResult {
1421	return iter.page.Response()
1422}
1423
1424// Value returns the current value or a zero-initialized value if the
1425// iterator has advanced beyond the end of the collection.
1426func (iter ServerListResultIterator) Value() Server {
1427	if !iter.page.NotDone() {
1428		return Server{}
1429	}
1430	return iter.page.Values()[iter.i]
1431}
1432
1433// Creates a new instance of the ServerListResultIterator type.
1434func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator {
1435	return ServerListResultIterator{page: page}
1436}
1437
1438// IsEmpty returns true if the ListResult contains no values.
1439func (slr ServerListResult) IsEmpty() bool {
1440	return slr.Value == nil || len(*slr.Value) == 0
1441}
1442
1443// hasNextLink returns true if the NextLink is not empty.
1444func (slr ServerListResult) hasNextLink() bool {
1445	return slr.NextLink != nil && len(*slr.NextLink) != 0
1446}
1447
1448// serverListResultPreparer prepares a request to retrieve the next set of results.
1449// It returns nil if no more results exist.
1450func (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// ServerListResultPage contains a page of Server values.
1461type ServerListResultPage struct {
1462	fn  func(context.Context, ServerListResult) (ServerListResult, error)
1463	slr ServerListResult
1464}
1465
1466// NextWithContext advances to the next page of values.  If there was an error making
1467// the request the page does not advance and the error is returned.
1468func (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// Next advances to the next page of values.  If there was an error making
1493// the request the page does not advance and the error is returned.
1494// Deprecated: Use NextWithContext() instead.
1495func (page *ServerListResultPage) Next() error {
1496	return page.NextWithContext(context.Background())
1497}
1498
1499// NotDone returns true if the page enumeration should be started or is not yet complete.
1500func (page ServerListResultPage) NotDone() bool {
1501	return !page.slr.IsEmpty()
1502}
1503
1504// Response returns the raw server response from the last page request.
1505func (page ServerListResultPage) Response() ServerListResult {
1506	return page.slr
1507}
1508
1509// Values returns the slice of values for the current page or nil if there are no values.
1510func (page ServerListResultPage) Values() []Server {
1511	if page.slr.IsEmpty() {
1512		return nil
1513	}
1514	return *page.slr.Value
1515}
1516
1517// Creates a new instance of the ServerListResultPage type.
1518func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage {
1519	return ServerListResultPage{
1520		fn:  getNextPage,
1521		slr: cur,
1522	}
1523}
1524
1525// ServerProperties the properties of a server.
1526type ServerProperties struct {
1527	// AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
1528	AdministratorLogin *string `json:"administratorLogin,omitempty"`
1529	// AdministratorLoginPassword - The administrator login password (required for server creation).
1530	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
1531	// Version - PostgreSQL Server version. Possible values include: 'OneTwo', 'OneOne'
1532	Version ServerVersion `json:"version,omitempty"`
1533	// State - READ-ONLY; A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateStarting', 'ServerStateStopping', 'ServerStateStopped', 'ServerStateUpdating'
1534	State ServerState `json:"state,omitempty"`
1535	// HaState - READ-ONLY; A state of a HA server that is visible to user. Possible values include: 'NotEnabled', 'CreatingStandby', 'ReplicatingData', 'FailingOver', 'Healthy', 'RemovingStandby'
1536	HaState ServerHAState `json:"haState,omitempty"`
1537	// FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of a server.
1538	FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
1539	// DisplayName - The display name of a server.
1540	DisplayName *string `json:"displayName,omitempty"`
1541	// StorageProfile - Storage profile of a server.
1542	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
1543	// PublicNetworkAccess - READ-ONLY; public network access is enabled or not. Possible values include: 'ServerPublicNetworkAccessStateEnabled', 'ServerPublicNetworkAccessStateDisabled'
1544	PublicNetworkAccess ServerPublicNetworkAccessState `json:"publicNetworkAccess,omitempty"`
1545	// MaintenanceWindow - Maintenance window of a server.
1546	MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
1547	// HaEnabled - stand by count value can be either enabled or disabled. Possible values include: 'Enabled', 'Disabled'
1548	HaEnabled HAEnabledEnum `json:"haEnabled,omitempty"`
1549	// SourceServerName - The source PostgreSQL server name to restore from.
1550	SourceServerName *string `json:"sourceServerName,omitempty"`
1551	// SourceSubscriptionID - The subscription id of source serve PostgreSQL server name to restore from.
1552	SourceSubscriptionID *string `json:"sourceSubscriptionId,omitempty"`
1553	// SourceResourceGroupName - The resource group name of source serve PostgreSQL server name to restore from.
1554	SourceResourceGroupName *string `json:"sourceResourceGroupName,omitempty"`
1555	// PointInTimeUTC - Restore point creation time (ISO8601 format), specifying the time to restore from.
1556	PointInTimeUTC *date.Time `json:"pointInTimeUTC,omitempty"`
1557	// AvailabilityZone - availability Zone information of the server.
1558	AvailabilityZone *string `json:"availabilityZone,omitempty"`
1559	// StandbyAvailabilityZone - READ-ONLY; availability Zone information of the server.
1560	StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"`
1561	// ByokEnforcement - READ-ONLY; Status showing whether the data encryption is enabled with customer-managed keys.
1562	ByokEnforcement          *string                                   `json:"byokEnforcement,omitempty"`
1563	DelegatedSubnetArguments *ServerPropertiesDelegatedSubnetArguments `json:"delegatedSubnetArguments,omitempty"`
1564	PrivateDNSZoneArguments  *ServerPropertiesPrivateDNSZoneArguments  `json:"privateDnsZoneArguments,omitempty"`
1565	// CreateMode - The mode to create a new PostgreSQL server. Possible values include: 'Default', 'PointInTimeRestore'
1566	CreateMode CreateMode `json:"createMode,omitempty"`
1567	// Tags - Application-specific metadata in the form of key-value pairs.
1568	Tags map[string]*string `json:"tags"`
1569}
1570
1571// MarshalJSON is the custom marshaler for ServerProperties.
1572func (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// ServerPropertiesDelegatedSubnetArguments ...
1626type ServerPropertiesDelegatedSubnetArguments struct {
1627	// SubnetArmResourceID - delegated subnet arm resource id.
1628	SubnetArmResourceID *string `json:"subnetArmResourceId,omitempty"`
1629}
1630
1631// ServerPropertiesForUpdate ...
1632type ServerPropertiesForUpdate struct {
1633	// AdministratorLoginPassword - The password of the administrator login.
1634	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
1635	// StorageProfile - Storage profile of a server.
1636	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
1637	// HaEnabled - stand by count value can be either enabled or disabled. Possible values include: 'Enabled', 'Disabled'
1638	HaEnabled HAEnabledEnum `json:"haEnabled,omitempty"`
1639	// MaintenanceWindow - Maintenance window of a server.
1640	MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
1641}
1642
1643// ServerPropertiesPrivateDNSZoneArguments ...
1644type ServerPropertiesPrivateDNSZoneArguments struct {
1645	// PrivateDNSZoneArmResourceID - private dns zone arm resource id.
1646	PrivateDNSZoneArmResourceID *string `json:"privateDnsZoneArmResourceId,omitempty"`
1647}
1648
1649// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running
1650// operation.
1651type ServersCreateFuture struct {
1652	azure.FutureAPI
1653	// Result returns the result of the asynchronous operation.
1654	// If the operation has not completed it will return an error.
1655	Result func(ServersClient) (Server, error)
1656}
1657
1658// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1659func (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// result is the default implementation for ServersCreateFuture.Result.
1670func (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// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1693// operation.
1694type ServersDeleteFuture struct {
1695	azure.FutureAPI
1696	// Result returns the result of the asynchronous operation.
1697	// If the operation has not completed it will return an error.
1698	Result func(ServersClient) (autorest.Response, error)
1699}
1700
1701// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1702func (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// result is the default implementation for ServersDeleteFuture.Result.
1713func (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// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running
1730// operation.
1731type ServersRestartFuture struct {
1732	azure.FutureAPI
1733	// Result returns the result of the asynchronous operation.
1734	// If the operation has not completed it will return an error.
1735	Result func(ServersClient) (autorest.Response, error)
1736}
1737
1738// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1739func (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// result is the default implementation for ServersRestartFuture.Result.
1750func (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// ServersStartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1767type ServersStartFuture struct {
1768	azure.FutureAPI
1769	// Result returns the result of the asynchronous operation.
1770	// If the operation has not completed it will return an error.
1771	Result func(ServersClient) (autorest.Response, error)
1772}
1773
1774// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1775func (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// result is the default implementation for ServersStartFuture.Result.
1786func (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// ServersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1803type ServersStopFuture struct {
1804	azure.FutureAPI
1805	// Result returns the result of the asynchronous operation.
1806	// If the operation has not completed it will return an error.
1807	Result func(ServersClient) (autorest.Response, error)
1808}
1809
1810// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1811func (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// result is the default implementation for ServersStopFuture.Result.
1822func (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// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1839// operation.
1840type ServersUpdateFuture struct {
1841	azure.FutureAPI
1842	// Result returns the result of the asynchronous operation.
1843	// If the operation has not completed it will return an error.
1844	Result func(ServersClient) (Server, error)
1845}
1846
1847// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1848func (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// result is the default implementation for ServersUpdateFuture.Result.
1859func (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// ServerVersionCapability server version capabilities.
1882type ServerVersionCapability struct {
1883	// Name - READ-ONLY; server version
1884	Name *string `json:"name,omitempty"`
1885	// SupportedVcores - READ-ONLY
1886	SupportedVcores *[]VcoreCapability `json:"supportedVcores,omitempty"`
1887}
1888
1889// MarshalJSON is the custom marshaler for ServerVersionCapability.
1890func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) {
1891	objectMap := make(map[string]interface{})
1892	return json.Marshal(objectMap)
1893}
1894
1895// Sku sku information related properties of a server.
1896type Sku struct {
1897	// Name - The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3.
1898	Name *string `json:"name,omitempty"`
1899	// Tier - The tier of the particular SKU, e.g. Burstable. Possible values include: 'Burstable', 'GeneralPurpose', 'MemoryOptimized'
1900	Tier SkuTier `json:"tier,omitempty"`
1901}
1902
1903// StorageEditionCapability storage edition capability
1904type StorageEditionCapability struct {
1905	// Name - READ-ONLY; storage edition name
1906	Name *string `json:"name,omitempty"`
1907	// SupportedStorageMB - READ-ONLY
1908	SupportedStorageMB *[]StorageMBCapability `json:"supportedStorageMB,omitempty"`
1909}
1910
1911// MarshalJSON is the custom marshaler for StorageEditionCapability.
1912func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) {
1913	objectMap := make(map[string]interface{})
1914	return json.Marshal(objectMap)
1915}
1916
1917// StorageMBCapability storage size in MB capability
1918type StorageMBCapability struct {
1919	// Name - READ-ONLY; storage MB name
1920	Name *string `json:"name,omitempty"`
1921	// SupportedIops - READ-ONLY; supported IOPS
1922	SupportedIops *int64 `json:"supportedIops,omitempty"`
1923	// StorageSizeMB - READ-ONLY; storage size in MB
1924	StorageSizeMB *int64 `json:"storageSizeMB,omitempty"`
1925}
1926
1927// MarshalJSON is the custom marshaler for StorageMBCapability.
1928func (smc StorageMBCapability) MarshalJSON() ([]byte, error) {
1929	objectMap := make(map[string]interface{})
1930	return json.Marshal(objectMap)
1931}
1932
1933// StorageProfile storage Profile properties of a server
1934type StorageProfile struct {
1935	// BackupRetentionDays - Backup retention days for the server.
1936	BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
1937	// StorageMB - Max storage allowed for a server.
1938	StorageMB *int32 `json:"storageMB,omitempty"`
1939}
1940
1941// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource
1942// which has 'tags' and a 'location'
1943type TrackedResource struct {
1944	// Tags - Resource tags.
1945	Tags map[string]*string `json:"tags"`
1946	// Location - The geo-location where the resource lives
1947	Location *string `json:"location,omitempty"`
1948	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1949	ID *string `json:"id,omitempty"`
1950	// Name - READ-ONLY; The name of the resource
1951	Name *string `json:"name,omitempty"`
1952	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1953	Type *string `json:"type,omitempty"`
1954}
1955
1956// MarshalJSON is the custom marshaler for TrackedResource.
1957func (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// VcoreCapability vcores capability
1969type VcoreCapability struct {
1970	// Name - READ-ONLY; vCore name
1971	Name *string `json:"name,omitempty"`
1972	// VCores - READ-ONLY; supported vCores
1973	VCores *int64 `json:"vCores,omitempty"`
1974	// SupportedIops - READ-ONLY; supported IOPS
1975	SupportedIops *int64 `json:"supportedIops,omitempty"`
1976	// SupportedMemoryPerVcoreMB - READ-ONLY; supported memory per vCore in MB
1977	SupportedMemoryPerVcoreMB *int64 `json:"supportedMemoryPerVcoreMB,omitempty"`
1978}
1979
1980// MarshalJSON is the custom marshaler for VcoreCapability.
1981func (vc VcoreCapability) MarshalJSON() ([]byte, error) {
1982	objectMap := make(map[string]interface{})
1983	return json.Marshal(objectMap)
1984}
1985
1986// VirtualNetworkSubnetUsageParameter virtual network subnet usage parameter
1987type VirtualNetworkSubnetUsageParameter struct {
1988	// VirtualNetworkArmResourceID - Virtual network resource id.
1989	VirtualNetworkArmResourceID *string `json:"virtualNetworkArmResourceId,omitempty"`
1990}
1991
1992// VirtualNetworkSubnetUsageResult virtual network subnet usage data.
1993type VirtualNetworkSubnetUsageResult struct {
1994	autorest.Response `json:"-"`
1995	// DelegatedSubnetsUsage - READ-ONLY
1996	DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"`
1997}
1998
1999// MarshalJSON is the custom marshaler for VirtualNetworkSubnetUsageResult.
2000func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) {
2001	objectMap := make(map[string]interface{})
2002	return json.Marshal(objectMap)
2003}
2004