...

Source file src/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers

     1  package 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  
     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  // The package's fully qualified name.
    21  const fqdn = "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers"
    22  
    23  // AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag.
    24  type 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.
    36  func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
    37  	objectMap := make(map[string]interface{})
    38  	return json.Marshal(objectMap)
    39  }
    40  
    41  // Backup backup properties of a server
    42  type Backup struct {
    43  	// BackupRetentionDays - Backup retention days for the server.
    44  	BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
    45  	// GeoRedundantBackup - A value indicating whether Geo-Redundant backup is enabled on the server. Possible values include: 'GeoRedundantBackupEnumEnabled', 'GeoRedundantBackupEnumDisabled'
    46  	GeoRedundantBackup GeoRedundantBackupEnum `json:"geoRedundantBackup,omitempty"`
    47  	// EarliestRestoreDate - READ-ONLY; The earliest restore point time (ISO8601 format) for server.
    48  	EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"`
    49  }
    50  
    51  // MarshalJSON is the custom marshaler for Backup.
    52  func (b Backup) MarshalJSON() ([]byte, error) {
    53  	objectMap := make(map[string]interface{})
    54  	if b.BackupRetentionDays != nil {
    55  		objectMap["backupRetentionDays"] = b.BackupRetentionDays
    56  	}
    57  	if b.GeoRedundantBackup != "" {
    58  		objectMap["geoRedundantBackup"] = b.GeoRedundantBackup
    59  	}
    60  	return json.Marshal(objectMap)
    61  }
    62  
    63  // CapabilitiesListResult location capability
    64  type CapabilitiesListResult struct {
    65  	autorest.Response `json:"-"`
    66  	// Value - READ-ONLY; A list of supported capabilities.
    67  	Value *[]CapabilityProperties `json:"value,omitempty"`
    68  	// NextLink - READ-ONLY; Link to retrieve next page of results.
    69  	NextLink *string `json:"nextLink,omitempty"`
    70  }
    71  
    72  // MarshalJSON is the custom marshaler for CapabilitiesListResult.
    73  func (clr CapabilitiesListResult) MarshalJSON() ([]byte, error) {
    74  	objectMap := make(map[string]interface{})
    75  	return json.Marshal(objectMap)
    76  }
    77  
    78  // CapabilitiesListResultIterator provides access to a complete listing of CapabilityProperties values.
    79  type CapabilitiesListResultIterator struct {
    80  	i    int
    81  	page CapabilitiesListResultPage
    82  }
    83  
    84  // NextWithContext advances to the next value.  If there was an error making
    85  // the request the iterator does not advance and the error is returned.
    86  func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) {
    87  	if tracing.IsEnabled() {
    88  		ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext")
    89  		defer func() {
    90  			sc := -1
    91  			if iter.Response().Response.Response != nil {
    92  				sc = iter.Response().Response.Response.StatusCode
    93  			}
    94  			tracing.EndSpan(ctx, sc, err)
    95  		}()
    96  	}
    97  	iter.i++
    98  	if iter.i < len(iter.page.Values()) {
    99  		return nil
   100  	}
   101  	err = iter.page.NextWithContext(ctx)
   102  	if err != nil {
   103  		iter.i--
   104  		return err
   105  	}
   106  	iter.i = 0
   107  	return nil
   108  }
   109  
   110  // Next advances to the next value.  If there was an error making
   111  // the request the iterator does not advance and the error is returned.
   112  // Deprecated: Use NextWithContext() instead.
   113  func (iter *CapabilitiesListResultIterator) Next() error {
   114  	return iter.NextWithContext(context.Background())
   115  }
   116  
   117  // NotDone returns true if the enumeration should be started or is not yet complete.
   118  func (iter CapabilitiesListResultIterator) NotDone() bool {
   119  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   120  }
   121  
   122  // Response returns the raw server response from the last page request.
   123  func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult {
   124  	return iter.page.Response()
   125  }
   126  
   127  // Value returns the current value or a zero-initialized value if the
   128  // iterator has advanced beyond the end of the collection.
   129  func (iter CapabilitiesListResultIterator) Value() CapabilityProperties {
   130  	if !iter.page.NotDone() {
   131  		return CapabilityProperties{}
   132  	}
   133  	return iter.page.Values()[iter.i]
   134  }
   135  
   136  // Creates a new instance of the CapabilitiesListResultIterator type.
   137  func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator {
   138  	return CapabilitiesListResultIterator{page: page}
   139  }
   140  
   141  // IsEmpty returns true if the ListResult contains no values.
   142  func (clr CapabilitiesListResult) IsEmpty() bool {
   143  	return clr.Value == nil || len(*clr.Value) == 0
   144  }
   145  
   146  // hasNextLink returns true if the NextLink is not empty.
   147  func (clr CapabilitiesListResult) hasNextLink() bool {
   148  	return clr.NextLink != nil && len(*clr.NextLink) != 0
   149  }
   150  
   151  // capabilitiesListResultPreparer prepares a request to retrieve the next set of results.
   152  // It returns nil if no more results exist.
   153  func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) {
   154  	if !clr.hasNextLink() {
   155  		return nil, nil
   156  	}
   157  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   158  		autorest.AsJSON(),
   159  		autorest.AsGet(),
   160  		autorest.WithBaseURL(to.String(clr.NextLink)))
   161  }
   162  
   163  // CapabilitiesListResultPage contains a page of CapabilityProperties values.
   164  type CapabilitiesListResultPage struct {
   165  	fn  func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)
   166  	clr CapabilitiesListResult
   167  }
   168  
   169  // NextWithContext advances to the next page of values.  If there was an error making
   170  // the request the page does not advance and the error is returned.
   171  func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) {
   172  	if tracing.IsEnabled() {
   173  		ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext")
   174  		defer func() {
   175  			sc := -1
   176  			if page.Response().Response.Response != nil {
   177  				sc = page.Response().Response.Response.StatusCode
   178  			}
   179  			tracing.EndSpan(ctx, sc, err)
   180  		}()
   181  	}
   182  	for {
   183  		next, err := page.fn(ctx, page.clr)
   184  		if err != nil {
   185  			return err
   186  		}
   187  		page.clr = next
   188  		if !next.hasNextLink() || !next.IsEmpty() {
   189  			break
   190  		}
   191  	}
   192  	return nil
   193  }
   194  
   195  // Next advances to the next page of values.  If there was an error making
   196  // the request the page does not advance and the error is returned.
   197  // Deprecated: Use NextWithContext() instead.
   198  func (page *CapabilitiesListResultPage) Next() error {
   199  	return page.NextWithContext(context.Background())
   200  }
   201  
   202  // NotDone returns true if the page enumeration should be started or is not yet complete.
   203  func (page CapabilitiesListResultPage) NotDone() bool {
   204  	return !page.clr.IsEmpty()
   205  }
   206  
   207  // Response returns the raw server response from the last page request.
   208  func (page CapabilitiesListResultPage) Response() CapabilitiesListResult {
   209  	return page.clr
   210  }
   211  
   212  // Values returns the slice of values for the current page or nil if there are no values.
   213  func (page CapabilitiesListResultPage) Values() []CapabilityProperties {
   214  	if page.clr.IsEmpty() {
   215  		return nil
   216  	}
   217  	return *page.clr.Value
   218  }
   219  
   220  // Creates a new instance of the CapabilitiesListResultPage type.
   221  func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage {
   222  	return CapabilitiesListResultPage{
   223  		fn:  getNextPage,
   224  		clr: cur,
   225  	}
   226  }
   227  
   228  // CapabilityProperties location capabilities.
   229  type CapabilityProperties struct {
   230  	// Zone - READ-ONLY; zone name
   231  	Zone *string `json:"zone,omitempty"`
   232  	// GeoBackupSupported - READ-ONLY; A value indicating whether a new server in this region can have geo-backups to paired region.
   233  	GeoBackupSupported *bool `json:"geoBackupSupported,omitempty"`
   234  	// ZoneRedundantHaSupported - READ-ONLY; A value indicating whether a new server in this region can support multi zone HA.
   235  	ZoneRedundantHaSupported *bool `json:"zoneRedundantHaSupported,omitempty"`
   236  	// ZoneRedundantHaAndGeoBackupSupported - READ-ONLY; A value indicating whether a new server in this region can have geo-backups to paired region.
   237  	ZoneRedundantHaAndGeoBackupSupported *bool `json:"zoneRedundantHaAndGeoBackupSupported,omitempty"`
   238  	// SupportedFlexibleServerEditions - READ-ONLY
   239  	SupportedFlexibleServerEditions *[]FlexibleServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"`
   240  	// SupportedHyperscaleNodeEditions - READ-ONLY
   241  	SupportedHyperscaleNodeEditions *[]HyperscaleNodeEditionCapability `json:"supportedHyperscaleNodeEditions,omitempty"`
   242  	// Status - READ-ONLY; The status
   243  	Status *string `json:"status,omitempty"`
   244  }
   245  
   246  // MarshalJSON is the custom marshaler for CapabilityProperties.
   247  func (cp CapabilityProperties) MarshalJSON() ([]byte, error) {
   248  	objectMap := make(map[string]interface{})
   249  	return json.Marshal(objectMap)
   250  }
   251  
   252  // CloudError an error response from the Batch service.
   253  type CloudError struct {
   254  	Error *ErrorResponse `json:"error,omitempty"`
   255  }
   256  
   257  // Configuration represents a Configuration.
   258  type Configuration struct {
   259  	autorest.Response `json:"-"`
   260  	// ConfigurationProperties - The properties of a configuration.
   261  	*ConfigurationProperties `json:"properties,omitempty"`
   262  	// SystemData - READ-ONLY; The system metadata relating to this resource.
   263  	SystemData *SystemData `json:"systemData,omitempty"`
   264  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
   265  	ID *string `json:"id,omitempty"`
   266  	// Name - READ-ONLY; The name of the resource
   267  	Name *string `json:"name,omitempty"`
   268  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
   269  	Type *string `json:"type,omitempty"`
   270  }
   271  
   272  // MarshalJSON is the custom marshaler for Configuration.
   273  func (c Configuration) MarshalJSON() ([]byte, error) {
   274  	objectMap := make(map[string]interface{})
   275  	if c.ConfigurationProperties != nil {
   276  		objectMap["properties"] = c.ConfigurationProperties
   277  	}
   278  	return json.Marshal(objectMap)
   279  }
   280  
   281  // UnmarshalJSON is the custom unmarshaler for Configuration struct.
   282  func (c *Configuration) UnmarshalJSON(body []byte) error {
   283  	var m map[string]*json.RawMessage
   284  	err := json.Unmarshal(body, &m)
   285  	if err != nil {
   286  		return err
   287  	}
   288  	for k, v := range m {
   289  		switch k {
   290  		case "properties":
   291  			if v != nil {
   292  				var configurationProperties ConfigurationProperties
   293  				err = json.Unmarshal(*v, &configurationProperties)
   294  				if err != nil {
   295  					return err
   296  				}
   297  				c.ConfigurationProperties = &configurationProperties
   298  			}
   299  		case "systemData":
   300  			if v != nil {
   301  				var systemData SystemData
   302  				err = json.Unmarshal(*v, &systemData)
   303  				if err != nil {
   304  					return err
   305  				}
   306  				c.SystemData = &systemData
   307  			}
   308  		case "id":
   309  			if v != nil {
   310  				var ID string
   311  				err = json.Unmarshal(*v, &ID)
   312  				if err != nil {
   313  					return err
   314  				}
   315  				c.ID = &ID
   316  			}
   317  		case "name":
   318  			if v != nil {
   319  				var name string
   320  				err = json.Unmarshal(*v, &name)
   321  				if err != nil {
   322  					return err
   323  				}
   324  				c.Name = &name
   325  			}
   326  		case "type":
   327  			if v != nil {
   328  				var typeVar string
   329  				err = json.Unmarshal(*v, &typeVar)
   330  				if err != nil {
   331  					return err
   332  				}
   333  				c.Type = &typeVar
   334  			}
   335  		}
   336  	}
   337  
   338  	return nil
   339  }
   340  
   341  // ConfigurationListResult a list of server configurations.
   342  type ConfigurationListResult struct {
   343  	autorest.Response `json:"-"`
   344  	// Value - The list of server configurations.
   345  	Value *[]Configuration `json:"value,omitempty"`
   346  	// NextLink - The link used to get the next page of operations.
   347  	NextLink *string `json:"nextLink,omitempty"`
   348  }
   349  
   350  // ConfigurationListResultIterator provides access to a complete listing of Configuration values.
   351  type ConfigurationListResultIterator struct {
   352  	i    int
   353  	page ConfigurationListResultPage
   354  }
   355  
   356  // NextWithContext advances to the next value.  If there was an error making
   357  // the request the iterator does not advance and the error is returned.
   358  func (iter *ConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   359  	if tracing.IsEnabled() {
   360  		ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultIterator.NextWithContext")
   361  		defer func() {
   362  			sc := -1
   363  			if iter.Response().Response.Response != nil {
   364  				sc = iter.Response().Response.Response.StatusCode
   365  			}
   366  			tracing.EndSpan(ctx, sc, err)
   367  		}()
   368  	}
   369  	iter.i++
   370  	if iter.i < len(iter.page.Values()) {
   371  		return nil
   372  	}
   373  	err = iter.page.NextWithContext(ctx)
   374  	if err != nil {
   375  		iter.i--
   376  		return err
   377  	}
   378  	iter.i = 0
   379  	return nil
   380  }
   381  
   382  // Next advances to the next value.  If there was an error making
   383  // the request the iterator does not advance and the error is returned.
   384  // Deprecated: Use NextWithContext() instead.
   385  func (iter *ConfigurationListResultIterator) Next() error {
   386  	return iter.NextWithContext(context.Background())
   387  }
   388  
   389  // NotDone returns true if the enumeration should be started or is not yet complete.
   390  func (iter ConfigurationListResultIterator) NotDone() bool {
   391  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   392  }
   393  
   394  // Response returns the raw server response from the last page request.
   395  func (iter ConfigurationListResultIterator) Response() ConfigurationListResult {
   396  	return iter.page.Response()
   397  }
   398  
   399  // Value returns the current value or a zero-initialized value if the
   400  // iterator has advanced beyond the end of the collection.
   401  func (iter ConfigurationListResultIterator) Value() Configuration {
   402  	if !iter.page.NotDone() {
   403  		return Configuration{}
   404  	}
   405  	return iter.page.Values()[iter.i]
   406  }
   407  
   408  // Creates a new instance of the ConfigurationListResultIterator type.
   409  func NewConfigurationListResultIterator(page ConfigurationListResultPage) ConfigurationListResultIterator {
   410  	return ConfigurationListResultIterator{page: page}
   411  }
   412  
   413  // IsEmpty returns true if the ListResult contains no values.
   414  func (clr ConfigurationListResult) IsEmpty() bool {
   415  	return clr.Value == nil || len(*clr.Value) == 0
   416  }
   417  
   418  // hasNextLink returns true if the NextLink is not empty.
   419  func (clr ConfigurationListResult) hasNextLink() bool {
   420  	return clr.NextLink != nil && len(*clr.NextLink) != 0
   421  }
   422  
   423  // configurationListResultPreparer prepares a request to retrieve the next set of results.
   424  // It returns nil if no more results exist.
   425  func (clr ConfigurationListResult) configurationListResultPreparer(ctx context.Context) (*http.Request, error) {
   426  	if !clr.hasNextLink() {
   427  		return nil, nil
   428  	}
   429  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   430  		autorest.AsJSON(),
   431  		autorest.AsGet(),
   432  		autorest.WithBaseURL(to.String(clr.NextLink)))
   433  }
   434  
   435  // ConfigurationListResultPage contains a page of Configuration values.
   436  type ConfigurationListResultPage struct {
   437  	fn  func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)
   438  	clr ConfigurationListResult
   439  }
   440  
   441  // NextWithContext advances to the next page of values.  If there was an error making
   442  // the request the page does not advance and the error is returned.
   443  func (page *ConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) {
   444  	if tracing.IsEnabled() {
   445  		ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultPage.NextWithContext")
   446  		defer func() {
   447  			sc := -1
   448  			if page.Response().Response.Response != nil {
   449  				sc = page.Response().Response.Response.StatusCode
   450  			}
   451  			tracing.EndSpan(ctx, sc, err)
   452  		}()
   453  	}
   454  	for {
   455  		next, err := page.fn(ctx, page.clr)
   456  		if err != nil {
   457  			return err
   458  		}
   459  		page.clr = next
   460  		if !next.hasNextLink() || !next.IsEmpty() {
   461  			break
   462  		}
   463  	}
   464  	return nil
   465  }
   466  
   467  // Next advances to the next page of values.  If there was an error making
   468  // the request the page does not advance and the error is returned.
   469  // Deprecated: Use NextWithContext() instead.
   470  func (page *ConfigurationListResultPage) Next() error {
   471  	return page.NextWithContext(context.Background())
   472  }
   473  
   474  // NotDone returns true if the page enumeration should be started or is not yet complete.
   475  func (page ConfigurationListResultPage) NotDone() bool {
   476  	return !page.clr.IsEmpty()
   477  }
   478  
   479  // Response returns the raw server response from the last page request.
   480  func (page ConfigurationListResultPage) Response() ConfigurationListResult {
   481  	return page.clr
   482  }
   483  
   484  // Values returns the slice of values for the current page or nil if there are no values.
   485  func (page ConfigurationListResultPage) Values() []Configuration {
   486  	if page.clr.IsEmpty() {
   487  		return nil
   488  	}
   489  	return *page.clr.Value
   490  }
   491  
   492  // Creates a new instance of the ConfigurationListResultPage type.
   493  func NewConfigurationListResultPage(cur ConfigurationListResult, getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage {
   494  	return ConfigurationListResultPage{
   495  		fn:  getNextPage,
   496  		clr: cur,
   497  	}
   498  }
   499  
   500  // ConfigurationProperties the properties of a configuration.
   501  type ConfigurationProperties struct {
   502  	// Value - Value of the configuration.
   503  	Value *string `json:"value,omitempty"`
   504  	// Description - READ-ONLY; Description of the configuration.
   505  	Description *string `json:"description,omitempty"`
   506  	// DefaultValue - READ-ONLY; Default value of the configuration.
   507  	DefaultValue *string `json:"defaultValue,omitempty"`
   508  	// DataType - READ-ONLY; Data type of the configuration. Possible values include: 'ConfigurationDataTypeBoolean', 'ConfigurationDataTypeNumeric', 'ConfigurationDataTypeInteger', 'ConfigurationDataTypeEnumeration'
   509  	DataType ConfigurationDataType `json:"dataType,omitempty"`
   510  	// AllowedValues - READ-ONLY; Allowed values of the configuration.
   511  	AllowedValues *string `json:"allowedValues,omitempty"`
   512  	// Source - Source of the configuration.
   513  	Source *string `json:"source,omitempty"`
   514  }
   515  
   516  // MarshalJSON is the custom marshaler for ConfigurationProperties.
   517  func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) {
   518  	objectMap := make(map[string]interface{})
   519  	if cp.Value != nil {
   520  		objectMap["value"] = cp.Value
   521  	}
   522  	if cp.Source != nil {
   523  		objectMap["source"] = cp.Source
   524  	}
   525  	return json.Marshal(objectMap)
   526  }
   527  
   528  // ConfigurationsPutFuture an abstraction for monitoring and retrieving the results of a long-running
   529  // operation.
   530  type ConfigurationsPutFuture struct {
   531  	azure.FutureAPI
   532  	// Result returns the result of the asynchronous operation.
   533  	// If the operation has not completed it will return an error.
   534  	Result func(ConfigurationsClient) (Configuration, error)
   535  }
   536  
   537  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   538  func (future *ConfigurationsPutFuture) UnmarshalJSON(body []byte) error {
   539  	var azFuture azure.Future
   540  	if err := json.Unmarshal(body, &azFuture); err != nil {
   541  		return err
   542  	}
   543  	future.FutureAPI = &azFuture
   544  	future.Result = future.result
   545  	return nil
   546  }
   547  
   548  // result is the default implementation for ConfigurationsPutFuture.Result.
   549  func (future *ConfigurationsPutFuture) result(client ConfigurationsClient) (c Configuration, err error) {
   550  	var done bool
   551  	done, err = future.DoneWithContext(context.Background(), client)
   552  	if err != nil {
   553  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsPutFuture", "Result", future.Response(), "Polling failure")
   554  		return
   555  	}
   556  	if !done {
   557  		c.Response.Response = future.Response()
   558  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ConfigurationsPutFuture")
   559  		return
   560  	}
   561  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   562  	if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
   563  		c, err = client.PutResponder(c.Response.Response)
   564  		if err != nil {
   565  			err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsPutFuture", "Result", c.Response.Response, "Failure responding to request")
   566  		}
   567  	}
   568  	return
   569  }
   570  
   571  // ConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
   572  // operation.
   573  type ConfigurationsUpdateFuture struct {
   574  	azure.FutureAPI
   575  	// Result returns the result of the asynchronous operation.
   576  	// If the operation has not completed it will return an error.
   577  	Result func(ConfigurationsClient) (Configuration, error)
   578  }
   579  
   580  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   581  func (future *ConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error {
   582  	var azFuture azure.Future
   583  	if err := json.Unmarshal(body, &azFuture); err != nil {
   584  		return err
   585  	}
   586  	future.FutureAPI = &azFuture
   587  	future.Result = future.result
   588  	return nil
   589  }
   590  
   591  // result is the default implementation for ConfigurationsUpdateFuture.Result.
   592  func (future *ConfigurationsUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) {
   593  	var done bool
   594  	done, err = future.DoneWithContext(context.Background(), client)
   595  	if err != nil {
   596  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure")
   597  		return
   598  	}
   599  	if !done {
   600  		c.Response.Response = future.Response()
   601  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ConfigurationsUpdateFuture")
   602  		return
   603  	}
   604  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   605  	if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
   606  		c, err = client.UpdateResponder(c.Response.Response)
   607  		if err != nil {
   608  			err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
   609  		}
   610  	}
   611  	return
   612  }
   613  
   614  // Database represents a Database.
   615  type Database struct {
   616  	autorest.Response `json:"-"`
   617  	// DatabaseProperties - The properties of a database.
   618  	*DatabaseProperties `json:"properties,omitempty"`
   619  	// SystemData - READ-ONLY; The system metadata relating to this resource.
   620  	SystemData *SystemData `json:"systemData,omitempty"`
   621  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
   622  	ID *string `json:"id,omitempty"`
   623  	// Name - READ-ONLY; The name of the resource
   624  	Name *string `json:"name,omitempty"`
   625  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
   626  	Type *string `json:"type,omitempty"`
   627  }
   628  
   629  // MarshalJSON is the custom marshaler for Database.
   630  func (d Database) MarshalJSON() ([]byte, error) {
   631  	objectMap := make(map[string]interface{})
   632  	if d.DatabaseProperties != nil {
   633  		objectMap["properties"] = d.DatabaseProperties
   634  	}
   635  	return json.Marshal(objectMap)
   636  }
   637  
   638  // UnmarshalJSON is the custom unmarshaler for Database struct.
   639  func (d *Database) UnmarshalJSON(body []byte) error {
   640  	var m map[string]*json.RawMessage
   641  	err := json.Unmarshal(body, &m)
   642  	if err != nil {
   643  		return err
   644  	}
   645  	for k, v := range m {
   646  		switch k {
   647  		case "properties":
   648  			if v != nil {
   649  				var databaseProperties DatabaseProperties
   650  				err = json.Unmarshal(*v, &databaseProperties)
   651  				if err != nil {
   652  					return err
   653  				}
   654  				d.DatabaseProperties = &databaseProperties
   655  			}
   656  		case "systemData":
   657  			if v != nil {
   658  				var systemData SystemData
   659  				err = json.Unmarshal(*v, &systemData)
   660  				if err != nil {
   661  					return err
   662  				}
   663  				d.SystemData = &systemData
   664  			}
   665  		case "id":
   666  			if v != nil {
   667  				var ID string
   668  				err = json.Unmarshal(*v, &ID)
   669  				if err != nil {
   670  					return err
   671  				}
   672  				d.ID = &ID
   673  			}
   674  		case "name":
   675  			if v != nil {
   676  				var name string
   677  				err = json.Unmarshal(*v, &name)
   678  				if err != nil {
   679  					return err
   680  				}
   681  				d.Name = &name
   682  			}
   683  		case "type":
   684  			if v != nil {
   685  				var typeVar string
   686  				err = json.Unmarshal(*v, &typeVar)
   687  				if err != nil {
   688  					return err
   689  				}
   690  				d.Type = &typeVar
   691  			}
   692  		}
   693  	}
   694  
   695  	return nil
   696  }
   697  
   698  // DatabaseListResult a List of databases.
   699  type DatabaseListResult struct {
   700  	autorest.Response `json:"-"`
   701  	// Value - The list of databases housed in a server
   702  	Value *[]Database `json:"value,omitempty"`
   703  	// NextLink - The link used to get the next page of databases.
   704  	NextLink *string `json:"nextLink,omitempty"`
   705  }
   706  
   707  // DatabaseListResultIterator provides access to a complete listing of Database values.
   708  type DatabaseListResultIterator struct {
   709  	i    int
   710  	page DatabaseListResultPage
   711  }
   712  
   713  // NextWithContext advances to the next value.  If there was an error making
   714  // the request the iterator does not advance and the error is returned.
   715  func (iter *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) {
   716  	if tracing.IsEnabled() {
   717  		ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.NextWithContext")
   718  		defer func() {
   719  			sc := -1
   720  			if iter.Response().Response.Response != nil {
   721  				sc = iter.Response().Response.Response.StatusCode
   722  			}
   723  			tracing.EndSpan(ctx, sc, err)
   724  		}()
   725  	}
   726  	iter.i++
   727  	if iter.i < len(iter.page.Values()) {
   728  		return nil
   729  	}
   730  	err = iter.page.NextWithContext(ctx)
   731  	if err != nil {
   732  		iter.i--
   733  		return err
   734  	}
   735  	iter.i = 0
   736  	return nil
   737  }
   738  
   739  // Next advances to the next value.  If there was an error making
   740  // the request the iterator does not advance and the error is returned.
   741  // Deprecated: Use NextWithContext() instead.
   742  func (iter *DatabaseListResultIterator) Next() error {
   743  	return iter.NextWithContext(context.Background())
   744  }
   745  
   746  // NotDone returns true if the enumeration should be started or is not yet complete.
   747  func (iter DatabaseListResultIterator) NotDone() bool {
   748  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   749  }
   750  
   751  // Response returns the raw server response from the last page request.
   752  func (iter DatabaseListResultIterator) Response() DatabaseListResult {
   753  	return iter.page.Response()
   754  }
   755  
   756  // Value returns the current value or a zero-initialized value if the
   757  // iterator has advanced beyond the end of the collection.
   758  func (iter DatabaseListResultIterator) Value() Database {
   759  	if !iter.page.NotDone() {
   760  		return Database{}
   761  	}
   762  	return iter.page.Values()[iter.i]
   763  }
   764  
   765  // Creates a new instance of the DatabaseListResultIterator type.
   766  func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator {
   767  	return DatabaseListResultIterator{page: page}
   768  }
   769  
   770  // IsEmpty returns true if the ListResult contains no values.
   771  func (dlr DatabaseListResult) IsEmpty() bool {
   772  	return dlr.Value == nil || len(*dlr.Value) == 0
   773  }
   774  
   775  // hasNextLink returns true if the NextLink is not empty.
   776  func (dlr DatabaseListResult) hasNextLink() bool {
   777  	return dlr.NextLink != nil && len(*dlr.NextLink) != 0
   778  }
   779  
   780  // databaseListResultPreparer prepares a request to retrieve the next set of results.
   781  // It returns nil if no more results exist.
   782  func (dlr DatabaseListResult) databaseListResultPreparer(ctx context.Context) (*http.Request, error) {
   783  	if !dlr.hasNextLink() {
   784  		return nil, nil
   785  	}
   786  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   787  		autorest.AsJSON(),
   788  		autorest.AsGet(),
   789  		autorest.WithBaseURL(to.String(dlr.NextLink)))
   790  }
   791  
   792  // DatabaseListResultPage contains a page of Database values.
   793  type DatabaseListResultPage struct {
   794  	fn  func(context.Context, DatabaseListResult) (DatabaseListResult, error)
   795  	dlr DatabaseListResult
   796  }
   797  
   798  // NextWithContext advances to the next page of values.  If there was an error making
   799  // the request the page does not advance and the error is returned.
   800  func (page *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) {
   801  	if tracing.IsEnabled() {
   802  		ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.NextWithContext")
   803  		defer func() {
   804  			sc := -1
   805  			if page.Response().Response.Response != nil {
   806  				sc = page.Response().Response.Response.StatusCode
   807  			}
   808  			tracing.EndSpan(ctx, sc, err)
   809  		}()
   810  	}
   811  	for {
   812  		next, err := page.fn(ctx, page.dlr)
   813  		if err != nil {
   814  			return err
   815  		}
   816  		page.dlr = next
   817  		if !next.hasNextLink() || !next.IsEmpty() {
   818  			break
   819  		}
   820  	}
   821  	return nil
   822  }
   823  
   824  // Next advances to the next page of values.  If there was an error making
   825  // the request the page does not advance and the error is returned.
   826  // Deprecated: Use NextWithContext() instead.
   827  func (page *DatabaseListResultPage) Next() error {
   828  	return page.NextWithContext(context.Background())
   829  }
   830  
   831  // NotDone returns true if the page enumeration should be started or is not yet complete.
   832  func (page DatabaseListResultPage) NotDone() bool {
   833  	return !page.dlr.IsEmpty()
   834  }
   835  
   836  // Response returns the raw server response from the last page request.
   837  func (page DatabaseListResultPage) Response() DatabaseListResult {
   838  	return page.dlr
   839  }
   840  
   841  // Values returns the slice of values for the current page or nil if there are no values.
   842  func (page DatabaseListResultPage) Values() []Database {
   843  	if page.dlr.IsEmpty() {
   844  		return nil
   845  	}
   846  	return *page.dlr.Value
   847  }
   848  
   849  // Creates a new instance of the DatabaseListResultPage type.
   850  func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage {
   851  	return DatabaseListResultPage{
   852  		fn:  getNextPage,
   853  		dlr: cur,
   854  	}
   855  }
   856  
   857  // DatabaseProperties the properties of a database.
   858  type DatabaseProperties struct {
   859  	// Charset - The charset of the database.
   860  	Charset *string `json:"charset,omitempty"`
   861  	// Collation - The collation of the database.
   862  	Collation *string `json:"collation,omitempty"`
   863  }
   864  
   865  // DatabasesCreateFuture an abstraction for monitoring and retrieving the results of a long-running
   866  // operation.
   867  type DatabasesCreateFuture struct {
   868  	azure.FutureAPI
   869  	// Result returns the result of the asynchronous operation.
   870  	// If the operation has not completed it will return an error.
   871  	Result func(DatabasesClient) (Database, error)
   872  }
   873  
   874  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   875  func (future *DatabasesCreateFuture) UnmarshalJSON(body []byte) error {
   876  	var azFuture azure.Future
   877  	if err := json.Unmarshal(body, &azFuture); err != nil {
   878  		return err
   879  	}
   880  	future.FutureAPI = &azFuture
   881  	future.Result = future.result
   882  	return nil
   883  }
   884  
   885  // result is the default implementation for DatabasesCreateFuture.Result.
   886  func (future *DatabasesCreateFuture) result(client DatabasesClient) (d Database, err error) {
   887  	var done bool
   888  	done, err = future.DoneWithContext(context.Background(), client)
   889  	if err != nil {
   890  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesCreateFuture", "Result", future.Response(), "Polling failure")
   891  		return
   892  	}
   893  	if !done {
   894  		d.Response.Response = future.Response()
   895  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.DatabasesCreateFuture")
   896  		return
   897  	}
   898  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   899  	if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
   900  		d, err = client.CreateResponder(d.Response.Response)
   901  		if err != nil {
   902  			err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesCreateFuture", "Result", d.Response.Response, "Failure responding to request")
   903  		}
   904  	}
   905  	return
   906  }
   907  
   908  // DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
   909  // operation.
   910  type DatabasesDeleteFuture struct {
   911  	azure.FutureAPI
   912  	// Result returns the result of the asynchronous operation.
   913  	// If the operation has not completed it will return an error.
   914  	Result func(DatabasesClient) (autorest.Response, error)
   915  }
   916  
   917  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   918  func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error {
   919  	var azFuture azure.Future
   920  	if err := json.Unmarshal(body, &azFuture); err != nil {
   921  		return err
   922  	}
   923  	future.FutureAPI = &azFuture
   924  	future.Result = future.result
   925  	return nil
   926  }
   927  
   928  // result is the default implementation for DatabasesDeleteFuture.Result.
   929  func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) {
   930  	var done bool
   931  	done, err = future.DoneWithContext(context.Background(), client)
   932  	if err != nil {
   933  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
   934  		return
   935  	}
   936  	if !done {
   937  		ar.Response = future.Response()
   938  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.DatabasesDeleteFuture")
   939  		return
   940  	}
   941  	ar.Response = future.Response()
   942  	return
   943  }
   944  
   945  // DelegatedSubnetUsage delegated subnet usage data.
   946  type DelegatedSubnetUsage struct {
   947  	// SubnetName - READ-ONLY; name of the subnet
   948  	SubnetName *string `json:"subnetName,omitempty"`
   949  	// Usage - READ-ONLY; Number of used delegated subnets
   950  	Usage *int64 `json:"usage,omitempty"`
   951  }
   952  
   953  // MarshalJSON is the custom marshaler for DelegatedSubnetUsage.
   954  func (dsu DelegatedSubnetUsage) MarshalJSON() ([]byte, error) {
   955  	objectMap := make(map[string]interface{})
   956  	return json.Marshal(objectMap)
   957  }
   958  
   959  // ErrorAdditionalInfo the resource management error additional info.
   960  type ErrorAdditionalInfo struct {
   961  	// Type - READ-ONLY; The additional info type.
   962  	Type *string `json:"type,omitempty"`
   963  	// Info - READ-ONLY; The additional info.
   964  	Info interface{} `json:"info,omitempty"`
   965  }
   966  
   967  // MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
   968  func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
   969  	objectMap := make(map[string]interface{})
   970  	return json.Marshal(objectMap)
   971  }
   972  
   973  // ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
   974  // failed operations. (This also follows the OData error response format.)
   975  type ErrorResponse struct {
   976  	// Code - READ-ONLY; The error code.
   977  	Code *string `json:"code,omitempty"`
   978  	// Message - READ-ONLY; The error message.
   979  	Message *string `json:"message,omitempty"`
   980  	// Target - READ-ONLY; The error target.
   981  	Target *string `json:"target,omitempty"`
   982  	// Details - READ-ONLY; The error details.
   983  	Details *[]ErrorResponse `json:"details,omitempty"`
   984  	// AdditionalInfo - READ-ONLY; The error additional info.
   985  	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
   986  }
   987  
   988  // MarshalJSON is the custom marshaler for ErrorResponse.
   989  func (er ErrorResponse) MarshalJSON() ([]byte, error) {
   990  	objectMap := make(map[string]interface{})
   991  	return json.Marshal(objectMap)
   992  }
   993  
   994  // FirewallRule represents a server firewall rule.
   995  type FirewallRule struct {
   996  	autorest.Response `json:"-"`
   997  	// FirewallRuleProperties - The properties of a firewall rule.
   998  	*FirewallRuleProperties `json:"properties,omitempty"`
   999  	// SystemData - READ-ONLY; The system metadata relating to this resource.
  1000  	SystemData *SystemData `json:"systemData,omitempty"`
  1001  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1002  	ID *string `json:"id,omitempty"`
  1003  	// Name - READ-ONLY; The name of the resource
  1004  	Name *string `json:"name,omitempty"`
  1005  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1006  	Type *string `json:"type,omitempty"`
  1007  }
  1008  
  1009  // MarshalJSON is the custom marshaler for FirewallRule.
  1010  func (fr FirewallRule) MarshalJSON() ([]byte, error) {
  1011  	objectMap := make(map[string]interface{})
  1012  	if fr.FirewallRuleProperties != nil {
  1013  		objectMap["properties"] = fr.FirewallRuleProperties
  1014  	}
  1015  	return json.Marshal(objectMap)
  1016  }
  1017  
  1018  // UnmarshalJSON is the custom unmarshaler for FirewallRule struct.
  1019  func (fr *FirewallRule) UnmarshalJSON(body []byte) error {
  1020  	var m map[string]*json.RawMessage
  1021  	err := json.Unmarshal(body, &m)
  1022  	if err != nil {
  1023  		return err
  1024  	}
  1025  	for k, v := range m {
  1026  		switch k {
  1027  		case "properties":
  1028  			if v != nil {
  1029  				var firewallRuleProperties FirewallRuleProperties
  1030  				err = json.Unmarshal(*v, &firewallRuleProperties)
  1031  				if err != nil {
  1032  					return err
  1033  				}
  1034  				fr.FirewallRuleProperties = &firewallRuleProperties
  1035  			}
  1036  		case "systemData":
  1037  			if v != nil {
  1038  				var systemData SystemData
  1039  				err = json.Unmarshal(*v, &systemData)
  1040  				if err != nil {
  1041  					return err
  1042  				}
  1043  				fr.SystemData = &systemData
  1044  			}
  1045  		case "id":
  1046  			if v != nil {
  1047  				var ID string
  1048  				err = json.Unmarshal(*v, &ID)
  1049  				if err != nil {
  1050  					return err
  1051  				}
  1052  				fr.ID = &ID
  1053  			}
  1054  		case "name":
  1055  			if v != nil {
  1056  				var name string
  1057  				err = json.Unmarshal(*v, &name)
  1058  				if err != nil {
  1059  					return err
  1060  				}
  1061  				fr.Name = &name
  1062  			}
  1063  		case "type":
  1064  			if v != nil {
  1065  				var typeVar string
  1066  				err = json.Unmarshal(*v, &typeVar)
  1067  				if err != nil {
  1068  					return err
  1069  				}
  1070  				fr.Type = &typeVar
  1071  			}
  1072  		}
  1073  	}
  1074  
  1075  	return nil
  1076  }
  1077  
  1078  // FirewallRuleListResult a list of firewall rules.
  1079  type FirewallRuleListResult struct {
  1080  	autorest.Response `json:"-"`
  1081  	// Value - The list of firewall rules in a server.
  1082  	Value *[]FirewallRule `json:"value,omitempty"`
  1083  	// NextLink - The link used to get the next page of operations.
  1084  	NextLink *string `json:"nextLink,omitempty"`
  1085  }
  1086  
  1087  // FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values.
  1088  type FirewallRuleListResultIterator struct {
  1089  	i    int
  1090  	page FirewallRuleListResultPage
  1091  }
  1092  
  1093  // NextWithContext advances to the next value.  If there was an error making
  1094  // the request the iterator does not advance and the error is returned.
  1095  func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1096  	if tracing.IsEnabled() {
  1097  		ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext")
  1098  		defer func() {
  1099  			sc := -1
  1100  			if iter.Response().Response.Response != nil {
  1101  				sc = iter.Response().Response.Response.StatusCode
  1102  			}
  1103  			tracing.EndSpan(ctx, sc, err)
  1104  		}()
  1105  	}
  1106  	iter.i++
  1107  	if iter.i < len(iter.page.Values()) {
  1108  		return nil
  1109  	}
  1110  	err = iter.page.NextWithContext(ctx)
  1111  	if err != nil {
  1112  		iter.i--
  1113  		return err
  1114  	}
  1115  	iter.i = 0
  1116  	return nil
  1117  }
  1118  
  1119  // Next advances to the next value.  If there was an error making
  1120  // the request the iterator does not advance and the error is returned.
  1121  // Deprecated: Use NextWithContext() instead.
  1122  func (iter *FirewallRuleListResultIterator) Next() error {
  1123  	return iter.NextWithContext(context.Background())
  1124  }
  1125  
  1126  // NotDone returns true if the enumeration should be started or is not yet complete.
  1127  func (iter FirewallRuleListResultIterator) NotDone() bool {
  1128  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1129  }
  1130  
  1131  // Response returns the raw server response from the last page request.
  1132  func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult {
  1133  	return iter.page.Response()
  1134  }
  1135  
  1136  // Value returns the current value or a zero-initialized value if the
  1137  // iterator has advanced beyond the end of the collection.
  1138  func (iter FirewallRuleListResultIterator) Value() FirewallRule {
  1139  	if !iter.page.NotDone() {
  1140  		return FirewallRule{}
  1141  	}
  1142  	return iter.page.Values()[iter.i]
  1143  }
  1144  
  1145  // Creates a new instance of the FirewallRuleListResultIterator type.
  1146  func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator {
  1147  	return FirewallRuleListResultIterator{page: page}
  1148  }
  1149  
  1150  // IsEmpty returns true if the ListResult contains no values.
  1151  func (frlr FirewallRuleListResult) IsEmpty() bool {
  1152  	return frlr.Value == nil || len(*frlr.Value) == 0
  1153  }
  1154  
  1155  // hasNextLink returns true if the NextLink is not empty.
  1156  func (frlr FirewallRuleListResult) hasNextLink() bool {
  1157  	return frlr.NextLink != nil && len(*frlr.NextLink) != 0
  1158  }
  1159  
  1160  // firewallRuleListResultPreparer prepares a request to retrieve the next set of results.
  1161  // It returns nil if no more results exist.
  1162  func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
  1163  	if !frlr.hasNextLink() {
  1164  		return nil, nil
  1165  	}
  1166  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1167  		autorest.AsJSON(),
  1168  		autorest.AsGet(),
  1169  		autorest.WithBaseURL(to.String(frlr.NextLink)))
  1170  }
  1171  
  1172  // FirewallRuleListResultPage contains a page of FirewallRule values.
  1173  type FirewallRuleListResultPage struct {
  1174  	fn   func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)
  1175  	frlr FirewallRuleListResult
  1176  }
  1177  
  1178  // NextWithContext advances to the next page of values.  If there was an error making
  1179  // the request the page does not advance and the error is returned.
  1180  func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
  1181  	if tracing.IsEnabled() {
  1182  		ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext")
  1183  		defer func() {
  1184  			sc := -1
  1185  			if page.Response().Response.Response != nil {
  1186  				sc = page.Response().Response.Response.StatusCode
  1187  			}
  1188  			tracing.EndSpan(ctx, sc, err)
  1189  		}()
  1190  	}
  1191  	for {
  1192  		next, err := page.fn(ctx, page.frlr)
  1193  		if err != nil {
  1194  			return err
  1195  		}
  1196  		page.frlr = next
  1197  		if !next.hasNextLink() || !next.IsEmpty() {
  1198  			break
  1199  		}
  1200  	}
  1201  	return nil
  1202  }
  1203  
  1204  // Next advances to the next page of values.  If there was an error making
  1205  // the request the page does not advance and the error is returned.
  1206  // Deprecated: Use NextWithContext() instead.
  1207  func (page *FirewallRuleListResultPage) Next() error {
  1208  	return page.NextWithContext(context.Background())
  1209  }
  1210  
  1211  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1212  func (page FirewallRuleListResultPage) NotDone() bool {
  1213  	return !page.frlr.IsEmpty()
  1214  }
  1215  
  1216  // Response returns the raw server response from the last page request.
  1217  func (page FirewallRuleListResultPage) Response() FirewallRuleListResult {
  1218  	return page.frlr
  1219  }
  1220  
  1221  // Values returns the slice of values for the current page or nil if there are no values.
  1222  func (page FirewallRuleListResultPage) Values() []FirewallRule {
  1223  	if page.frlr.IsEmpty() {
  1224  		return nil
  1225  	}
  1226  	return *page.frlr.Value
  1227  }
  1228  
  1229  // Creates a new instance of the FirewallRuleListResultPage type.
  1230  func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {
  1231  	return FirewallRuleListResultPage{
  1232  		fn:   getNextPage,
  1233  		frlr: cur,
  1234  	}
  1235  }
  1236  
  1237  // FirewallRuleProperties the properties of a server firewall rule.
  1238  type FirewallRuleProperties struct {
  1239  	// StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format.
  1240  	StartIPAddress *string `json:"startIpAddress,omitempty"`
  1241  	// EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format.
  1242  	EndIPAddress *string `json:"endIpAddress,omitempty"`
  1243  }
  1244  
  1245  // FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1246  // long-running operation.
  1247  type FirewallRulesCreateOrUpdateFuture struct {
  1248  	azure.FutureAPI
  1249  	// Result returns the result of the asynchronous operation.
  1250  	// If the operation has not completed it will return an error.
  1251  	Result func(FirewallRulesClient) (FirewallRule, error)
  1252  }
  1253  
  1254  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1255  func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1256  	var azFuture azure.Future
  1257  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1258  		return err
  1259  	}
  1260  	future.FutureAPI = &azFuture
  1261  	future.Result = future.result
  1262  	return nil
  1263  }
  1264  
  1265  // result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result.
  1266  func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) {
  1267  	var done bool
  1268  	done, err = future.DoneWithContext(context.Background(), client)
  1269  	if err != nil {
  1270  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1271  		return
  1272  	}
  1273  	if !done {
  1274  		fr.Response.Response = future.Response()
  1275  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture")
  1276  		return
  1277  	}
  1278  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1279  	if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent {
  1280  		fr, err = client.CreateOrUpdateResponder(fr.Response.Response)
  1281  		if err != nil {
  1282  			err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request")
  1283  		}
  1284  	}
  1285  	return
  1286  }
  1287  
  1288  // FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1289  // operation.
  1290  type FirewallRulesDeleteFuture struct {
  1291  	azure.FutureAPI
  1292  	// Result returns the result of the asynchronous operation.
  1293  	// If the operation has not completed it will return an error.
  1294  	Result func(FirewallRulesClient) (autorest.Response, error)
  1295  }
  1296  
  1297  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1298  func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error {
  1299  	var azFuture azure.Future
  1300  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1301  		return err
  1302  	}
  1303  	future.FutureAPI = &azFuture
  1304  	future.Result = future.result
  1305  	return nil
  1306  }
  1307  
  1308  // result is the default implementation for FirewallRulesDeleteFuture.Result.
  1309  func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) {
  1310  	var done bool
  1311  	done, err = future.DoneWithContext(context.Background(), client)
  1312  	if err != nil {
  1313  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure")
  1314  		return
  1315  	}
  1316  	if !done {
  1317  		ar.Response = future.Response()
  1318  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.FirewallRulesDeleteFuture")
  1319  		return
  1320  	}
  1321  	ar.Response = future.Response()
  1322  	return
  1323  }
  1324  
  1325  // FlexibleServerEditionCapability flexible server edition capabilities.
  1326  type FlexibleServerEditionCapability struct {
  1327  	// Name - READ-ONLY; Server edition name
  1328  	Name *string `json:"name,omitempty"`
  1329  	// SupportedStorageEditions - READ-ONLY; The list of editions supported by this server edition.
  1330  	SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"`
  1331  	// SupportedServerVersions - READ-ONLY; The list of server versions supported by this server edition.
  1332  	SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"`
  1333  	// Status - READ-ONLY; The status
  1334  	Status *string `json:"status,omitempty"`
  1335  }
  1336  
  1337  // MarshalJSON is the custom marshaler for FlexibleServerEditionCapability.
  1338  func (fsec FlexibleServerEditionCapability) MarshalJSON() ([]byte, error) {
  1339  	objectMap := make(map[string]interface{})
  1340  	return json.Marshal(objectMap)
  1341  }
  1342  
  1343  // HighAvailability high availability properties of a server
  1344  type HighAvailability struct {
  1345  	// Mode - The HA mode for the server. Possible values include: 'HighAvailabilityModeDisabled', 'HighAvailabilityModeZoneRedundant'
  1346  	Mode HighAvailabilityMode `json:"mode,omitempty"`
  1347  	// State - READ-ONLY; A state of a HA server that is visible to user. Possible values include: 'ServerHAStateNotEnabled', 'ServerHAStateCreatingStandby', 'ServerHAStateReplicatingData', 'ServerHAStateFailingOver', 'ServerHAStateHealthy', 'ServerHAStateRemovingStandby'
  1348  	State ServerHAState `json:"state,omitempty"`
  1349  	// StandbyAvailabilityZone - availability zone information of the standby.
  1350  	StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"`
  1351  }
  1352  
  1353  // MarshalJSON is the custom marshaler for HighAvailability.
  1354  func (ha HighAvailability) MarshalJSON() ([]byte, error) {
  1355  	objectMap := make(map[string]interface{})
  1356  	if ha.Mode != "" {
  1357  		objectMap["mode"] = ha.Mode
  1358  	}
  1359  	if ha.StandbyAvailabilityZone != nil {
  1360  		objectMap["standbyAvailabilityZone"] = ha.StandbyAvailabilityZone
  1361  	}
  1362  	return json.Marshal(objectMap)
  1363  }
  1364  
  1365  // HyperscaleNodeEditionCapability hyperscale node edition capabilities.
  1366  type HyperscaleNodeEditionCapability struct {
  1367  	// Name - READ-ONLY; Server edition name
  1368  	Name *string `json:"name,omitempty"`
  1369  	// SupportedStorageEditions - READ-ONLY; The list of editions supported by this server edition.
  1370  	SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"`
  1371  	// SupportedServerVersions - READ-ONLY; The list of server versions supported by this server edition.
  1372  	SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"`
  1373  	// SupportedNodeTypes - READ-ONLY; The list of Node Types supported by this server edition.
  1374  	SupportedNodeTypes *[]NodeTypeCapability `json:"supportedNodeTypes,omitempty"`
  1375  	// Status - READ-ONLY; The status
  1376  	Status *string `json:"status,omitempty"`
  1377  }
  1378  
  1379  // MarshalJSON is the custom marshaler for HyperscaleNodeEditionCapability.
  1380  func (hnec HyperscaleNodeEditionCapability) MarshalJSON() ([]byte, error) {
  1381  	objectMap := make(map[string]interface{})
  1382  	return json.Marshal(objectMap)
  1383  }
  1384  
  1385  // MaintenanceWindow maintenance window properties of a server.
  1386  type MaintenanceWindow struct {
  1387  	// CustomWindow - indicates whether custom window is enabled or disabled
  1388  	CustomWindow *string `json:"customWindow,omitempty"`
  1389  	// StartHour - start hour for maintenance window
  1390  	StartHour *int32 `json:"startHour,omitempty"`
  1391  	// StartMinute - start minute for maintenance window
  1392  	StartMinute *int32 `json:"startMinute,omitempty"`
  1393  	// DayOfWeek - day of week for maintenance window
  1394  	DayOfWeek *int32 `json:"dayOfWeek,omitempty"`
  1395  }
  1396  
  1397  // NameAvailability represents a resource name availability.
  1398  type NameAvailability struct {
  1399  	autorest.Response `json:"-"`
  1400  	// Message - Error Message.
  1401  	Message *string `json:"message,omitempty"`
  1402  	// NameAvailable - Indicates whether the resource name is available.
  1403  	NameAvailable *bool `json:"nameAvailable,omitempty"`
  1404  	// Name - name of the PostgreSQL server.
  1405  	Name *string `json:"name,omitempty"`
  1406  	// Type - type of the server
  1407  	Type *string `json:"type,omitempty"`
  1408  }
  1409  
  1410  // NameAvailabilityRequest request from client to check resource name availability.
  1411  type NameAvailabilityRequest struct {
  1412  	// Name - Resource name to verify.
  1413  	Name *string `json:"name,omitempty"`
  1414  	// Type - Resource type used for verification.
  1415  	Type *string `json:"type,omitempty"`
  1416  }
  1417  
  1418  // Network network properties of a server
  1419  type Network struct {
  1420  	// PublicNetworkAccess - READ-ONLY; public network access is enabled or not. Possible values include: 'ServerPublicNetworkAccessStateEnabled', 'ServerPublicNetworkAccessStateDisabled'
  1421  	PublicNetworkAccess ServerPublicNetworkAccessState `json:"publicNetworkAccess,omitempty"`
  1422  	// DelegatedSubnetResourceID - delegated subnet arm resource id.
  1423  	DelegatedSubnetResourceID *string `json:"delegatedSubnetResourceId,omitempty"`
  1424  	// PrivateDNSZoneArmResourceID - private dns zone arm resource id.
  1425  	PrivateDNSZoneArmResourceID *string `json:"privateDnsZoneArmResourceId,omitempty"`
  1426  }
  1427  
  1428  // MarshalJSON is the custom marshaler for Network.
  1429  func (n Network) MarshalJSON() ([]byte, error) {
  1430  	objectMap := make(map[string]interface{})
  1431  	if n.DelegatedSubnetResourceID != nil {
  1432  		objectMap["delegatedSubnetResourceId"] = n.DelegatedSubnetResourceID
  1433  	}
  1434  	if n.PrivateDNSZoneArmResourceID != nil {
  1435  		objectMap["privateDnsZoneArmResourceId"] = n.PrivateDNSZoneArmResourceID
  1436  	}
  1437  	return json.Marshal(objectMap)
  1438  }
  1439  
  1440  // NodeTypeCapability node type capability
  1441  type NodeTypeCapability struct {
  1442  	// Name - READ-ONLY; note type name
  1443  	Name *string `json:"name,omitempty"`
  1444  	// NodeType - READ-ONLY; note type
  1445  	NodeType *string `json:"nodeType,omitempty"`
  1446  	// Status - READ-ONLY; The status
  1447  	Status *string `json:"status,omitempty"`
  1448  }
  1449  
  1450  // MarshalJSON is the custom marshaler for NodeTypeCapability.
  1451  func (ntc NodeTypeCapability) MarshalJSON() ([]byte, error) {
  1452  	objectMap := make(map[string]interface{})
  1453  	return json.Marshal(objectMap)
  1454  }
  1455  
  1456  // Operation REST API operation definition.
  1457  type Operation struct {
  1458  	// Name - READ-ONLY; The name of the operation being performed on this particular object.
  1459  	Name *string `json:"name,omitempty"`
  1460  	// Display - READ-ONLY; The localized display information for this particular operation or action.
  1461  	Display *OperationDisplay `json:"display,omitempty"`
  1462  	// IsDataAction - Indicates whether the operation is a data action
  1463  	IsDataAction *bool `json:"isDataAction,omitempty"`
  1464  	// Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginNotSpecified', 'OperationOriginUser', 'OperationOriginSystem'
  1465  	Origin OperationOrigin `json:"origin,omitempty"`
  1466  	// Properties - READ-ONLY; Additional descriptions for the operation.
  1467  	Properties map[string]interface{} `json:"properties"`
  1468  }
  1469  
  1470  // MarshalJSON is the custom marshaler for Operation.
  1471  func (o Operation) MarshalJSON() ([]byte, error) {
  1472  	objectMap := make(map[string]interface{})
  1473  	if o.IsDataAction != nil {
  1474  		objectMap["isDataAction"] = o.IsDataAction
  1475  	}
  1476  	return json.Marshal(objectMap)
  1477  }
  1478  
  1479  // OperationDisplay display metadata associated with the operation.
  1480  type OperationDisplay struct {
  1481  	// Provider - READ-ONLY; Operation resource provider name.
  1482  	Provider *string `json:"provider,omitempty"`
  1483  	// Resource - READ-ONLY; Resource on which the operation is performed.
  1484  	Resource *string `json:"resource,omitempty"`
  1485  	// Operation - READ-ONLY; Localized friendly name for the operation.
  1486  	Operation *string `json:"operation,omitempty"`
  1487  	// Description - READ-ONLY; Operation description.
  1488  	Description *string `json:"description,omitempty"`
  1489  }
  1490  
  1491  // MarshalJSON is the custom marshaler for OperationDisplay.
  1492  func (od OperationDisplay) MarshalJSON() ([]byte, error) {
  1493  	objectMap := make(map[string]interface{})
  1494  	return json.Marshal(objectMap)
  1495  }
  1496  
  1497  // OperationListResult a list of resource provider operations.
  1498  type OperationListResult struct {
  1499  	autorest.Response `json:"-"`
  1500  	// Value - Collection of available operation details
  1501  	Value *[]Operation `json:"value,omitempty"`
  1502  	// NextLink - URL client should use to fetch the next page (per server side paging).
  1503  	// It's null for now, added for future use.
  1504  	NextLink *string `json:"nextLink,omitempty"`
  1505  }
  1506  
  1507  // ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not
  1508  // have tags and a location
  1509  type ProxyResource struct {
  1510  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1511  	ID *string `json:"id,omitempty"`
  1512  	// Name - READ-ONLY; The name of the resource
  1513  	Name *string `json:"name,omitempty"`
  1514  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1515  	Type *string `json:"type,omitempty"`
  1516  }
  1517  
  1518  // MarshalJSON is the custom marshaler for ProxyResource.
  1519  func (pr ProxyResource) MarshalJSON() ([]byte, error) {
  1520  	objectMap := make(map[string]interface{})
  1521  	return json.Marshal(objectMap)
  1522  }
  1523  
  1524  // Resource common fields that are returned in the response for all Azure Resource Manager resources
  1525  type Resource struct {
  1526  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1527  	ID *string `json:"id,omitempty"`
  1528  	// Name - READ-ONLY; The name of the resource
  1529  	Name *string `json:"name,omitempty"`
  1530  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1531  	Type *string `json:"type,omitempty"`
  1532  }
  1533  
  1534  // MarshalJSON is the custom marshaler for Resource.
  1535  func (r Resource) MarshalJSON() ([]byte, error) {
  1536  	objectMap := make(map[string]interface{})
  1537  	return json.Marshal(objectMap)
  1538  }
  1539  
  1540  // RestartParameter represents server restart parameters.
  1541  type RestartParameter struct {
  1542  	// RestartWithFailover - Indicates whether to restart the server with failover.
  1543  	RestartWithFailover *bool `json:"restartWithFailover,omitempty"`
  1544  	// FailoverMode - Failover mode. Possible values include: 'FailoverModePlannedFailover', 'FailoverModeForcedFailover', 'FailoverModePlannedSwitchover', 'FailoverModeForcedSwitchover'
  1545  	FailoverMode FailoverMode `json:"failoverMode,omitempty"`
  1546  }
  1547  
  1548  // Server represents a server.
  1549  type Server struct {
  1550  	autorest.Response `json:"-"`
  1551  	// Sku - The SKU (pricing tier) of the server.
  1552  	Sku *Sku `json:"sku,omitempty"`
  1553  	// ServerProperties - Properties of the server.
  1554  	*ServerProperties `json:"properties,omitempty"`
  1555  	// SystemData - READ-ONLY; The system metadata relating to this resource.
  1556  	SystemData *SystemData `json:"systemData,omitempty"`
  1557  	// Tags - Resource tags.
  1558  	Tags map[string]*string `json:"tags"`
  1559  	// Location - The geo-location where the resource lives
  1560  	Location *string `json:"location,omitempty"`
  1561  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1562  	ID *string `json:"id,omitempty"`
  1563  	// Name - READ-ONLY; The name of the resource
  1564  	Name *string `json:"name,omitempty"`
  1565  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1566  	Type *string `json:"type,omitempty"`
  1567  }
  1568  
  1569  // MarshalJSON is the custom marshaler for Server.
  1570  func (s Server) MarshalJSON() ([]byte, error) {
  1571  	objectMap := make(map[string]interface{})
  1572  	if s.Sku != nil {
  1573  		objectMap["sku"] = s.Sku
  1574  	}
  1575  	if s.ServerProperties != nil {
  1576  		objectMap["properties"] = s.ServerProperties
  1577  	}
  1578  	if s.Tags != nil {
  1579  		objectMap["tags"] = s.Tags
  1580  	}
  1581  	if s.Location != nil {
  1582  		objectMap["location"] = s.Location
  1583  	}
  1584  	return json.Marshal(objectMap)
  1585  }
  1586  
  1587  // UnmarshalJSON is the custom unmarshaler for Server struct.
  1588  func (s *Server) UnmarshalJSON(body []byte) error {
  1589  	var m map[string]*json.RawMessage
  1590  	err := json.Unmarshal(body, &m)
  1591  	if err != nil {
  1592  		return err
  1593  	}
  1594  	for k, v := range m {
  1595  		switch k {
  1596  		case "sku":
  1597  			if v != nil {
  1598  				var sku Sku
  1599  				err = json.Unmarshal(*v, &sku)
  1600  				if err != nil {
  1601  					return err
  1602  				}
  1603  				s.Sku = &sku
  1604  			}
  1605  		case "properties":
  1606  			if v != nil {
  1607  				var serverProperties ServerProperties
  1608  				err = json.Unmarshal(*v, &serverProperties)
  1609  				if err != nil {
  1610  					return err
  1611  				}
  1612  				s.ServerProperties = &serverProperties
  1613  			}
  1614  		case "systemData":
  1615  			if v != nil {
  1616  				var systemData SystemData
  1617  				err = json.Unmarshal(*v, &systemData)
  1618  				if err != nil {
  1619  					return err
  1620  				}
  1621  				s.SystemData = &systemData
  1622  			}
  1623  		case "tags":
  1624  			if v != nil {
  1625  				var tags map[string]*string
  1626  				err = json.Unmarshal(*v, &tags)
  1627  				if err != nil {
  1628  					return err
  1629  				}
  1630  				s.Tags = tags
  1631  			}
  1632  		case "location":
  1633  			if v != nil {
  1634  				var location string
  1635  				err = json.Unmarshal(*v, &location)
  1636  				if err != nil {
  1637  					return err
  1638  				}
  1639  				s.Location = &location
  1640  			}
  1641  		case "id":
  1642  			if v != nil {
  1643  				var ID string
  1644  				err = json.Unmarshal(*v, &ID)
  1645  				if err != nil {
  1646  					return err
  1647  				}
  1648  				s.ID = &ID
  1649  			}
  1650  		case "name":
  1651  			if v != nil {
  1652  				var name string
  1653  				err = json.Unmarshal(*v, &name)
  1654  				if err != nil {
  1655  					return err
  1656  				}
  1657  				s.Name = &name
  1658  			}
  1659  		case "type":
  1660  			if v != nil {
  1661  				var typeVar string
  1662  				err = json.Unmarshal(*v, &typeVar)
  1663  				if err != nil {
  1664  					return err
  1665  				}
  1666  				s.Type = &typeVar
  1667  			}
  1668  		}
  1669  	}
  1670  
  1671  	return nil
  1672  }
  1673  
  1674  // ServerForUpdate represents a server to be updated.
  1675  type ServerForUpdate struct {
  1676  	// Location - The location the resource resides in.
  1677  	Location *string `json:"location,omitempty"`
  1678  	// Sku - The SKU (pricing tier) of the server.
  1679  	Sku *Sku `json:"sku,omitempty"`
  1680  	// ServerPropertiesForUpdate - Properties of the server.
  1681  	*ServerPropertiesForUpdate `json:"properties,omitempty"`
  1682  	// Tags - Application-specific metadata in the form of key-value pairs.
  1683  	Tags map[string]*string `json:"tags"`
  1684  }
  1685  
  1686  // MarshalJSON is the custom marshaler for ServerForUpdate.
  1687  func (sfu ServerForUpdate) MarshalJSON() ([]byte, error) {
  1688  	objectMap := make(map[string]interface{})
  1689  	if sfu.Location != nil {
  1690  		objectMap["location"] = sfu.Location
  1691  	}
  1692  	if sfu.Sku != nil {
  1693  		objectMap["sku"] = sfu.Sku
  1694  	}
  1695  	if sfu.ServerPropertiesForUpdate != nil {
  1696  		objectMap["properties"] = sfu.ServerPropertiesForUpdate
  1697  	}
  1698  	if sfu.Tags != nil {
  1699  		objectMap["tags"] = sfu.Tags
  1700  	}
  1701  	return json.Marshal(objectMap)
  1702  }
  1703  
  1704  // UnmarshalJSON is the custom unmarshaler for ServerForUpdate struct.
  1705  func (sfu *ServerForUpdate) UnmarshalJSON(body []byte) error {
  1706  	var m map[string]*json.RawMessage
  1707  	err := json.Unmarshal(body, &m)
  1708  	if err != nil {
  1709  		return err
  1710  	}
  1711  	for k, v := range m {
  1712  		switch k {
  1713  		case "location":
  1714  			if v != nil {
  1715  				var location string
  1716  				err = json.Unmarshal(*v, &location)
  1717  				if err != nil {
  1718  					return err
  1719  				}
  1720  				sfu.Location = &location
  1721  			}
  1722  		case "sku":
  1723  			if v != nil {
  1724  				var sku Sku
  1725  				err = json.Unmarshal(*v, &sku)
  1726  				if err != nil {
  1727  					return err
  1728  				}
  1729  				sfu.Sku = &sku
  1730  			}
  1731  		case "properties":
  1732  			if v != nil {
  1733  				var serverPropertiesForUpdate ServerPropertiesForUpdate
  1734  				err = json.Unmarshal(*v, &serverPropertiesForUpdate)
  1735  				if err != nil {
  1736  					return err
  1737  				}
  1738  				sfu.ServerPropertiesForUpdate = &serverPropertiesForUpdate
  1739  			}
  1740  		case "tags":
  1741  			if v != nil {
  1742  				var tags map[string]*string
  1743  				err = json.Unmarshal(*v, &tags)
  1744  				if err != nil {
  1745  					return err
  1746  				}
  1747  				sfu.Tags = tags
  1748  			}
  1749  		}
  1750  	}
  1751  
  1752  	return nil
  1753  }
  1754  
  1755  // ServerListResult a list of servers.
  1756  type ServerListResult struct {
  1757  	autorest.Response `json:"-"`
  1758  	// Value - The list of flexible servers
  1759  	Value *[]Server `json:"value,omitempty"`
  1760  	// NextLink - The link used to get the next page of operations.
  1761  	NextLink *string `json:"nextLink,omitempty"`
  1762  }
  1763  
  1764  // ServerListResultIterator provides access to a complete listing of Server values.
  1765  type ServerListResultIterator struct {
  1766  	i    int
  1767  	page ServerListResultPage
  1768  }
  1769  
  1770  // NextWithContext advances to the next value.  If there was an error making
  1771  // the request the iterator does not advance and the error is returned.
  1772  func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1773  	if tracing.IsEnabled() {
  1774  		ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext")
  1775  		defer func() {
  1776  			sc := -1
  1777  			if iter.Response().Response.Response != nil {
  1778  				sc = iter.Response().Response.Response.StatusCode
  1779  			}
  1780  			tracing.EndSpan(ctx, sc, err)
  1781  		}()
  1782  	}
  1783  	iter.i++
  1784  	if iter.i < len(iter.page.Values()) {
  1785  		return nil
  1786  	}
  1787  	err = iter.page.NextWithContext(ctx)
  1788  	if err != nil {
  1789  		iter.i--
  1790  		return err
  1791  	}
  1792  	iter.i = 0
  1793  	return nil
  1794  }
  1795  
  1796  // Next advances to the next value.  If there was an error making
  1797  // the request the iterator does not advance and the error is returned.
  1798  // Deprecated: Use NextWithContext() instead.
  1799  func (iter *ServerListResultIterator) Next() error {
  1800  	return iter.NextWithContext(context.Background())
  1801  }
  1802  
  1803  // NotDone returns true if the enumeration should be started or is not yet complete.
  1804  func (iter ServerListResultIterator) NotDone() bool {
  1805  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1806  }
  1807  
  1808  // Response returns the raw server response from the last page request.
  1809  func (iter ServerListResultIterator) Response() ServerListResult {
  1810  	return iter.page.Response()
  1811  }
  1812  
  1813  // Value returns the current value or a zero-initialized value if the
  1814  // iterator has advanced beyond the end of the collection.
  1815  func (iter ServerListResultIterator) Value() Server {
  1816  	if !iter.page.NotDone() {
  1817  		return Server{}
  1818  	}
  1819  	return iter.page.Values()[iter.i]
  1820  }
  1821  
  1822  // Creates a new instance of the ServerListResultIterator type.
  1823  func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator {
  1824  	return ServerListResultIterator{page: page}
  1825  }
  1826  
  1827  // IsEmpty returns true if the ListResult contains no values.
  1828  func (slr ServerListResult) IsEmpty() bool {
  1829  	return slr.Value == nil || len(*slr.Value) == 0
  1830  }
  1831  
  1832  // hasNextLink returns true if the NextLink is not empty.
  1833  func (slr ServerListResult) hasNextLink() bool {
  1834  	return slr.NextLink != nil && len(*slr.NextLink) != 0
  1835  }
  1836  
  1837  // serverListResultPreparer prepares a request to retrieve the next set of results.
  1838  // It returns nil if no more results exist.
  1839  func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) {
  1840  	if !slr.hasNextLink() {
  1841  		return nil, nil
  1842  	}
  1843  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1844  		autorest.AsJSON(),
  1845  		autorest.AsGet(),
  1846  		autorest.WithBaseURL(to.String(slr.NextLink)))
  1847  }
  1848  
  1849  // ServerListResultPage contains a page of Server values.
  1850  type ServerListResultPage struct {
  1851  	fn  func(context.Context, ServerListResult) (ServerListResult, error)
  1852  	slr ServerListResult
  1853  }
  1854  
  1855  // NextWithContext advances to the next page of values.  If there was an error making
  1856  // the request the page does not advance and the error is returned.
  1857  func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) {
  1858  	if tracing.IsEnabled() {
  1859  		ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext")
  1860  		defer func() {
  1861  			sc := -1
  1862  			if page.Response().Response.Response != nil {
  1863  				sc = page.Response().Response.Response.StatusCode
  1864  			}
  1865  			tracing.EndSpan(ctx, sc, err)
  1866  		}()
  1867  	}
  1868  	for {
  1869  		next, err := page.fn(ctx, page.slr)
  1870  		if err != nil {
  1871  			return err
  1872  		}
  1873  		page.slr = next
  1874  		if !next.hasNextLink() || !next.IsEmpty() {
  1875  			break
  1876  		}
  1877  	}
  1878  	return nil
  1879  }
  1880  
  1881  // Next advances to the next page of values.  If there was an error making
  1882  // the request the page does not advance and the error is returned.
  1883  // Deprecated: Use NextWithContext() instead.
  1884  func (page *ServerListResultPage) Next() error {
  1885  	return page.NextWithContext(context.Background())
  1886  }
  1887  
  1888  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1889  func (page ServerListResultPage) NotDone() bool {
  1890  	return !page.slr.IsEmpty()
  1891  }
  1892  
  1893  // Response returns the raw server response from the last page request.
  1894  func (page ServerListResultPage) Response() ServerListResult {
  1895  	return page.slr
  1896  }
  1897  
  1898  // Values returns the slice of values for the current page or nil if there are no values.
  1899  func (page ServerListResultPage) Values() []Server {
  1900  	if page.slr.IsEmpty() {
  1901  		return nil
  1902  	}
  1903  	return *page.slr.Value
  1904  }
  1905  
  1906  // Creates a new instance of the ServerListResultPage type.
  1907  func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage {
  1908  	return ServerListResultPage{
  1909  		fn:  getNextPage,
  1910  		slr: cur,
  1911  	}
  1912  }
  1913  
  1914  // ServerProperties the properties of a server.
  1915  type ServerProperties struct {
  1916  	// AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
  1917  	AdministratorLogin *string `json:"administratorLogin,omitempty"`
  1918  	// AdministratorLoginPassword - The administrator login password (required for server creation).
  1919  	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
  1920  	// Version - PostgreSQL Server version. Possible values include: 'ServerVersionOneThree', 'ServerVersionOneTwo', 'ServerVersionOneOne'
  1921  	Version ServerVersion `json:"version,omitempty"`
  1922  	// MinorVersion - READ-ONLY; The minor version of the server.
  1923  	MinorVersion *string `json:"minorVersion,omitempty"`
  1924  	// State - READ-ONLY; A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateStarting', 'ServerStateStopping', 'ServerStateStopped', 'ServerStateUpdating'
  1925  	State ServerState `json:"state,omitempty"`
  1926  	// FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of a server.
  1927  	FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
  1928  	// Storage - Storage properties of a server.
  1929  	Storage *Storage `json:"storage,omitempty"`
  1930  	// Backup - Backup properties of a server.
  1931  	Backup *Backup `json:"backup,omitempty"`
  1932  	// Network - Network properties of a server.
  1933  	Network *Network `json:"network,omitempty"`
  1934  	// HighAvailability - High availability properties of a server.
  1935  	HighAvailability *HighAvailability `json:"highAvailability,omitempty"`
  1936  	// MaintenanceWindow - Maintenance window properties of a server.
  1937  	MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
  1938  	// SourceServerResourceID - The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore'.
  1939  	SourceServerResourceID *string `json:"sourceServerResourceId,omitempty"`
  1940  	// PointInTimeUTC - Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore'.
  1941  	PointInTimeUTC *date.Time `json:"pointInTimeUTC,omitempty"`
  1942  	// AvailabilityZone - availability zone information of the server.
  1943  	AvailabilityZone *string `json:"availabilityZone,omitempty"`
  1944  	// CreateMode - The mode to create a new PostgreSQL server. Possible values include: 'CreateModeDefault', 'CreateModeCreate', 'CreateModeUpdate', 'CreateModePointInTimeRestore'
  1945  	CreateMode CreateMode `json:"createMode,omitempty"`
  1946  	// Tags - Application-specific metadata in the form of key-value pairs.
  1947  	Tags map[string]*string `json:"tags"`
  1948  }
  1949  
  1950  // MarshalJSON is the custom marshaler for ServerProperties.
  1951  func (sp ServerProperties) MarshalJSON() ([]byte, error) {
  1952  	objectMap := make(map[string]interface{})
  1953  	if sp.AdministratorLogin != nil {
  1954  		objectMap["administratorLogin"] = sp.AdministratorLogin
  1955  	}
  1956  	if sp.AdministratorLoginPassword != nil {
  1957  		objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword
  1958  	}
  1959  	if sp.Version != "" {
  1960  		objectMap["version"] = sp.Version
  1961  	}
  1962  	if sp.Storage != nil {
  1963  		objectMap["storage"] = sp.Storage
  1964  	}
  1965  	if sp.Backup != nil {
  1966  		objectMap["backup"] = sp.Backup
  1967  	}
  1968  	if sp.Network != nil {
  1969  		objectMap["network"] = sp.Network
  1970  	}
  1971  	if sp.HighAvailability != nil {
  1972  		objectMap["highAvailability"] = sp.HighAvailability
  1973  	}
  1974  	if sp.MaintenanceWindow != nil {
  1975  		objectMap["maintenanceWindow"] = sp.MaintenanceWindow
  1976  	}
  1977  	if sp.SourceServerResourceID != nil {
  1978  		objectMap["sourceServerResourceId"] = sp.SourceServerResourceID
  1979  	}
  1980  	if sp.PointInTimeUTC != nil {
  1981  		objectMap["pointInTimeUTC"] = sp.PointInTimeUTC
  1982  	}
  1983  	if sp.AvailabilityZone != nil {
  1984  		objectMap["availabilityZone"] = sp.AvailabilityZone
  1985  	}
  1986  	if sp.CreateMode != "" {
  1987  		objectMap["createMode"] = sp.CreateMode
  1988  	}
  1989  	if sp.Tags != nil {
  1990  		objectMap["tags"] = sp.Tags
  1991  	}
  1992  	return json.Marshal(objectMap)
  1993  }
  1994  
  1995  // ServerPropertiesForUpdate ...
  1996  type ServerPropertiesForUpdate struct {
  1997  	// AdministratorLoginPassword - The password of the administrator login.
  1998  	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
  1999  	// Storage - Storage properties of a server.
  2000  	Storage *Storage `json:"storage,omitempty"`
  2001  	// Backup - Backup properties of a server.
  2002  	Backup *Backup `json:"backup,omitempty"`
  2003  	// HighAvailability - High availability properties of a server.
  2004  	HighAvailability *HighAvailability `json:"highAvailability,omitempty"`
  2005  	// MaintenanceWindow - Maintenance window properties of a server.
  2006  	MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
  2007  	// CreateMode - The mode to update a new PostgreSQL server. Possible values include: 'CreateModeForUpdateDefault', 'CreateModeForUpdateUpdate'
  2008  	CreateMode CreateModeForUpdate `json:"createMode,omitempty"`
  2009  }
  2010  
  2011  // ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running
  2012  // operation.
  2013  type ServersCreateFuture struct {
  2014  	azure.FutureAPI
  2015  	// Result returns the result of the asynchronous operation.
  2016  	// If the operation has not completed it will return an error.
  2017  	Result func(ServersClient) (Server, error)
  2018  }
  2019  
  2020  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2021  func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
  2022  	var azFuture azure.Future
  2023  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2024  		return err
  2025  	}
  2026  	future.FutureAPI = &azFuture
  2027  	future.Result = future.result
  2028  	return nil
  2029  }
  2030  
  2031  // result is the default implementation for ServersCreateFuture.Result.
  2032  func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
  2033  	var done bool
  2034  	done, err = future.DoneWithContext(context.Background(), client)
  2035  	if err != nil {
  2036  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersCreateFuture", "Result", future.Response(), "Polling failure")
  2037  		return
  2038  	}
  2039  	if !done {
  2040  		s.Response.Response = future.Response()
  2041  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersCreateFuture")
  2042  		return
  2043  	}
  2044  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2045  	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
  2046  		s, err = client.CreateResponder(s.Response.Response)
  2047  		if err != nil {
  2048  			err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
  2049  		}
  2050  	}
  2051  	return
  2052  }
  2053  
  2054  // ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  2055  // operation.
  2056  type ServersDeleteFuture struct {
  2057  	azure.FutureAPI
  2058  	// Result returns the result of the asynchronous operation.
  2059  	// If the operation has not completed it will return an error.
  2060  	Result func(ServersClient) (autorest.Response, error)
  2061  }
  2062  
  2063  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2064  func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
  2065  	var azFuture azure.Future
  2066  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2067  		return err
  2068  	}
  2069  	future.FutureAPI = &azFuture
  2070  	future.Result = future.result
  2071  	return nil
  2072  }
  2073  
  2074  // result is the default implementation for ServersDeleteFuture.Result.
  2075  func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2076  	var done bool
  2077  	done, err = future.DoneWithContext(context.Background(), client)
  2078  	if err != nil {
  2079  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
  2080  		return
  2081  	}
  2082  	if !done {
  2083  		ar.Response = future.Response()
  2084  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersDeleteFuture")
  2085  		return
  2086  	}
  2087  	ar.Response = future.Response()
  2088  	return
  2089  }
  2090  
  2091  // ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running
  2092  // operation.
  2093  type ServersRestartFuture struct {
  2094  	azure.FutureAPI
  2095  	// Result returns the result of the asynchronous operation.
  2096  	// If the operation has not completed it will return an error.
  2097  	Result func(ServersClient) (autorest.Response, error)
  2098  }
  2099  
  2100  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2101  func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error {
  2102  	var azFuture azure.Future
  2103  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2104  		return err
  2105  	}
  2106  	future.FutureAPI = &azFuture
  2107  	future.Result = future.result
  2108  	return nil
  2109  }
  2110  
  2111  // result is the default implementation for ServersRestartFuture.Result.
  2112  func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2113  	var done bool
  2114  	done, err = future.DoneWithContext(context.Background(), client)
  2115  	if err != nil {
  2116  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersRestartFuture", "Result", future.Response(), "Polling failure")
  2117  		return
  2118  	}
  2119  	if !done {
  2120  		ar.Response = future.Response()
  2121  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersRestartFuture")
  2122  		return
  2123  	}
  2124  	ar.Response = future.Response()
  2125  	return
  2126  }
  2127  
  2128  // ServersStartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
  2129  type ServersStartFuture struct {
  2130  	azure.FutureAPI
  2131  	// Result returns the result of the asynchronous operation.
  2132  	// If the operation has not completed it will return an error.
  2133  	Result func(ServersClient) (autorest.Response, error)
  2134  }
  2135  
  2136  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2137  func (future *ServersStartFuture) UnmarshalJSON(body []byte) error {
  2138  	var azFuture azure.Future
  2139  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2140  		return err
  2141  	}
  2142  	future.FutureAPI = &azFuture
  2143  	future.Result = future.result
  2144  	return nil
  2145  }
  2146  
  2147  // result is the default implementation for ServersStartFuture.Result.
  2148  func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2149  	var done bool
  2150  	done, err = future.DoneWithContext(context.Background(), client)
  2151  	if err != nil {
  2152  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersStartFuture", "Result", future.Response(), "Polling failure")
  2153  		return
  2154  	}
  2155  	if !done {
  2156  		ar.Response = future.Response()
  2157  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersStartFuture")
  2158  		return
  2159  	}
  2160  	ar.Response = future.Response()
  2161  	return
  2162  }
  2163  
  2164  // ServersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation.
  2165  type ServersStopFuture struct {
  2166  	azure.FutureAPI
  2167  	// Result returns the result of the asynchronous operation.
  2168  	// If the operation has not completed it will return an error.
  2169  	Result func(ServersClient) (autorest.Response, error)
  2170  }
  2171  
  2172  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2173  func (future *ServersStopFuture) UnmarshalJSON(body []byte) error {
  2174  	var azFuture azure.Future
  2175  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2176  		return err
  2177  	}
  2178  	future.FutureAPI = &azFuture
  2179  	future.Result = future.result
  2180  	return nil
  2181  }
  2182  
  2183  // result is the default implementation for ServersStopFuture.Result.
  2184  func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2185  	var done bool
  2186  	done, err = future.DoneWithContext(context.Background(), client)
  2187  	if err != nil {
  2188  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersStopFuture", "Result", future.Response(), "Polling failure")
  2189  		return
  2190  	}
  2191  	if !done {
  2192  		ar.Response = future.Response()
  2193  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersStopFuture")
  2194  		return
  2195  	}
  2196  	ar.Response = future.Response()
  2197  	return
  2198  }
  2199  
  2200  // ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
  2201  // operation.
  2202  type ServersUpdateFuture struct {
  2203  	azure.FutureAPI
  2204  	// Result returns the result of the asynchronous operation.
  2205  	// If the operation has not completed it will return an error.
  2206  	Result func(ServersClient) (Server, error)
  2207  }
  2208  
  2209  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2210  func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
  2211  	var azFuture azure.Future
  2212  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2213  		return err
  2214  	}
  2215  	future.FutureAPI = &azFuture
  2216  	future.Result = future.result
  2217  	return nil
  2218  }
  2219  
  2220  // result is the default implementation for ServersUpdateFuture.Result.
  2221  func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
  2222  	var done bool
  2223  	done, err = future.DoneWithContext(context.Background(), client)
  2224  	if err != nil {
  2225  		err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
  2226  		return
  2227  	}
  2228  	if !done {
  2229  		s.Response.Response = future.Response()
  2230  		err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersUpdateFuture")
  2231  		return
  2232  	}
  2233  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2234  	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
  2235  		s, err = client.UpdateResponder(s.Response.Response)
  2236  		if err != nil {
  2237  			err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
  2238  		}
  2239  	}
  2240  	return
  2241  }
  2242  
  2243  // ServerVersionCapability server version capabilities.
  2244  type ServerVersionCapability struct {
  2245  	// Name - READ-ONLY; server version
  2246  	Name *string `json:"name,omitempty"`
  2247  	// SupportedVcores - READ-ONLY
  2248  	SupportedVcores *[]VcoreCapability `json:"supportedVcores,omitempty"`
  2249  	// Status - READ-ONLY; The status
  2250  	Status *string `json:"status,omitempty"`
  2251  }
  2252  
  2253  // MarshalJSON is the custom marshaler for ServerVersionCapability.
  2254  func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) {
  2255  	objectMap := make(map[string]interface{})
  2256  	return json.Marshal(objectMap)
  2257  }
  2258  
  2259  // Sku sku information related properties of a server.
  2260  type Sku struct {
  2261  	// Name - The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3.
  2262  	Name *string `json:"name,omitempty"`
  2263  	// Tier - The tier of the particular SKU, e.g. Burstable. Possible values include: 'SkuTierBurstable', 'SkuTierGeneralPurpose', 'SkuTierMemoryOptimized'
  2264  	Tier SkuTier `json:"tier,omitempty"`
  2265  }
  2266  
  2267  // Storage storage properties of a server
  2268  type Storage struct {
  2269  	// StorageSizeGB - Max storage allowed for a server.
  2270  	StorageSizeGB *int32 `json:"storageSizeGB,omitempty"`
  2271  }
  2272  
  2273  // StorageEditionCapability storage edition capability
  2274  type StorageEditionCapability struct {
  2275  	// Name - READ-ONLY; storage edition name
  2276  	Name *string `json:"name,omitempty"`
  2277  	// SupportedStorageMB - READ-ONLY
  2278  	SupportedStorageMB *[]StorageMBCapability `json:"supportedStorageMB,omitempty"`
  2279  	// Status - READ-ONLY; The status
  2280  	Status *string `json:"status,omitempty"`
  2281  }
  2282  
  2283  // MarshalJSON is the custom marshaler for StorageEditionCapability.
  2284  func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) {
  2285  	objectMap := make(map[string]interface{})
  2286  	return json.Marshal(objectMap)
  2287  }
  2288  
  2289  // StorageMBCapability storage size in MB capability
  2290  type StorageMBCapability struct {
  2291  	// Name - READ-ONLY; storage MB name
  2292  	Name *string `json:"name,omitempty"`
  2293  	// SupportedIops - READ-ONLY; supported IOPS
  2294  	SupportedIops *int64 `json:"supportedIops,omitempty"`
  2295  	// StorageSizeMB - READ-ONLY; storage size in MB
  2296  	StorageSizeMB *int64 `json:"storageSizeMB,omitempty"`
  2297  	// Status - READ-ONLY; The status
  2298  	Status *string `json:"status,omitempty"`
  2299  }
  2300  
  2301  // MarshalJSON is the custom marshaler for StorageMBCapability.
  2302  func (smc StorageMBCapability) MarshalJSON() ([]byte, error) {
  2303  	objectMap := make(map[string]interface{})
  2304  	return json.Marshal(objectMap)
  2305  }
  2306  
  2307  // String ...
  2308  type String struct {
  2309  	autorest.Response `json:"-"`
  2310  	Value             *string `json:"value,omitempty"`
  2311  }
  2312  
  2313  // SystemData metadata pertaining to creation and last modification of the resource.
  2314  type SystemData struct {
  2315  	// CreatedBy - The identity that created the resource.
  2316  	CreatedBy *string `json:"createdBy,omitempty"`
  2317  	// CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey'
  2318  	CreatedByType CreatedByType `json:"createdByType,omitempty"`
  2319  	// CreatedAt - The timestamp of resource creation (UTC).
  2320  	CreatedAt *date.Time `json:"createdAt,omitempty"`
  2321  	// LastModifiedBy - The identity that last modified the resource.
  2322  	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
  2323  	// LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey'
  2324  	LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
  2325  	// LastModifiedAt - The timestamp of resource last modification (UTC)
  2326  	LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
  2327  }
  2328  
  2329  // TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource
  2330  // which has 'tags' and a 'location'
  2331  type TrackedResource struct {
  2332  	// Tags - Resource tags.
  2333  	Tags map[string]*string `json:"tags"`
  2334  	// Location - The geo-location where the resource lives
  2335  	Location *string `json:"location,omitempty"`
  2336  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  2337  	ID *string `json:"id,omitempty"`
  2338  	// Name - READ-ONLY; The name of the resource
  2339  	Name *string `json:"name,omitempty"`
  2340  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  2341  	Type *string `json:"type,omitempty"`
  2342  }
  2343  
  2344  // MarshalJSON is the custom marshaler for TrackedResource.
  2345  func (tr TrackedResource) MarshalJSON() ([]byte, error) {
  2346  	objectMap := make(map[string]interface{})
  2347  	if tr.Tags != nil {
  2348  		objectMap["tags"] = tr.Tags
  2349  	}
  2350  	if tr.Location != nil {
  2351  		objectMap["location"] = tr.Location
  2352  	}
  2353  	return json.Marshal(objectMap)
  2354  }
  2355  
  2356  // VcoreCapability vcores capability
  2357  type VcoreCapability struct {
  2358  	// Name - READ-ONLY; vCore name
  2359  	Name *string `json:"name,omitempty"`
  2360  	// VCores - READ-ONLY; supported vCores
  2361  	VCores *int64 `json:"vCores,omitempty"`
  2362  	// SupportedIops - READ-ONLY; supported IOPS
  2363  	SupportedIops *int64 `json:"supportedIops,omitempty"`
  2364  	// SupportedMemoryPerVcoreMB - READ-ONLY; supported memory per vCore in MB
  2365  	SupportedMemoryPerVcoreMB *int64 `json:"supportedMemoryPerVcoreMB,omitempty"`
  2366  	// Status - READ-ONLY; The status
  2367  	Status *string `json:"status,omitempty"`
  2368  }
  2369  
  2370  // MarshalJSON is the custom marshaler for VcoreCapability.
  2371  func (vc VcoreCapability) MarshalJSON() ([]byte, error) {
  2372  	objectMap := make(map[string]interface{})
  2373  	return json.Marshal(objectMap)
  2374  }
  2375  
  2376  // VirtualNetworkSubnetUsageParameter virtual network subnet usage parameter
  2377  type VirtualNetworkSubnetUsageParameter struct {
  2378  	// VirtualNetworkArmResourceID - Virtual network resource id.
  2379  	VirtualNetworkArmResourceID *string `json:"virtualNetworkArmResourceId,omitempty"`
  2380  }
  2381  
  2382  // VirtualNetworkSubnetUsageResult virtual network subnet usage data.
  2383  type VirtualNetworkSubnetUsageResult struct {
  2384  	autorest.Response `json:"-"`
  2385  	// DelegatedSubnetsUsage - READ-ONLY
  2386  	DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"`
  2387  }
  2388  
  2389  // MarshalJSON is the custom marshaler for VirtualNetworkSubnetUsageResult.
  2390  func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) {
  2391  	objectMap := make(map[string]interface{})
  2392  	return json.Marshal(objectMap)
  2393  }
  2394  

View as plain text