...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/mysql/mgmt/2021-05-01-preview/mysqlflexibleservers/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/mysql/mgmt/2021-05-01-preview/mysqlflexibleservers

     1  package mysqlflexibleservers
     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/preview/mysql/mgmt/2021-05-01-preview/mysqlflexibleservers"
    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 storage Profile properties of a server
    42  type Backup struct {
    43  	// BackupRetentionDays - Backup retention days for the server.
    44  	BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
    45  	// GeoRedundantBackup - Whether or not geo redundant backup is enabled. Possible values include: 'EnableStatusEnumEnabled', 'EnableStatusEnumDisabled'
    46  	GeoRedundantBackup EnableStatusEnum `json:"geoRedundantBackup,omitempty"`
    47  	// EarliestRestoreDate - READ-ONLY; Earliest restore point creation time (ISO8601 format)
    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  	// SupportedHAMode - READ-ONLY; Supported high availability mode
   233  	SupportedHAMode *[]string `json:"supportedHAMode,omitempty"`
   234  	// SupportedGeoBackupRegions - READ-ONLY; supported geo backup regions
   235  	SupportedGeoBackupRegions *[]string `json:"supportedGeoBackupRegions,omitempty"`
   236  	// SupportedFlexibleServerEditions - READ-ONLY; A list of supported flexible server editions.
   237  	SupportedFlexibleServerEditions *[]ServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"`
   238  }
   239  
   240  // MarshalJSON is the custom marshaler for CapabilityProperties.
   241  func (cp CapabilityProperties) MarshalJSON() ([]byte, error) {
   242  	objectMap := make(map[string]interface{})
   243  	return json.Marshal(objectMap)
   244  }
   245  
   246  // CloudError an error response from the Batch service.
   247  type CloudError struct {
   248  	// Error - The resource management error response.
   249  	Error *ErrorResponse `json:"error,omitempty"`
   250  }
   251  
   252  // Configuration represents a Configuration.
   253  type Configuration struct {
   254  	autorest.Response `json:"-"`
   255  	// ConfigurationProperties - The properties of a configuration.
   256  	*ConfigurationProperties `json:"properties,omitempty"`
   257  	// SystemData - READ-ONLY; The system metadata relating to this resource.
   258  	SystemData *SystemData `json:"systemData,omitempty"`
   259  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
   260  	ID *string `json:"id,omitempty"`
   261  	// Name - READ-ONLY; The name of the resource
   262  	Name *string `json:"name,omitempty"`
   263  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
   264  	Type *string `json:"type,omitempty"`
   265  }
   266  
   267  // MarshalJSON is the custom marshaler for Configuration.
   268  func (c Configuration) MarshalJSON() ([]byte, error) {
   269  	objectMap := make(map[string]interface{})
   270  	if c.ConfigurationProperties != nil {
   271  		objectMap["properties"] = c.ConfigurationProperties
   272  	}
   273  	return json.Marshal(objectMap)
   274  }
   275  
   276  // UnmarshalJSON is the custom unmarshaler for Configuration struct.
   277  func (c *Configuration) UnmarshalJSON(body []byte) error {
   278  	var m map[string]*json.RawMessage
   279  	err := json.Unmarshal(body, &m)
   280  	if err != nil {
   281  		return err
   282  	}
   283  	for k, v := range m {
   284  		switch k {
   285  		case "properties":
   286  			if v != nil {
   287  				var configurationProperties ConfigurationProperties
   288  				err = json.Unmarshal(*v, &configurationProperties)
   289  				if err != nil {
   290  					return err
   291  				}
   292  				c.ConfigurationProperties = &configurationProperties
   293  			}
   294  		case "systemData":
   295  			if v != nil {
   296  				var systemData SystemData
   297  				err = json.Unmarshal(*v, &systemData)
   298  				if err != nil {
   299  					return err
   300  				}
   301  				c.SystemData = &systemData
   302  			}
   303  		case "id":
   304  			if v != nil {
   305  				var ID string
   306  				err = json.Unmarshal(*v, &ID)
   307  				if err != nil {
   308  					return err
   309  				}
   310  				c.ID = &ID
   311  			}
   312  		case "name":
   313  			if v != nil {
   314  				var name string
   315  				err = json.Unmarshal(*v, &name)
   316  				if err != nil {
   317  					return err
   318  				}
   319  				c.Name = &name
   320  			}
   321  		case "type":
   322  			if v != nil {
   323  				var typeVar string
   324  				err = json.Unmarshal(*v, &typeVar)
   325  				if err != nil {
   326  					return err
   327  				}
   328  				c.Type = &typeVar
   329  			}
   330  		}
   331  	}
   332  
   333  	return nil
   334  }
   335  
   336  // ConfigurationForBatchUpdate represents a Configuration.
   337  type ConfigurationForBatchUpdate struct {
   338  	// Name - Name of the configuration.
   339  	Name *string `json:"name,omitempty"`
   340  	// ConfigurationForBatchUpdateProperties - The properties can be updated for a configuration.
   341  	*ConfigurationForBatchUpdateProperties `json:"properties,omitempty"`
   342  }
   343  
   344  // MarshalJSON is the custom marshaler for ConfigurationForBatchUpdate.
   345  func (cfbu ConfigurationForBatchUpdate) MarshalJSON() ([]byte, error) {
   346  	objectMap := make(map[string]interface{})
   347  	if cfbu.Name != nil {
   348  		objectMap["name"] = cfbu.Name
   349  	}
   350  	if cfbu.ConfigurationForBatchUpdateProperties != nil {
   351  		objectMap["properties"] = cfbu.ConfigurationForBatchUpdateProperties
   352  	}
   353  	return json.Marshal(objectMap)
   354  }
   355  
   356  // UnmarshalJSON is the custom unmarshaler for ConfigurationForBatchUpdate struct.
   357  func (cfbu *ConfigurationForBatchUpdate) UnmarshalJSON(body []byte) error {
   358  	var m map[string]*json.RawMessage
   359  	err := json.Unmarshal(body, &m)
   360  	if err != nil {
   361  		return err
   362  	}
   363  	for k, v := range m {
   364  		switch k {
   365  		case "name":
   366  			if v != nil {
   367  				var name string
   368  				err = json.Unmarshal(*v, &name)
   369  				if err != nil {
   370  					return err
   371  				}
   372  				cfbu.Name = &name
   373  			}
   374  		case "properties":
   375  			if v != nil {
   376  				var configurationForBatchUpdateProperties ConfigurationForBatchUpdateProperties
   377  				err = json.Unmarshal(*v, &configurationForBatchUpdateProperties)
   378  				if err != nil {
   379  					return err
   380  				}
   381  				cfbu.ConfigurationForBatchUpdateProperties = &configurationForBatchUpdateProperties
   382  			}
   383  		}
   384  	}
   385  
   386  	return nil
   387  }
   388  
   389  // ConfigurationForBatchUpdateProperties the properties can be updated for a configuration.
   390  type ConfigurationForBatchUpdateProperties struct {
   391  	// Value - Value of the configuration.
   392  	Value *string `json:"value,omitempty"`
   393  	// Source - Source of the configuration.
   394  	Source *string `json:"source,omitempty"`
   395  }
   396  
   397  // ConfigurationListForBatchUpdate a list of server configurations to update.
   398  type ConfigurationListForBatchUpdate struct {
   399  	// Value - The list of server configurations.
   400  	Value *[]ConfigurationForBatchUpdate `json:"value,omitempty"`
   401  }
   402  
   403  // ConfigurationListResult a list of server configurations.
   404  type ConfigurationListResult struct {
   405  	autorest.Response `json:"-"`
   406  	// Value - The list of server configurations.
   407  	Value *[]Configuration `json:"value,omitempty"`
   408  	// NextLink - The link used to get the next page of operations.
   409  	NextLink *string `json:"nextLink,omitempty"`
   410  }
   411  
   412  // ConfigurationListResultIterator provides access to a complete listing of Configuration values.
   413  type ConfigurationListResultIterator struct {
   414  	i    int
   415  	page ConfigurationListResultPage
   416  }
   417  
   418  // NextWithContext advances to the next value.  If there was an error making
   419  // the request the iterator does not advance and the error is returned.
   420  func (iter *ConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) {
   421  	if tracing.IsEnabled() {
   422  		ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultIterator.NextWithContext")
   423  		defer func() {
   424  			sc := -1
   425  			if iter.Response().Response.Response != nil {
   426  				sc = iter.Response().Response.Response.StatusCode
   427  			}
   428  			tracing.EndSpan(ctx, sc, err)
   429  		}()
   430  	}
   431  	iter.i++
   432  	if iter.i < len(iter.page.Values()) {
   433  		return nil
   434  	}
   435  	err = iter.page.NextWithContext(ctx)
   436  	if err != nil {
   437  		iter.i--
   438  		return err
   439  	}
   440  	iter.i = 0
   441  	return nil
   442  }
   443  
   444  // Next advances to the next value.  If there was an error making
   445  // the request the iterator does not advance and the error is returned.
   446  // Deprecated: Use NextWithContext() instead.
   447  func (iter *ConfigurationListResultIterator) Next() error {
   448  	return iter.NextWithContext(context.Background())
   449  }
   450  
   451  // NotDone returns true if the enumeration should be started or is not yet complete.
   452  func (iter ConfigurationListResultIterator) NotDone() bool {
   453  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   454  }
   455  
   456  // Response returns the raw server response from the last page request.
   457  func (iter ConfigurationListResultIterator) Response() ConfigurationListResult {
   458  	return iter.page.Response()
   459  }
   460  
   461  // Value returns the current value or a zero-initialized value if the
   462  // iterator has advanced beyond the end of the collection.
   463  func (iter ConfigurationListResultIterator) Value() Configuration {
   464  	if !iter.page.NotDone() {
   465  		return Configuration{}
   466  	}
   467  	return iter.page.Values()[iter.i]
   468  }
   469  
   470  // Creates a new instance of the ConfigurationListResultIterator type.
   471  func NewConfigurationListResultIterator(page ConfigurationListResultPage) ConfigurationListResultIterator {
   472  	return ConfigurationListResultIterator{page: page}
   473  }
   474  
   475  // IsEmpty returns true if the ListResult contains no values.
   476  func (clr ConfigurationListResult) IsEmpty() bool {
   477  	return clr.Value == nil || len(*clr.Value) == 0
   478  }
   479  
   480  // hasNextLink returns true if the NextLink is not empty.
   481  func (clr ConfigurationListResult) hasNextLink() bool {
   482  	return clr.NextLink != nil && len(*clr.NextLink) != 0
   483  }
   484  
   485  // configurationListResultPreparer prepares a request to retrieve the next set of results.
   486  // It returns nil if no more results exist.
   487  func (clr ConfigurationListResult) configurationListResultPreparer(ctx context.Context) (*http.Request, error) {
   488  	if !clr.hasNextLink() {
   489  		return nil, nil
   490  	}
   491  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   492  		autorest.AsJSON(),
   493  		autorest.AsGet(),
   494  		autorest.WithBaseURL(to.String(clr.NextLink)))
   495  }
   496  
   497  // ConfigurationListResultPage contains a page of Configuration values.
   498  type ConfigurationListResultPage struct {
   499  	fn  func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)
   500  	clr ConfigurationListResult
   501  }
   502  
   503  // NextWithContext advances to the next page of values.  If there was an error making
   504  // the request the page does not advance and the error is returned.
   505  func (page *ConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) {
   506  	if tracing.IsEnabled() {
   507  		ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultPage.NextWithContext")
   508  		defer func() {
   509  			sc := -1
   510  			if page.Response().Response.Response != nil {
   511  				sc = page.Response().Response.Response.StatusCode
   512  			}
   513  			tracing.EndSpan(ctx, sc, err)
   514  		}()
   515  	}
   516  	for {
   517  		next, err := page.fn(ctx, page.clr)
   518  		if err != nil {
   519  			return err
   520  		}
   521  		page.clr = next
   522  		if !next.hasNextLink() || !next.IsEmpty() {
   523  			break
   524  		}
   525  	}
   526  	return nil
   527  }
   528  
   529  // Next advances to the next page of values.  If there was an error making
   530  // the request the page does not advance and the error is returned.
   531  // Deprecated: Use NextWithContext() instead.
   532  func (page *ConfigurationListResultPage) Next() error {
   533  	return page.NextWithContext(context.Background())
   534  }
   535  
   536  // NotDone returns true if the page enumeration should be started or is not yet complete.
   537  func (page ConfigurationListResultPage) NotDone() bool {
   538  	return !page.clr.IsEmpty()
   539  }
   540  
   541  // Response returns the raw server response from the last page request.
   542  func (page ConfigurationListResultPage) Response() ConfigurationListResult {
   543  	return page.clr
   544  }
   545  
   546  // Values returns the slice of values for the current page or nil if there are no values.
   547  func (page ConfigurationListResultPage) Values() []Configuration {
   548  	if page.clr.IsEmpty() {
   549  		return nil
   550  	}
   551  	return *page.clr.Value
   552  }
   553  
   554  // Creates a new instance of the ConfigurationListResultPage type.
   555  func NewConfigurationListResultPage(cur ConfigurationListResult, getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage {
   556  	return ConfigurationListResultPage{
   557  		fn:  getNextPage,
   558  		clr: cur,
   559  	}
   560  }
   561  
   562  // ConfigurationProperties the properties of a configuration.
   563  type ConfigurationProperties struct {
   564  	// Value - Value of the configuration.
   565  	Value *string `json:"value,omitempty"`
   566  	// Description - READ-ONLY; Description of the configuration.
   567  	Description *string `json:"description,omitempty"`
   568  	// DefaultValue - READ-ONLY; Default value of the configuration.
   569  	DefaultValue *string `json:"defaultValue,omitempty"`
   570  	// DataType - READ-ONLY; Data type of the configuration.
   571  	DataType *string `json:"dataType,omitempty"`
   572  	// AllowedValues - READ-ONLY; Allowed values of the configuration.
   573  	AllowedValues *string `json:"allowedValues,omitempty"`
   574  	// Source - Source of the configuration. Possible values include: 'ConfigurationSourceSystemDefault', 'ConfigurationSourceUserOverride'
   575  	Source ConfigurationSource `json:"source,omitempty"`
   576  	// IsReadOnly - READ-ONLY; If is the configuration read only. Possible values include: 'IsReadOnlyTrue', 'IsReadOnlyFalse'
   577  	IsReadOnly IsReadOnly `json:"isReadOnly,omitempty"`
   578  	// IsConfigPendingRestart - READ-ONLY; If is the configuration pending restart or not. Possible values include: 'IsConfigPendingRestartTrue', 'IsConfigPendingRestartFalse'
   579  	IsConfigPendingRestart IsConfigPendingRestart `json:"isConfigPendingRestart,omitempty"`
   580  	// IsDynamicConfig - READ-ONLY; If is the configuration dynamic. Possible values include: 'IsDynamicConfigTrue', 'IsDynamicConfigFalse'
   581  	IsDynamicConfig IsDynamicConfig `json:"isDynamicConfig,omitempty"`
   582  }
   583  
   584  // MarshalJSON is the custom marshaler for ConfigurationProperties.
   585  func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) {
   586  	objectMap := make(map[string]interface{})
   587  	if cp.Value != nil {
   588  		objectMap["value"] = cp.Value
   589  	}
   590  	if cp.Source != "" {
   591  		objectMap["source"] = cp.Source
   592  	}
   593  	return json.Marshal(objectMap)
   594  }
   595  
   596  // ConfigurationsBatchUpdateFuture an abstraction for monitoring and retrieving the results of a
   597  // long-running operation.
   598  type ConfigurationsBatchUpdateFuture struct {
   599  	azure.FutureAPI
   600  	// Result returns the result of the asynchronous operation.
   601  	// If the operation has not completed it will return an error.
   602  	Result func(ConfigurationsClient) (ConfigurationListResult, error)
   603  }
   604  
   605  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   606  func (future *ConfigurationsBatchUpdateFuture) UnmarshalJSON(body []byte) error {
   607  	var azFuture azure.Future
   608  	if err := json.Unmarshal(body, &azFuture); err != nil {
   609  		return err
   610  	}
   611  	future.FutureAPI = &azFuture
   612  	future.Result = future.result
   613  	return nil
   614  }
   615  
   616  // result is the default implementation for ConfigurationsBatchUpdateFuture.Result.
   617  func (future *ConfigurationsBatchUpdateFuture) result(client ConfigurationsClient) (clr ConfigurationListResult, err error) {
   618  	var done bool
   619  	done, err = future.DoneWithContext(context.Background(), client)
   620  	if err != nil {
   621  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsBatchUpdateFuture", "Result", future.Response(), "Polling failure")
   622  		return
   623  	}
   624  	if !done {
   625  		clr.Response.Response = future.Response()
   626  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ConfigurationsBatchUpdateFuture")
   627  		return
   628  	}
   629  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   630  	if clr.Response.Response, err = future.GetResult(sender); err == nil && clr.Response.Response.StatusCode != http.StatusNoContent {
   631  		clr, err = client.BatchUpdateResponder(clr.Response.Response)
   632  		if err != nil {
   633  			err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsBatchUpdateFuture", "Result", clr.Response.Response, "Failure responding to request")
   634  		}
   635  	}
   636  	return
   637  }
   638  
   639  // ConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
   640  // operation.
   641  type ConfigurationsUpdateFuture struct {
   642  	azure.FutureAPI
   643  	// Result returns the result of the asynchronous operation.
   644  	// If the operation has not completed it will return an error.
   645  	Result func(ConfigurationsClient) (Configuration, error)
   646  }
   647  
   648  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   649  func (future *ConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error {
   650  	var azFuture azure.Future
   651  	if err := json.Unmarshal(body, &azFuture); err != nil {
   652  		return err
   653  	}
   654  	future.FutureAPI = &azFuture
   655  	future.Result = future.result
   656  	return nil
   657  }
   658  
   659  // result is the default implementation for ConfigurationsUpdateFuture.Result.
   660  func (future *ConfigurationsUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) {
   661  	var done bool
   662  	done, err = future.DoneWithContext(context.Background(), client)
   663  	if err != nil {
   664  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure")
   665  		return
   666  	}
   667  	if !done {
   668  		c.Response.Response = future.Response()
   669  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ConfigurationsUpdateFuture")
   670  		return
   671  	}
   672  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   673  	if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
   674  		c, err = client.UpdateResponder(c.Response.Response)
   675  		if err != nil {
   676  			err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
   677  		}
   678  	}
   679  	return
   680  }
   681  
   682  // Database represents a Database.
   683  type Database struct {
   684  	autorest.Response `json:"-"`
   685  	// DatabaseProperties - The properties of a database.
   686  	*DatabaseProperties `json:"properties,omitempty"`
   687  	// SystemData - READ-ONLY; The system metadata relating to this resource.
   688  	SystemData *SystemData `json:"systemData,omitempty"`
   689  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
   690  	ID *string `json:"id,omitempty"`
   691  	// Name - READ-ONLY; The name of the resource
   692  	Name *string `json:"name,omitempty"`
   693  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
   694  	Type *string `json:"type,omitempty"`
   695  }
   696  
   697  // MarshalJSON is the custom marshaler for Database.
   698  func (d Database) MarshalJSON() ([]byte, error) {
   699  	objectMap := make(map[string]interface{})
   700  	if d.DatabaseProperties != nil {
   701  		objectMap["properties"] = d.DatabaseProperties
   702  	}
   703  	return json.Marshal(objectMap)
   704  }
   705  
   706  // UnmarshalJSON is the custom unmarshaler for Database struct.
   707  func (d *Database) UnmarshalJSON(body []byte) error {
   708  	var m map[string]*json.RawMessage
   709  	err := json.Unmarshal(body, &m)
   710  	if err != nil {
   711  		return err
   712  	}
   713  	for k, v := range m {
   714  		switch k {
   715  		case "properties":
   716  			if v != nil {
   717  				var databaseProperties DatabaseProperties
   718  				err = json.Unmarshal(*v, &databaseProperties)
   719  				if err != nil {
   720  					return err
   721  				}
   722  				d.DatabaseProperties = &databaseProperties
   723  			}
   724  		case "systemData":
   725  			if v != nil {
   726  				var systemData SystemData
   727  				err = json.Unmarshal(*v, &systemData)
   728  				if err != nil {
   729  					return err
   730  				}
   731  				d.SystemData = &systemData
   732  			}
   733  		case "id":
   734  			if v != nil {
   735  				var ID string
   736  				err = json.Unmarshal(*v, &ID)
   737  				if err != nil {
   738  					return err
   739  				}
   740  				d.ID = &ID
   741  			}
   742  		case "name":
   743  			if v != nil {
   744  				var name string
   745  				err = json.Unmarshal(*v, &name)
   746  				if err != nil {
   747  					return err
   748  				}
   749  				d.Name = &name
   750  			}
   751  		case "type":
   752  			if v != nil {
   753  				var typeVar string
   754  				err = json.Unmarshal(*v, &typeVar)
   755  				if err != nil {
   756  					return err
   757  				}
   758  				d.Type = &typeVar
   759  			}
   760  		}
   761  	}
   762  
   763  	return nil
   764  }
   765  
   766  // DatabaseListResult a List of databases.
   767  type DatabaseListResult struct {
   768  	autorest.Response `json:"-"`
   769  	// Value - The list of databases housed in a server
   770  	Value *[]Database `json:"value,omitempty"`
   771  	// NextLink - The link used to get the next page of operations.
   772  	NextLink *string `json:"nextLink,omitempty"`
   773  }
   774  
   775  // DatabaseListResultIterator provides access to a complete listing of Database values.
   776  type DatabaseListResultIterator struct {
   777  	i    int
   778  	page DatabaseListResultPage
   779  }
   780  
   781  // NextWithContext advances to the next value.  If there was an error making
   782  // the request the iterator does not advance and the error is returned.
   783  func (iter *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) {
   784  	if tracing.IsEnabled() {
   785  		ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.NextWithContext")
   786  		defer func() {
   787  			sc := -1
   788  			if iter.Response().Response.Response != nil {
   789  				sc = iter.Response().Response.Response.StatusCode
   790  			}
   791  			tracing.EndSpan(ctx, sc, err)
   792  		}()
   793  	}
   794  	iter.i++
   795  	if iter.i < len(iter.page.Values()) {
   796  		return nil
   797  	}
   798  	err = iter.page.NextWithContext(ctx)
   799  	if err != nil {
   800  		iter.i--
   801  		return err
   802  	}
   803  	iter.i = 0
   804  	return nil
   805  }
   806  
   807  // Next advances to the next value.  If there was an error making
   808  // the request the iterator does not advance and the error is returned.
   809  // Deprecated: Use NextWithContext() instead.
   810  func (iter *DatabaseListResultIterator) Next() error {
   811  	return iter.NextWithContext(context.Background())
   812  }
   813  
   814  // NotDone returns true if the enumeration should be started or is not yet complete.
   815  func (iter DatabaseListResultIterator) NotDone() bool {
   816  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
   817  }
   818  
   819  // Response returns the raw server response from the last page request.
   820  func (iter DatabaseListResultIterator) Response() DatabaseListResult {
   821  	return iter.page.Response()
   822  }
   823  
   824  // Value returns the current value or a zero-initialized value if the
   825  // iterator has advanced beyond the end of the collection.
   826  func (iter DatabaseListResultIterator) Value() Database {
   827  	if !iter.page.NotDone() {
   828  		return Database{}
   829  	}
   830  	return iter.page.Values()[iter.i]
   831  }
   832  
   833  // Creates a new instance of the DatabaseListResultIterator type.
   834  func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator {
   835  	return DatabaseListResultIterator{page: page}
   836  }
   837  
   838  // IsEmpty returns true if the ListResult contains no values.
   839  func (dlr DatabaseListResult) IsEmpty() bool {
   840  	return dlr.Value == nil || len(*dlr.Value) == 0
   841  }
   842  
   843  // hasNextLink returns true if the NextLink is not empty.
   844  func (dlr DatabaseListResult) hasNextLink() bool {
   845  	return dlr.NextLink != nil && len(*dlr.NextLink) != 0
   846  }
   847  
   848  // databaseListResultPreparer prepares a request to retrieve the next set of results.
   849  // It returns nil if no more results exist.
   850  func (dlr DatabaseListResult) databaseListResultPreparer(ctx context.Context) (*http.Request, error) {
   851  	if !dlr.hasNextLink() {
   852  		return nil, nil
   853  	}
   854  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
   855  		autorest.AsJSON(),
   856  		autorest.AsGet(),
   857  		autorest.WithBaseURL(to.String(dlr.NextLink)))
   858  }
   859  
   860  // DatabaseListResultPage contains a page of Database values.
   861  type DatabaseListResultPage struct {
   862  	fn  func(context.Context, DatabaseListResult) (DatabaseListResult, error)
   863  	dlr DatabaseListResult
   864  }
   865  
   866  // NextWithContext advances to the next page of values.  If there was an error making
   867  // the request the page does not advance and the error is returned.
   868  func (page *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) {
   869  	if tracing.IsEnabled() {
   870  		ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.NextWithContext")
   871  		defer func() {
   872  			sc := -1
   873  			if page.Response().Response.Response != nil {
   874  				sc = page.Response().Response.Response.StatusCode
   875  			}
   876  			tracing.EndSpan(ctx, sc, err)
   877  		}()
   878  	}
   879  	for {
   880  		next, err := page.fn(ctx, page.dlr)
   881  		if err != nil {
   882  			return err
   883  		}
   884  		page.dlr = next
   885  		if !next.hasNextLink() || !next.IsEmpty() {
   886  			break
   887  		}
   888  	}
   889  	return nil
   890  }
   891  
   892  // Next advances to the next page of values.  If there was an error making
   893  // the request the page does not advance and the error is returned.
   894  // Deprecated: Use NextWithContext() instead.
   895  func (page *DatabaseListResultPage) Next() error {
   896  	return page.NextWithContext(context.Background())
   897  }
   898  
   899  // NotDone returns true if the page enumeration should be started or is not yet complete.
   900  func (page DatabaseListResultPage) NotDone() bool {
   901  	return !page.dlr.IsEmpty()
   902  }
   903  
   904  // Response returns the raw server response from the last page request.
   905  func (page DatabaseListResultPage) Response() DatabaseListResult {
   906  	return page.dlr
   907  }
   908  
   909  // Values returns the slice of values for the current page or nil if there are no values.
   910  func (page DatabaseListResultPage) Values() []Database {
   911  	if page.dlr.IsEmpty() {
   912  		return nil
   913  	}
   914  	return *page.dlr.Value
   915  }
   916  
   917  // Creates a new instance of the DatabaseListResultPage type.
   918  func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage {
   919  	return DatabaseListResultPage{
   920  		fn:  getNextPage,
   921  		dlr: cur,
   922  	}
   923  }
   924  
   925  // DatabaseProperties the properties of a database.
   926  type DatabaseProperties struct {
   927  	// Charset - The charset of the database.
   928  	Charset *string `json:"charset,omitempty"`
   929  	// Collation - The collation of the database.
   930  	Collation *string `json:"collation,omitempty"`
   931  }
   932  
   933  // DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
   934  // operation.
   935  type DatabasesCreateOrUpdateFuture struct {
   936  	azure.FutureAPI
   937  	// Result returns the result of the asynchronous operation.
   938  	// If the operation has not completed it will return an error.
   939  	Result func(DatabasesClient) (Database, error)
   940  }
   941  
   942  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   943  func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
   944  	var azFuture azure.Future
   945  	if err := json.Unmarshal(body, &azFuture); err != nil {
   946  		return err
   947  	}
   948  	future.FutureAPI = &azFuture
   949  	future.Result = future.result
   950  	return nil
   951  }
   952  
   953  // result is the default implementation for DatabasesCreateOrUpdateFuture.Result.
   954  func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) {
   955  	var done bool
   956  	done, err = future.DoneWithContext(context.Background(), client)
   957  	if err != nil {
   958  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
   959  		return
   960  	}
   961  	if !done {
   962  		d.Response.Response = future.Response()
   963  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.DatabasesCreateOrUpdateFuture")
   964  		return
   965  	}
   966  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   967  	if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
   968  		d, err = client.CreateOrUpdateResponder(d.Response.Response)
   969  		if err != nil {
   970  			err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request")
   971  		}
   972  	}
   973  	return
   974  }
   975  
   976  // DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
   977  // operation.
   978  type DatabasesDeleteFuture struct {
   979  	azure.FutureAPI
   980  	// Result returns the result of the asynchronous operation.
   981  	// If the operation has not completed it will return an error.
   982  	Result func(DatabasesClient) (autorest.Response, error)
   983  }
   984  
   985  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
   986  func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error {
   987  	var azFuture azure.Future
   988  	if err := json.Unmarshal(body, &azFuture); err != nil {
   989  		return err
   990  	}
   991  	future.FutureAPI = &azFuture
   992  	future.Result = future.result
   993  	return nil
   994  }
   995  
   996  // result is the default implementation for DatabasesDeleteFuture.Result.
   997  func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) {
   998  	var done bool
   999  	done, err = future.DoneWithContext(context.Background(), client)
  1000  	if err != nil {
  1001  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
  1002  		return
  1003  	}
  1004  	if !done {
  1005  		ar.Response = future.Response()
  1006  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.DatabasesDeleteFuture")
  1007  		return
  1008  	}
  1009  	ar.Response = future.Response()
  1010  	return
  1011  }
  1012  
  1013  // DelegatedSubnetUsage delegated subnet usage data.
  1014  type DelegatedSubnetUsage struct {
  1015  	// SubnetName - READ-ONLY; name of the subnet
  1016  	SubnetName *string `json:"subnetName,omitempty"`
  1017  	// Usage - READ-ONLY; Number of used delegated subnets
  1018  	Usage *int64 `json:"usage,omitempty"`
  1019  }
  1020  
  1021  // MarshalJSON is the custom marshaler for DelegatedSubnetUsage.
  1022  func (dsu DelegatedSubnetUsage) MarshalJSON() ([]byte, error) {
  1023  	objectMap := make(map[string]interface{})
  1024  	return json.Marshal(objectMap)
  1025  }
  1026  
  1027  // ErrorAdditionalInfo the resource management error additional info.
  1028  type ErrorAdditionalInfo struct {
  1029  	// Type - READ-ONLY; The additional info type.
  1030  	Type *string `json:"type,omitempty"`
  1031  	// Info - READ-ONLY; The additional info.
  1032  	Info interface{} `json:"info,omitempty"`
  1033  }
  1034  
  1035  // MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
  1036  func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
  1037  	objectMap := make(map[string]interface{})
  1038  	return json.Marshal(objectMap)
  1039  }
  1040  
  1041  // ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
  1042  // failed operations. (This also follows the OData error response format.)
  1043  type ErrorResponse struct {
  1044  	// Code - READ-ONLY; The error code.
  1045  	Code *string `json:"code,omitempty"`
  1046  	// Message - READ-ONLY; The error message.
  1047  	Message *string `json:"message,omitempty"`
  1048  	// Target - READ-ONLY; The error target.
  1049  	Target *string `json:"target,omitempty"`
  1050  	// Details - READ-ONLY; The error details.
  1051  	Details *[]ErrorResponse `json:"details,omitempty"`
  1052  	// AdditionalInfo - READ-ONLY; The error additional info.
  1053  	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
  1054  }
  1055  
  1056  // MarshalJSON is the custom marshaler for ErrorResponse.
  1057  func (er ErrorResponse) MarshalJSON() ([]byte, error) {
  1058  	objectMap := make(map[string]interface{})
  1059  	return json.Marshal(objectMap)
  1060  }
  1061  
  1062  // FirewallRule represents a server firewall rule.
  1063  type FirewallRule struct {
  1064  	autorest.Response `json:"-"`
  1065  	// FirewallRuleProperties - The properties of a firewall rule.
  1066  	*FirewallRuleProperties `json:"properties,omitempty"`
  1067  	// SystemData - READ-ONLY; The system metadata relating to this resource.
  1068  	SystemData *SystemData `json:"systemData,omitempty"`
  1069  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1070  	ID *string `json:"id,omitempty"`
  1071  	// Name - READ-ONLY; The name of the resource
  1072  	Name *string `json:"name,omitempty"`
  1073  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1074  	Type *string `json:"type,omitempty"`
  1075  }
  1076  
  1077  // MarshalJSON is the custom marshaler for FirewallRule.
  1078  func (fr FirewallRule) MarshalJSON() ([]byte, error) {
  1079  	objectMap := make(map[string]interface{})
  1080  	if fr.FirewallRuleProperties != nil {
  1081  		objectMap["properties"] = fr.FirewallRuleProperties
  1082  	}
  1083  	return json.Marshal(objectMap)
  1084  }
  1085  
  1086  // UnmarshalJSON is the custom unmarshaler for FirewallRule struct.
  1087  func (fr *FirewallRule) UnmarshalJSON(body []byte) error {
  1088  	var m map[string]*json.RawMessage
  1089  	err := json.Unmarshal(body, &m)
  1090  	if err != nil {
  1091  		return err
  1092  	}
  1093  	for k, v := range m {
  1094  		switch k {
  1095  		case "properties":
  1096  			if v != nil {
  1097  				var firewallRuleProperties FirewallRuleProperties
  1098  				err = json.Unmarshal(*v, &firewallRuleProperties)
  1099  				if err != nil {
  1100  					return err
  1101  				}
  1102  				fr.FirewallRuleProperties = &firewallRuleProperties
  1103  			}
  1104  		case "systemData":
  1105  			if v != nil {
  1106  				var systemData SystemData
  1107  				err = json.Unmarshal(*v, &systemData)
  1108  				if err != nil {
  1109  					return err
  1110  				}
  1111  				fr.SystemData = &systemData
  1112  			}
  1113  		case "id":
  1114  			if v != nil {
  1115  				var ID string
  1116  				err = json.Unmarshal(*v, &ID)
  1117  				if err != nil {
  1118  					return err
  1119  				}
  1120  				fr.ID = &ID
  1121  			}
  1122  		case "name":
  1123  			if v != nil {
  1124  				var name string
  1125  				err = json.Unmarshal(*v, &name)
  1126  				if err != nil {
  1127  					return err
  1128  				}
  1129  				fr.Name = &name
  1130  			}
  1131  		case "type":
  1132  			if v != nil {
  1133  				var typeVar string
  1134  				err = json.Unmarshal(*v, &typeVar)
  1135  				if err != nil {
  1136  					return err
  1137  				}
  1138  				fr.Type = &typeVar
  1139  			}
  1140  		}
  1141  	}
  1142  
  1143  	return nil
  1144  }
  1145  
  1146  // FirewallRuleListResult a list of firewall rules.
  1147  type FirewallRuleListResult struct {
  1148  	autorest.Response `json:"-"`
  1149  	// Value - The list of firewall rules in a server.
  1150  	Value *[]FirewallRule `json:"value,omitempty"`
  1151  	// NextLink - The link used to get the next page of operations.
  1152  	NextLink *string `json:"nextLink,omitempty"`
  1153  }
  1154  
  1155  // FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values.
  1156  type FirewallRuleListResultIterator struct {
  1157  	i    int
  1158  	page FirewallRuleListResultPage
  1159  }
  1160  
  1161  // NextWithContext advances to the next value.  If there was an error making
  1162  // the request the iterator does not advance and the error is returned.
  1163  func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1164  	if tracing.IsEnabled() {
  1165  		ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext")
  1166  		defer func() {
  1167  			sc := -1
  1168  			if iter.Response().Response.Response != nil {
  1169  				sc = iter.Response().Response.Response.StatusCode
  1170  			}
  1171  			tracing.EndSpan(ctx, sc, err)
  1172  		}()
  1173  	}
  1174  	iter.i++
  1175  	if iter.i < len(iter.page.Values()) {
  1176  		return nil
  1177  	}
  1178  	err = iter.page.NextWithContext(ctx)
  1179  	if err != nil {
  1180  		iter.i--
  1181  		return err
  1182  	}
  1183  	iter.i = 0
  1184  	return nil
  1185  }
  1186  
  1187  // Next advances to the next value.  If there was an error making
  1188  // the request the iterator does not advance and the error is returned.
  1189  // Deprecated: Use NextWithContext() instead.
  1190  func (iter *FirewallRuleListResultIterator) Next() error {
  1191  	return iter.NextWithContext(context.Background())
  1192  }
  1193  
  1194  // NotDone returns true if the enumeration should be started or is not yet complete.
  1195  func (iter FirewallRuleListResultIterator) NotDone() bool {
  1196  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1197  }
  1198  
  1199  // Response returns the raw server response from the last page request.
  1200  func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult {
  1201  	return iter.page.Response()
  1202  }
  1203  
  1204  // Value returns the current value or a zero-initialized value if the
  1205  // iterator has advanced beyond the end of the collection.
  1206  func (iter FirewallRuleListResultIterator) Value() FirewallRule {
  1207  	if !iter.page.NotDone() {
  1208  		return FirewallRule{}
  1209  	}
  1210  	return iter.page.Values()[iter.i]
  1211  }
  1212  
  1213  // Creates a new instance of the FirewallRuleListResultIterator type.
  1214  func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator {
  1215  	return FirewallRuleListResultIterator{page: page}
  1216  }
  1217  
  1218  // IsEmpty returns true if the ListResult contains no values.
  1219  func (frlr FirewallRuleListResult) IsEmpty() bool {
  1220  	return frlr.Value == nil || len(*frlr.Value) == 0
  1221  }
  1222  
  1223  // hasNextLink returns true if the NextLink is not empty.
  1224  func (frlr FirewallRuleListResult) hasNextLink() bool {
  1225  	return frlr.NextLink != nil && len(*frlr.NextLink) != 0
  1226  }
  1227  
  1228  // firewallRuleListResultPreparer prepares a request to retrieve the next set of results.
  1229  // It returns nil if no more results exist.
  1230  func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
  1231  	if !frlr.hasNextLink() {
  1232  		return nil, nil
  1233  	}
  1234  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1235  		autorest.AsJSON(),
  1236  		autorest.AsGet(),
  1237  		autorest.WithBaseURL(to.String(frlr.NextLink)))
  1238  }
  1239  
  1240  // FirewallRuleListResultPage contains a page of FirewallRule values.
  1241  type FirewallRuleListResultPage struct {
  1242  	fn   func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)
  1243  	frlr FirewallRuleListResult
  1244  }
  1245  
  1246  // NextWithContext advances to the next page of values.  If there was an error making
  1247  // the request the page does not advance and the error is returned.
  1248  func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
  1249  	if tracing.IsEnabled() {
  1250  		ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext")
  1251  		defer func() {
  1252  			sc := -1
  1253  			if page.Response().Response.Response != nil {
  1254  				sc = page.Response().Response.Response.StatusCode
  1255  			}
  1256  			tracing.EndSpan(ctx, sc, err)
  1257  		}()
  1258  	}
  1259  	for {
  1260  		next, err := page.fn(ctx, page.frlr)
  1261  		if err != nil {
  1262  			return err
  1263  		}
  1264  		page.frlr = next
  1265  		if !next.hasNextLink() || !next.IsEmpty() {
  1266  			break
  1267  		}
  1268  	}
  1269  	return nil
  1270  }
  1271  
  1272  // Next advances to the next page of values.  If there was an error making
  1273  // the request the page does not advance and the error is returned.
  1274  // Deprecated: Use NextWithContext() instead.
  1275  func (page *FirewallRuleListResultPage) Next() error {
  1276  	return page.NextWithContext(context.Background())
  1277  }
  1278  
  1279  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1280  func (page FirewallRuleListResultPage) NotDone() bool {
  1281  	return !page.frlr.IsEmpty()
  1282  }
  1283  
  1284  // Response returns the raw server response from the last page request.
  1285  func (page FirewallRuleListResultPage) Response() FirewallRuleListResult {
  1286  	return page.frlr
  1287  }
  1288  
  1289  // Values returns the slice of values for the current page or nil if there are no values.
  1290  func (page FirewallRuleListResultPage) Values() []FirewallRule {
  1291  	if page.frlr.IsEmpty() {
  1292  		return nil
  1293  	}
  1294  	return *page.frlr.Value
  1295  }
  1296  
  1297  // Creates a new instance of the FirewallRuleListResultPage type.
  1298  func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {
  1299  	return FirewallRuleListResultPage{
  1300  		fn:   getNextPage,
  1301  		frlr: cur,
  1302  	}
  1303  }
  1304  
  1305  // FirewallRuleProperties the properties of a server firewall rule.
  1306  type FirewallRuleProperties struct {
  1307  	// StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format.
  1308  	StartIPAddress *string `json:"startIpAddress,omitempty"`
  1309  	// EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format.
  1310  	EndIPAddress *string `json:"endIpAddress,omitempty"`
  1311  }
  1312  
  1313  // FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
  1314  // long-running operation.
  1315  type FirewallRulesCreateOrUpdateFuture struct {
  1316  	azure.FutureAPI
  1317  	// Result returns the result of the asynchronous operation.
  1318  	// If the operation has not completed it will return an error.
  1319  	Result func(FirewallRulesClient) (FirewallRule, error)
  1320  }
  1321  
  1322  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1323  func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
  1324  	var azFuture azure.Future
  1325  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1326  		return err
  1327  	}
  1328  	future.FutureAPI = &azFuture
  1329  	future.Result = future.result
  1330  	return nil
  1331  }
  1332  
  1333  // result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result.
  1334  func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) {
  1335  	var done bool
  1336  	done, err = future.DoneWithContext(context.Background(), client)
  1337  	if err != nil {
  1338  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
  1339  		return
  1340  	}
  1341  	if !done {
  1342  		fr.Response.Response = future.Response()
  1343  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture")
  1344  		return
  1345  	}
  1346  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1347  	if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent {
  1348  		fr, err = client.CreateOrUpdateResponder(fr.Response.Response)
  1349  		if err != nil {
  1350  			err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request")
  1351  		}
  1352  	}
  1353  	return
  1354  }
  1355  
  1356  // FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  1357  // operation.
  1358  type FirewallRulesDeleteFuture struct {
  1359  	azure.FutureAPI
  1360  	// Result returns the result of the asynchronous operation.
  1361  	// If the operation has not completed it will return an error.
  1362  	Result func(FirewallRulesClient) (autorest.Response, error)
  1363  }
  1364  
  1365  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  1366  func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error {
  1367  	var azFuture azure.Future
  1368  	if err := json.Unmarshal(body, &azFuture); err != nil {
  1369  		return err
  1370  	}
  1371  	future.FutureAPI = &azFuture
  1372  	future.Result = future.result
  1373  	return nil
  1374  }
  1375  
  1376  // result is the default implementation for FirewallRulesDeleteFuture.Result.
  1377  func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) {
  1378  	var done bool
  1379  	done, err = future.DoneWithContext(context.Background(), client)
  1380  	if err != nil {
  1381  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure")
  1382  		return
  1383  	}
  1384  	if !done {
  1385  		ar.Response = future.Response()
  1386  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.FirewallRulesDeleteFuture")
  1387  		return
  1388  	}
  1389  	ar.Response = future.Response()
  1390  	return
  1391  }
  1392  
  1393  // GetPrivateDNSZoneSuffixResponse the response of get private dns zone suffix.
  1394  type GetPrivateDNSZoneSuffixResponse struct {
  1395  	autorest.Response `json:"-"`
  1396  	// PrivateDNSZoneSuffix - Represents the private DNS zone suffix.
  1397  	PrivateDNSZoneSuffix *string `json:"privateDnsZoneSuffix,omitempty"`
  1398  }
  1399  
  1400  // HighAvailability network related properties of a server
  1401  type HighAvailability struct {
  1402  	// Mode - High availability mode for a server. Possible values include: 'HighAvailabilityModeEnabled', 'HighAvailabilityModeDisabled', 'HighAvailabilityModeZoneRedundant', 'HighAvailabilityModeSameZone'
  1403  	Mode HighAvailabilityMode `json:"mode,omitempty"`
  1404  	// State - READ-ONLY; The state of server high availability. Possible values include: 'HighAvailabilityStateNotEnabled', 'HighAvailabilityStateCreatingStandby', 'HighAvailabilityStateHealthy', 'HighAvailabilityStateFailingOver', 'HighAvailabilityStateRemovingStandby'
  1405  	State HighAvailabilityState `json:"state,omitempty"`
  1406  	// StandbyAvailabilityZone - Availability zone of the standby server.
  1407  	StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"`
  1408  }
  1409  
  1410  // MarshalJSON is the custom marshaler for HighAvailability.
  1411  func (ha HighAvailability) MarshalJSON() ([]byte, error) {
  1412  	objectMap := make(map[string]interface{})
  1413  	if ha.Mode != "" {
  1414  		objectMap["mode"] = ha.Mode
  1415  	}
  1416  	if ha.StandbyAvailabilityZone != nil {
  1417  		objectMap["standbyAvailabilityZone"] = ha.StandbyAvailabilityZone
  1418  	}
  1419  	return json.Marshal(objectMap)
  1420  }
  1421  
  1422  // Identity identity for the resource.
  1423  type Identity struct {
  1424  	// PrincipalID - READ-ONLY; The principal ID of resource identity.
  1425  	PrincipalID *string `json:"principalId,omitempty"`
  1426  	// TenantID - READ-ONLY; The tenant ID of resource.
  1427  	TenantID *string `json:"tenantId,omitempty"`
  1428  	// Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned'
  1429  	Type ResourceIdentityType `json:"type,omitempty"`
  1430  }
  1431  
  1432  // MarshalJSON is the custom marshaler for Identity.
  1433  func (i Identity) MarshalJSON() ([]byte, error) {
  1434  	objectMap := make(map[string]interface{})
  1435  	if i.Type != "" {
  1436  		objectMap["type"] = i.Type
  1437  	}
  1438  	return json.Marshal(objectMap)
  1439  }
  1440  
  1441  // MaintenanceWindow maintenance window of a server.
  1442  type MaintenanceWindow struct {
  1443  	// CustomWindow - indicates whether custom window is enabled or disabled
  1444  	CustomWindow *string `json:"customWindow,omitempty"`
  1445  	// StartHour - start hour for maintenance window
  1446  	StartHour *int32 `json:"startHour,omitempty"`
  1447  	// StartMinute - start minute for maintenance window
  1448  	StartMinute *int32 `json:"startMinute,omitempty"`
  1449  	// DayOfWeek - day of week for maintenance window
  1450  	DayOfWeek *int32 `json:"dayOfWeek,omitempty"`
  1451  }
  1452  
  1453  // NameAvailability represents a resource name availability.
  1454  type NameAvailability struct {
  1455  	autorest.Response `json:"-"`
  1456  	// Message - Error Message.
  1457  	Message *string `json:"message,omitempty"`
  1458  	// NameAvailable - Indicates whether the resource name is available.
  1459  	NameAvailable *bool `json:"nameAvailable,omitempty"`
  1460  	// Reason - Reason for name being unavailable.
  1461  	Reason *string `json:"reason,omitempty"`
  1462  }
  1463  
  1464  // NameAvailabilityRequest request from client to check resource name availability.
  1465  type NameAvailabilityRequest struct {
  1466  	// Name - Resource name to verify.
  1467  	Name *string `json:"name,omitempty"`
  1468  	// Type - Resource type used for verification.
  1469  	Type *string `json:"type,omitempty"`
  1470  }
  1471  
  1472  // Network network related properties of a server
  1473  type Network struct {
  1474  	// PublicNetworkAccess - READ-ONLY; Whether or not public network access is allowed for this server. Value is 'Disabled' when server has VNet integration. Possible values include: 'EnableStatusEnumEnabled', 'EnableStatusEnumDisabled'
  1475  	PublicNetworkAccess EnableStatusEnum `json:"publicNetworkAccess,omitempty"`
  1476  	// DelegatedSubnetResourceID - Delegated subnet resource id used to setup vnet for a server.
  1477  	DelegatedSubnetResourceID *string `json:"delegatedSubnetResourceId,omitempty"`
  1478  	// PrivateDNSZoneResourceID - Private DNS zone resource id.
  1479  	PrivateDNSZoneResourceID *string `json:"privateDnsZoneResourceId,omitempty"`
  1480  }
  1481  
  1482  // MarshalJSON is the custom marshaler for Network.
  1483  func (n Network) MarshalJSON() ([]byte, error) {
  1484  	objectMap := make(map[string]interface{})
  1485  	if n.DelegatedSubnetResourceID != nil {
  1486  		objectMap["delegatedSubnetResourceId"] = n.DelegatedSubnetResourceID
  1487  	}
  1488  	if n.PrivateDNSZoneResourceID != nil {
  1489  		objectMap["privateDnsZoneResourceId"] = n.PrivateDNSZoneResourceID
  1490  	}
  1491  	return json.Marshal(objectMap)
  1492  }
  1493  
  1494  // Operation REST API operation definition.
  1495  type Operation struct {
  1496  	// Name - The name of the operation being performed on this particular object.
  1497  	Name *string `json:"name,omitempty"`
  1498  	// Display - The localized display information for this particular operation or action.
  1499  	Display *OperationDisplay `json:"display,omitempty"`
  1500  	// Origin - The intended executor of the operation.
  1501  	Origin *string `json:"origin,omitempty"`
  1502  	// Properties - Additional descriptions for the operation.
  1503  	Properties map[string]interface{} `json:"properties"`
  1504  }
  1505  
  1506  // MarshalJSON is the custom marshaler for Operation.
  1507  func (o Operation) MarshalJSON() ([]byte, error) {
  1508  	objectMap := make(map[string]interface{})
  1509  	if o.Name != nil {
  1510  		objectMap["name"] = o.Name
  1511  	}
  1512  	if o.Display != nil {
  1513  		objectMap["display"] = o.Display
  1514  	}
  1515  	if o.Origin != nil {
  1516  		objectMap["origin"] = o.Origin
  1517  	}
  1518  	if o.Properties != nil {
  1519  		objectMap["properties"] = o.Properties
  1520  	}
  1521  	return json.Marshal(objectMap)
  1522  }
  1523  
  1524  // OperationDisplay display metadata associated with the operation.
  1525  type OperationDisplay struct {
  1526  	// Provider - Operation resource provider name.
  1527  	Provider *string `json:"provider,omitempty"`
  1528  	// Resource - Resource on which the operation is performed.
  1529  	Resource *string `json:"resource,omitempty"`
  1530  	// Operation - Localized friendly name for the operation.
  1531  	Operation *string `json:"operation,omitempty"`
  1532  	// Description - Operation description.
  1533  	Description *string `json:"description,omitempty"`
  1534  }
  1535  
  1536  // OperationListResult a list of resource provider operations.
  1537  type OperationListResult struct {
  1538  	autorest.Response `json:"-"`
  1539  	// Value - Collection of available operation details
  1540  	Value *[]Operation `json:"value,omitempty"`
  1541  	// NextLink - URL client should use to fetch the next page (per server side paging).
  1542  	NextLink *string `json:"nextLink,omitempty"`
  1543  }
  1544  
  1545  // OperationListResultIterator provides access to a complete listing of Operation values.
  1546  type OperationListResultIterator struct {
  1547  	i    int
  1548  	page OperationListResultPage
  1549  }
  1550  
  1551  // NextWithContext advances to the next value.  If there was an error making
  1552  // the request the iterator does not advance and the error is returned.
  1553  func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
  1554  	if tracing.IsEnabled() {
  1555  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
  1556  		defer func() {
  1557  			sc := -1
  1558  			if iter.Response().Response.Response != nil {
  1559  				sc = iter.Response().Response.Response.StatusCode
  1560  			}
  1561  			tracing.EndSpan(ctx, sc, err)
  1562  		}()
  1563  	}
  1564  	iter.i++
  1565  	if iter.i < len(iter.page.Values()) {
  1566  		return nil
  1567  	}
  1568  	err = iter.page.NextWithContext(ctx)
  1569  	if err != nil {
  1570  		iter.i--
  1571  		return err
  1572  	}
  1573  	iter.i = 0
  1574  	return nil
  1575  }
  1576  
  1577  // Next advances to the next value.  If there was an error making
  1578  // the request the iterator does not advance and the error is returned.
  1579  // Deprecated: Use NextWithContext() instead.
  1580  func (iter *OperationListResultIterator) Next() error {
  1581  	return iter.NextWithContext(context.Background())
  1582  }
  1583  
  1584  // NotDone returns true if the enumeration should be started or is not yet complete.
  1585  func (iter OperationListResultIterator) NotDone() bool {
  1586  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1587  }
  1588  
  1589  // Response returns the raw server response from the last page request.
  1590  func (iter OperationListResultIterator) Response() OperationListResult {
  1591  	return iter.page.Response()
  1592  }
  1593  
  1594  // Value returns the current value or a zero-initialized value if the
  1595  // iterator has advanced beyond the end of the collection.
  1596  func (iter OperationListResultIterator) Value() Operation {
  1597  	if !iter.page.NotDone() {
  1598  		return Operation{}
  1599  	}
  1600  	return iter.page.Values()[iter.i]
  1601  }
  1602  
  1603  // Creates a new instance of the OperationListResultIterator type.
  1604  func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
  1605  	return OperationListResultIterator{page: page}
  1606  }
  1607  
  1608  // IsEmpty returns true if the ListResult contains no values.
  1609  func (olr OperationListResult) IsEmpty() bool {
  1610  	return olr.Value == nil || len(*olr.Value) == 0
  1611  }
  1612  
  1613  // hasNextLink returns true if the NextLink is not empty.
  1614  func (olr OperationListResult) hasNextLink() bool {
  1615  	return olr.NextLink != nil && len(*olr.NextLink) != 0
  1616  }
  1617  
  1618  // operationListResultPreparer prepares a request to retrieve the next set of results.
  1619  // It returns nil if no more results exist.
  1620  func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
  1621  	if !olr.hasNextLink() {
  1622  		return nil, nil
  1623  	}
  1624  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1625  		autorest.AsJSON(),
  1626  		autorest.AsGet(),
  1627  		autorest.WithBaseURL(to.String(olr.NextLink)))
  1628  }
  1629  
  1630  // OperationListResultPage contains a page of Operation values.
  1631  type OperationListResultPage struct {
  1632  	fn  func(context.Context, OperationListResult) (OperationListResult, error)
  1633  	olr OperationListResult
  1634  }
  1635  
  1636  // NextWithContext advances to the next page of values.  If there was an error making
  1637  // the request the page does not advance and the error is returned.
  1638  func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
  1639  	if tracing.IsEnabled() {
  1640  		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
  1641  		defer func() {
  1642  			sc := -1
  1643  			if page.Response().Response.Response != nil {
  1644  				sc = page.Response().Response.Response.StatusCode
  1645  			}
  1646  			tracing.EndSpan(ctx, sc, err)
  1647  		}()
  1648  	}
  1649  	for {
  1650  		next, err := page.fn(ctx, page.olr)
  1651  		if err != nil {
  1652  			return err
  1653  		}
  1654  		page.olr = next
  1655  		if !next.hasNextLink() || !next.IsEmpty() {
  1656  			break
  1657  		}
  1658  	}
  1659  	return nil
  1660  }
  1661  
  1662  // Next advances to the next page of values.  If there was an error making
  1663  // the request the page does not advance and the error is returned.
  1664  // Deprecated: Use NextWithContext() instead.
  1665  func (page *OperationListResultPage) Next() error {
  1666  	return page.NextWithContext(context.Background())
  1667  }
  1668  
  1669  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1670  func (page OperationListResultPage) NotDone() bool {
  1671  	return !page.olr.IsEmpty()
  1672  }
  1673  
  1674  // Response returns the raw server response from the last page request.
  1675  func (page OperationListResultPage) Response() OperationListResult {
  1676  	return page.olr
  1677  }
  1678  
  1679  // Values returns the slice of values for the current page or nil if there are no values.
  1680  func (page OperationListResultPage) Values() []Operation {
  1681  	if page.olr.IsEmpty() {
  1682  		return nil
  1683  	}
  1684  	return *page.olr.Value
  1685  }
  1686  
  1687  // Creates a new instance of the OperationListResultPage type.
  1688  func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
  1689  	return OperationListResultPage{
  1690  		fn:  getNextPage,
  1691  		olr: cur,
  1692  	}
  1693  }
  1694  
  1695  // Plan plan for the resource.
  1696  type Plan struct {
  1697  	// Name - A user defined name of the 3rd Party Artifact that is being procured.
  1698  	Name *string `json:"name,omitempty"`
  1699  	// Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic
  1700  	Publisher *string `json:"publisher,omitempty"`
  1701  	// Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding.
  1702  	Product *string `json:"product,omitempty"`
  1703  	// PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact.
  1704  	PromotionCode *string `json:"promotionCode,omitempty"`
  1705  	// Version - The version of the desired product/artifact.
  1706  	Version *string `json:"version,omitempty"`
  1707  }
  1708  
  1709  // ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not
  1710  // have tags and a location
  1711  type ProxyResource struct {
  1712  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1713  	ID *string `json:"id,omitempty"`
  1714  	// Name - READ-ONLY; The name of the resource
  1715  	Name *string `json:"name,omitempty"`
  1716  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1717  	Type *string `json:"type,omitempty"`
  1718  }
  1719  
  1720  // MarshalJSON is the custom marshaler for ProxyResource.
  1721  func (pr ProxyResource) MarshalJSON() ([]byte, error) {
  1722  	objectMap := make(map[string]interface{})
  1723  	return json.Marshal(objectMap)
  1724  }
  1725  
  1726  // Resource common fields that are returned in the response for all Azure Resource Manager resources
  1727  type Resource struct {
  1728  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1729  	ID *string `json:"id,omitempty"`
  1730  	// Name - READ-ONLY; The name of the resource
  1731  	Name *string `json:"name,omitempty"`
  1732  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1733  	Type *string `json:"type,omitempty"`
  1734  }
  1735  
  1736  // MarshalJSON is the custom marshaler for Resource.
  1737  func (r Resource) MarshalJSON() ([]byte, error) {
  1738  	objectMap := make(map[string]interface{})
  1739  	return json.Marshal(objectMap)
  1740  }
  1741  
  1742  // ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed
  1743  // properties for a resource. Except properties bag, there cannot be a top level property outside of this
  1744  // set.
  1745  type ResourceModelWithAllowedPropertySet struct {
  1746  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1747  	ID *string `json:"id,omitempty"`
  1748  	// Name - READ-ONLY; The name of the resource
  1749  	Name *string `json:"name,omitempty"`
  1750  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1751  	Type *string `json:"type,omitempty"`
  1752  	// Location - The geo-location where the resource lives
  1753  	Location *string `json:"location,omitempty"`
  1754  	// ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource.
  1755  	ManagedBy *string `json:"managedBy,omitempty"`
  1756  	// Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource provider must validate and persist this value.
  1757  	Kind *string `json:"kind,omitempty"`
  1758  	// Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention.  Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.
  1759  	Etag *string `json:"etag,omitempty"`
  1760  	// Tags - Resource tags.
  1761  	Tags     map[string]*string                           `json:"tags"`
  1762  	Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"`
  1763  	Sku      *ResourceModelWithAllowedPropertySetSku      `json:"sku,omitempty"`
  1764  	Plan     *ResourceModelWithAllowedPropertySetPlan     `json:"plan,omitempty"`
  1765  }
  1766  
  1767  // MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet.
  1768  func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) {
  1769  	objectMap := make(map[string]interface{})
  1770  	if rmwaps.Location != nil {
  1771  		objectMap["location"] = rmwaps.Location
  1772  	}
  1773  	if rmwaps.ManagedBy != nil {
  1774  		objectMap["managedBy"] = rmwaps.ManagedBy
  1775  	}
  1776  	if rmwaps.Kind != nil {
  1777  		objectMap["kind"] = rmwaps.Kind
  1778  	}
  1779  	if rmwaps.Tags != nil {
  1780  		objectMap["tags"] = rmwaps.Tags
  1781  	}
  1782  	if rmwaps.Identity != nil {
  1783  		objectMap["identity"] = rmwaps.Identity
  1784  	}
  1785  	if rmwaps.Sku != nil {
  1786  		objectMap["sku"] = rmwaps.Sku
  1787  	}
  1788  	if rmwaps.Plan != nil {
  1789  		objectMap["plan"] = rmwaps.Plan
  1790  	}
  1791  	return json.Marshal(objectMap)
  1792  }
  1793  
  1794  // ResourceModelWithAllowedPropertySetIdentity ...
  1795  type ResourceModelWithAllowedPropertySetIdentity struct {
  1796  	// PrincipalID - READ-ONLY; The principal ID of resource identity.
  1797  	PrincipalID *string `json:"principalId,omitempty"`
  1798  	// TenantID - READ-ONLY; The tenant ID of resource.
  1799  	TenantID *string `json:"tenantId,omitempty"`
  1800  	// Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned'
  1801  	Type ResourceIdentityType `json:"type,omitempty"`
  1802  }
  1803  
  1804  // MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity.
  1805  func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) {
  1806  	objectMap := make(map[string]interface{})
  1807  	if rmwaps.Type != "" {
  1808  		objectMap["type"] = rmwaps.Type
  1809  	}
  1810  	return json.Marshal(objectMap)
  1811  }
  1812  
  1813  // ResourceModelWithAllowedPropertySetPlan ...
  1814  type ResourceModelWithAllowedPropertySetPlan struct {
  1815  	// Name - A user defined name of the 3rd Party Artifact that is being procured.
  1816  	Name *string `json:"name,omitempty"`
  1817  	// Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic
  1818  	Publisher *string `json:"publisher,omitempty"`
  1819  	// Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding.
  1820  	Product *string `json:"product,omitempty"`
  1821  	// PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact.
  1822  	PromotionCode *string `json:"promotionCode,omitempty"`
  1823  	// Version - The version of the desired product/artifact.
  1824  	Version *string `json:"version,omitempty"`
  1825  }
  1826  
  1827  // ResourceModelWithAllowedPropertySetSku ...
  1828  type ResourceModelWithAllowedPropertySetSku struct {
  1829  	// Name - The name of the sku, e.g. Standard_D32s_v3.
  1830  	Name *string `json:"name,omitempty"`
  1831  	// Tier - The tier of the particular SKU, e.g. GeneralPurpose. Possible values include: 'SkuTierBurstable', 'SkuTierGeneralPurpose', 'SkuTierMemoryOptimized'
  1832  	Tier SkuTier `json:"tier,omitempty"`
  1833  }
  1834  
  1835  // Server represents a server.
  1836  type Server struct {
  1837  	autorest.Response `json:"-"`
  1838  	// Identity - The Azure Active Directory identity of the server.
  1839  	Identity *Identity `json:"identity,omitempty"`
  1840  	// Sku - The SKU (pricing tier) of the server.
  1841  	Sku *Sku `json:"sku,omitempty"`
  1842  	// ServerProperties - Properties of the server.
  1843  	*ServerProperties `json:"properties,omitempty"`
  1844  	// SystemData - READ-ONLY; The system metadata relating to this resource.
  1845  	SystemData *SystemData `json:"systemData,omitempty"`
  1846  	// Tags - Resource tags.
  1847  	Tags map[string]*string `json:"tags"`
  1848  	// Location - The geo-location where the resource lives
  1849  	Location *string `json:"location,omitempty"`
  1850  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1851  	ID *string `json:"id,omitempty"`
  1852  	// Name - READ-ONLY; The name of the resource
  1853  	Name *string `json:"name,omitempty"`
  1854  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1855  	Type *string `json:"type,omitempty"`
  1856  }
  1857  
  1858  // MarshalJSON is the custom marshaler for Server.
  1859  func (s Server) MarshalJSON() ([]byte, error) {
  1860  	objectMap := make(map[string]interface{})
  1861  	if s.Identity != nil {
  1862  		objectMap["identity"] = s.Identity
  1863  	}
  1864  	if s.Sku != nil {
  1865  		objectMap["sku"] = s.Sku
  1866  	}
  1867  	if s.ServerProperties != nil {
  1868  		objectMap["properties"] = s.ServerProperties
  1869  	}
  1870  	if s.Tags != nil {
  1871  		objectMap["tags"] = s.Tags
  1872  	}
  1873  	if s.Location != nil {
  1874  		objectMap["location"] = s.Location
  1875  	}
  1876  	return json.Marshal(objectMap)
  1877  }
  1878  
  1879  // UnmarshalJSON is the custom unmarshaler for Server struct.
  1880  func (s *Server) UnmarshalJSON(body []byte) error {
  1881  	var m map[string]*json.RawMessage
  1882  	err := json.Unmarshal(body, &m)
  1883  	if err != nil {
  1884  		return err
  1885  	}
  1886  	for k, v := range m {
  1887  		switch k {
  1888  		case "identity":
  1889  			if v != nil {
  1890  				var identity Identity
  1891  				err = json.Unmarshal(*v, &identity)
  1892  				if err != nil {
  1893  					return err
  1894  				}
  1895  				s.Identity = &identity
  1896  			}
  1897  		case "sku":
  1898  			if v != nil {
  1899  				var sku Sku
  1900  				err = json.Unmarshal(*v, &sku)
  1901  				if err != nil {
  1902  					return err
  1903  				}
  1904  				s.Sku = &sku
  1905  			}
  1906  		case "properties":
  1907  			if v != nil {
  1908  				var serverProperties ServerProperties
  1909  				err = json.Unmarshal(*v, &serverProperties)
  1910  				if err != nil {
  1911  					return err
  1912  				}
  1913  				s.ServerProperties = &serverProperties
  1914  			}
  1915  		case "systemData":
  1916  			if v != nil {
  1917  				var systemData SystemData
  1918  				err = json.Unmarshal(*v, &systemData)
  1919  				if err != nil {
  1920  					return err
  1921  				}
  1922  				s.SystemData = &systemData
  1923  			}
  1924  		case "tags":
  1925  			if v != nil {
  1926  				var tags map[string]*string
  1927  				err = json.Unmarshal(*v, &tags)
  1928  				if err != nil {
  1929  					return err
  1930  				}
  1931  				s.Tags = tags
  1932  			}
  1933  		case "location":
  1934  			if v != nil {
  1935  				var location string
  1936  				err = json.Unmarshal(*v, &location)
  1937  				if err != nil {
  1938  					return err
  1939  				}
  1940  				s.Location = &location
  1941  			}
  1942  		case "id":
  1943  			if v != nil {
  1944  				var ID string
  1945  				err = json.Unmarshal(*v, &ID)
  1946  				if err != nil {
  1947  					return err
  1948  				}
  1949  				s.ID = &ID
  1950  			}
  1951  		case "name":
  1952  			if v != nil {
  1953  				var name string
  1954  				err = json.Unmarshal(*v, &name)
  1955  				if err != nil {
  1956  					return err
  1957  				}
  1958  				s.Name = &name
  1959  			}
  1960  		case "type":
  1961  			if v != nil {
  1962  				var typeVar string
  1963  				err = json.Unmarshal(*v, &typeVar)
  1964  				if err != nil {
  1965  					return err
  1966  				}
  1967  				s.Type = &typeVar
  1968  			}
  1969  		}
  1970  	}
  1971  
  1972  	return nil
  1973  }
  1974  
  1975  // ServerBackup server backup properties
  1976  type ServerBackup struct {
  1977  	autorest.Response `json:"-"`
  1978  	// ServerBackupProperties - The properties of a server backup.
  1979  	*ServerBackupProperties `json:"properties,omitempty"`
  1980  	// SystemData - READ-ONLY; The system metadata relating to this resource.
  1981  	SystemData *SystemData `json:"systemData,omitempty"`
  1982  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  1983  	ID *string `json:"id,omitempty"`
  1984  	// Name - READ-ONLY; The name of the resource
  1985  	Name *string `json:"name,omitempty"`
  1986  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  1987  	Type *string `json:"type,omitempty"`
  1988  }
  1989  
  1990  // MarshalJSON is the custom marshaler for ServerBackup.
  1991  func (sb ServerBackup) MarshalJSON() ([]byte, error) {
  1992  	objectMap := make(map[string]interface{})
  1993  	if sb.ServerBackupProperties != nil {
  1994  		objectMap["properties"] = sb.ServerBackupProperties
  1995  	}
  1996  	return json.Marshal(objectMap)
  1997  }
  1998  
  1999  // UnmarshalJSON is the custom unmarshaler for ServerBackup struct.
  2000  func (sb *ServerBackup) UnmarshalJSON(body []byte) error {
  2001  	var m map[string]*json.RawMessage
  2002  	err := json.Unmarshal(body, &m)
  2003  	if err != nil {
  2004  		return err
  2005  	}
  2006  	for k, v := range m {
  2007  		switch k {
  2008  		case "properties":
  2009  			if v != nil {
  2010  				var serverBackupProperties ServerBackupProperties
  2011  				err = json.Unmarshal(*v, &serverBackupProperties)
  2012  				if err != nil {
  2013  					return err
  2014  				}
  2015  				sb.ServerBackupProperties = &serverBackupProperties
  2016  			}
  2017  		case "systemData":
  2018  			if v != nil {
  2019  				var systemData SystemData
  2020  				err = json.Unmarshal(*v, &systemData)
  2021  				if err != nil {
  2022  					return err
  2023  				}
  2024  				sb.SystemData = &systemData
  2025  			}
  2026  		case "id":
  2027  			if v != nil {
  2028  				var ID string
  2029  				err = json.Unmarshal(*v, &ID)
  2030  				if err != nil {
  2031  					return err
  2032  				}
  2033  				sb.ID = &ID
  2034  			}
  2035  		case "name":
  2036  			if v != nil {
  2037  				var name string
  2038  				err = json.Unmarshal(*v, &name)
  2039  				if err != nil {
  2040  					return err
  2041  				}
  2042  				sb.Name = &name
  2043  			}
  2044  		case "type":
  2045  			if v != nil {
  2046  				var typeVar string
  2047  				err = json.Unmarshal(*v, &typeVar)
  2048  				if err != nil {
  2049  					return err
  2050  				}
  2051  				sb.Type = &typeVar
  2052  			}
  2053  		}
  2054  	}
  2055  
  2056  	return nil
  2057  }
  2058  
  2059  // ServerBackupListResult a list of server backups.
  2060  type ServerBackupListResult struct {
  2061  	autorest.Response `json:"-"`
  2062  	// Value - The list of backups of a server.
  2063  	Value *[]ServerBackup `json:"value,omitempty"`
  2064  	// NextLink - The link used to get the next page of operations.
  2065  	NextLink *string `json:"nextLink,omitempty"`
  2066  }
  2067  
  2068  // ServerBackupListResultIterator provides access to a complete listing of ServerBackup values.
  2069  type ServerBackupListResultIterator struct {
  2070  	i    int
  2071  	page ServerBackupListResultPage
  2072  }
  2073  
  2074  // NextWithContext advances to the next value.  If there was an error making
  2075  // the request the iterator does not advance and the error is returned.
  2076  func (iter *ServerBackupListResultIterator) NextWithContext(ctx context.Context) (err error) {
  2077  	if tracing.IsEnabled() {
  2078  		ctx = tracing.StartSpan(ctx, fqdn+"/ServerBackupListResultIterator.NextWithContext")
  2079  		defer func() {
  2080  			sc := -1
  2081  			if iter.Response().Response.Response != nil {
  2082  				sc = iter.Response().Response.Response.StatusCode
  2083  			}
  2084  			tracing.EndSpan(ctx, sc, err)
  2085  		}()
  2086  	}
  2087  	iter.i++
  2088  	if iter.i < len(iter.page.Values()) {
  2089  		return nil
  2090  	}
  2091  	err = iter.page.NextWithContext(ctx)
  2092  	if err != nil {
  2093  		iter.i--
  2094  		return err
  2095  	}
  2096  	iter.i = 0
  2097  	return nil
  2098  }
  2099  
  2100  // Next advances to the next value.  If there was an error making
  2101  // the request the iterator does not advance and the error is returned.
  2102  // Deprecated: Use NextWithContext() instead.
  2103  func (iter *ServerBackupListResultIterator) Next() error {
  2104  	return iter.NextWithContext(context.Background())
  2105  }
  2106  
  2107  // NotDone returns true if the enumeration should be started or is not yet complete.
  2108  func (iter ServerBackupListResultIterator) NotDone() bool {
  2109  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  2110  }
  2111  
  2112  // Response returns the raw server response from the last page request.
  2113  func (iter ServerBackupListResultIterator) Response() ServerBackupListResult {
  2114  	return iter.page.Response()
  2115  }
  2116  
  2117  // Value returns the current value or a zero-initialized value if the
  2118  // iterator has advanced beyond the end of the collection.
  2119  func (iter ServerBackupListResultIterator) Value() ServerBackup {
  2120  	if !iter.page.NotDone() {
  2121  		return ServerBackup{}
  2122  	}
  2123  	return iter.page.Values()[iter.i]
  2124  }
  2125  
  2126  // Creates a new instance of the ServerBackupListResultIterator type.
  2127  func NewServerBackupListResultIterator(page ServerBackupListResultPage) ServerBackupListResultIterator {
  2128  	return ServerBackupListResultIterator{page: page}
  2129  }
  2130  
  2131  // IsEmpty returns true if the ListResult contains no values.
  2132  func (sblr ServerBackupListResult) IsEmpty() bool {
  2133  	return sblr.Value == nil || len(*sblr.Value) == 0
  2134  }
  2135  
  2136  // hasNextLink returns true if the NextLink is not empty.
  2137  func (sblr ServerBackupListResult) hasNextLink() bool {
  2138  	return sblr.NextLink != nil && len(*sblr.NextLink) != 0
  2139  }
  2140  
  2141  // serverBackupListResultPreparer prepares a request to retrieve the next set of results.
  2142  // It returns nil if no more results exist.
  2143  func (sblr ServerBackupListResult) serverBackupListResultPreparer(ctx context.Context) (*http.Request, error) {
  2144  	if !sblr.hasNextLink() {
  2145  		return nil, nil
  2146  	}
  2147  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  2148  		autorest.AsJSON(),
  2149  		autorest.AsGet(),
  2150  		autorest.WithBaseURL(to.String(sblr.NextLink)))
  2151  }
  2152  
  2153  // ServerBackupListResultPage contains a page of ServerBackup values.
  2154  type ServerBackupListResultPage struct {
  2155  	fn   func(context.Context, ServerBackupListResult) (ServerBackupListResult, error)
  2156  	sblr ServerBackupListResult
  2157  }
  2158  
  2159  // NextWithContext advances to the next page of values.  If there was an error making
  2160  // the request the page does not advance and the error is returned.
  2161  func (page *ServerBackupListResultPage) NextWithContext(ctx context.Context) (err error) {
  2162  	if tracing.IsEnabled() {
  2163  		ctx = tracing.StartSpan(ctx, fqdn+"/ServerBackupListResultPage.NextWithContext")
  2164  		defer func() {
  2165  			sc := -1
  2166  			if page.Response().Response.Response != nil {
  2167  				sc = page.Response().Response.Response.StatusCode
  2168  			}
  2169  			tracing.EndSpan(ctx, sc, err)
  2170  		}()
  2171  	}
  2172  	for {
  2173  		next, err := page.fn(ctx, page.sblr)
  2174  		if err != nil {
  2175  			return err
  2176  		}
  2177  		page.sblr = next
  2178  		if !next.hasNextLink() || !next.IsEmpty() {
  2179  			break
  2180  		}
  2181  	}
  2182  	return nil
  2183  }
  2184  
  2185  // Next advances to the next page of values.  If there was an error making
  2186  // the request the page does not advance and the error is returned.
  2187  // Deprecated: Use NextWithContext() instead.
  2188  func (page *ServerBackupListResultPage) Next() error {
  2189  	return page.NextWithContext(context.Background())
  2190  }
  2191  
  2192  // NotDone returns true if the page enumeration should be started or is not yet complete.
  2193  func (page ServerBackupListResultPage) NotDone() bool {
  2194  	return !page.sblr.IsEmpty()
  2195  }
  2196  
  2197  // Response returns the raw server response from the last page request.
  2198  func (page ServerBackupListResultPage) Response() ServerBackupListResult {
  2199  	return page.sblr
  2200  }
  2201  
  2202  // Values returns the slice of values for the current page or nil if there are no values.
  2203  func (page ServerBackupListResultPage) Values() []ServerBackup {
  2204  	if page.sblr.IsEmpty() {
  2205  		return nil
  2206  	}
  2207  	return *page.sblr.Value
  2208  }
  2209  
  2210  // Creates a new instance of the ServerBackupListResultPage type.
  2211  func NewServerBackupListResultPage(cur ServerBackupListResult, getNextPage func(context.Context, ServerBackupListResult) (ServerBackupListResult, error)) ServerBackupListResultPage {
  2212  	return ServerBackupListResultPage{
  2213  		fn:   getNextPage,
  2214  		sblr: cur,
  2215  	}
  2216  }
  2217  
  2218  // ServerBackupProperties the properties of a server backup.
  2219  type ServerBackupProperties struct {
  2220  	// BackupType - Backup type.
  2221  	BackupType *string `json:"backupType,omitempty"`
  2222  	// CompletedTime - Backup completed time (ISO8601 format).
  2223  	CompletedTime *date.Time `json:"completedTime,omitempty"`
  2224  	// Source - Backup source
  2225  	Source *string `json:"source,omitempty"`
  2226  }
  2227  
  2228  // ServerEditionCapability server edition capabilities.
  2229  type ServerEditionCapability struct {
  2230  	// Name - READ-ONLY; Server edition name
  2231  	Name *string `json:"name,omitempty"`
  2232  	// SupportedStorageEditions - READ-ONLY; A list of supported storage editions
  2233  	SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"`
  2234  	// SupportedServerVersions - READ-ONLY; A list of supported server versions.
  2235  	SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"`
  2236  }
  2237  
  2238  // MarshalJSON is the custom marshaler for ServerEditionCapability.
  2239  func (sec ServerEditionCapability) MarshalJSON() ([]byte, error) {
  2240  	objectMap := make(map[string]interface{})
  2241  	return json.Marshal(objectMap)
  2242  }
  2243  
  2244  // ServerForUpdate parameters allowed to update for a server.
  2245  type ServerForUpdate struct {
  2246  	// Sku - The SKU (pricing tier) of the server.
  2247  	Sku *Sku `json:"sku,omitempty"`
  2248  	// ServerPropertiesForUpdate - The properties that can be updated for a server.
  2249  	*ServerPropertiesForUpdate `json:"properties,omitempty"`
  2250  	// Tags - Application-specific metadata in the form of key-value pairs.
  2251  	Tags map[string]*string `json:"tags"`
  2252  }
  2253  
  2254  // MarshalJSON is the custom marshaler for ServerForUpdate.
  2255  func (sfu ServerForUpdate) MarshalJSON() ([]byte, error) {
  2256  	objectMap := make(map[string]interface{})
  2257  	if sfu.Sku != nil {
  2258  		objectMap["sku"] = sfu.Sku
  2259  	}
  2260  	if sfu.ServerPropertiesForUpdate != nil {
  2261  		objectMap["properties"] = sfu.ServerPropertiesForUpdate
  2262  	}
  2263  	if sfu.Tags != nil {
  2264  		objectMap["tags"] = sfu.Tags
  2265  	}
  2266  	return json.Marshal(objectMap)
  2267  }
  2268  
  2269  // UnmarshalJSON is the custom unmarshaler for ServerForUpdate struct.
  2270  func (sfu *ServerForUpdate) UnmarshalJSON(body []byte) error {
  2271  	var m map[string]*json.RawMessage
  2272  	err := json.Unmarshal(body, &m)
  2273  	if err != nil {
  2274  		return err
  2275  	}
  2276  	for k, v := range m {
  2277  		switch k {
  2278  		case "sku":
  2279  			if v != nil {
  2280  				var sku Sku
  2281  				err = json.Unmarshal(*v, &sku)
  2282  				if err != nil {
  2283  					return err
  2284  				}
  2285  				sfu.Sku = &sku
  2286  			}
  2287  		case "properties":
  2288  			if v != nil {
  2289  				var serverPropertiesForUpdate ServerPropertiesForUpdate
  2290  				err = json.Unmarshal(*v, &serverPropertiesForUpdate)
  2291  				if err != nil {
  2292  					return err
  2293  				}
  2294  				sfu.ServerPropertiesForUpdate = &serverPropertiesForUpdate
  2295  			}
  2296  		case "tags":
  2297  			if v != nil {
  2298  				var tags map[string]*string
  2299  				err = json.Unmarshal(*v, &tags)
  2300  				if err != nil {
  2301  					return err
  2302  				}
  2303  				sfu.Tags = tags
  2304  			}
  2305  		}
  2306  	}
  2307  
  2308  	return nil
  2309  }
  2310  
  2311  // ServerListResult a list of servers.
  2312  type ServerListResult struct {
  2313  	autorest.Response `json:"-"`
  2314  	// Value - The list of servers
  2315  	Value *[]Server `json:"value,omitempty"`
  2316  	// NextLink - The link used to get the next page of operations.
  2317  	NextLink *string `json:"nextLink,omitempty"`
  2318  }
  2319  
  2320  // ServerListResultIterator provides access to a complete listing of Server values.
  2321  type ServerListResultIterator struct {
  2322  	i    int
  2323  	page ServerListResultPage
  2324  }
  2325  
  2326  // NextWithContext advances to the next value.  If there was an error making
  2327  // the request the iterator does not advance and the error is returned.
  2328  func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) {
  2329  	if tracing.IsEnabled() {
  2330  		ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext")
  2331  		defer func() {
  2332  			sc := -1
  2333  			if iter.Response().Response.Response != nil {
  2334  				sc = iter.Response().Response.Response.StatusCode
  2335  			}
  2336  			tracing.EndSpan(ctx, sc, err)
  2337  		}()
  2338  	}
  2339  	iter.i++
  2340  	if iter.i < len(iter.page.Values()) {
  2341  		return nil
  2342  	}
  2343  	err = iter.page.NextWithContext(ctx)
  2344  	if err != nil {
  2345  		iter.i--
  2346  		return err
  2347  	}
  2348  	iter.i = 0
  2349  	return nil
  2350  }
  2351  
  2352  // Next advances to the next value.  If there was an error making
  2353  // the request the iterator does not advance and the error is returned.
  2354  // Deprecated: Use NextWithContext() instead.
  2355  func (iter *ServerListResultIterator) Next() error {
  2356  	return iter.NextWithContext(context.Background())
  2357  }
  2358  
  2359  // NotDone returns true if the enumeration should be started or is not yet complete.
  2360  func (iter ServerListResultIterator) NotDone() bool {
  2361  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  2362  }
  2363  
  2364  // Response returns the raw server response from the last page request.
  2365  func (iter ServerListResultIterator) Response() ServerListResult {
  2366  	return iter.page.Response()
  2367  }
  2368  
  2369  // Value returns the current value or a zero-initialized value if the
  2370  // iterator has advanced beyond the end of the collection.
  2371  func (iter ServerListResultIterator) Value() Server {
  2372  	if !iter.page.NotDone() {
  2373  		return Server{}
  2374  	}
  2375  	return iter.page.Values()[iter.i]
  2376  }
  2377  
  2378  // Creates a new instance of the ServerListResultIterator type.
  2379  func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator {
  2380  	return ServerListResultIterator{page: page}
  2381  }
  2382  
  2383  // IsEmpty returns true if the ListResult contains no values.
  2384  func (slr ServerListResult) IsEmpty() bool {
  2385  	return slr.Value == nil || len(*slr.Value) == 0
  2386  }
  2387  
  2388  // hasNextLink returns true if the NextLink is not empty.
  2389  func (slr ServerListResult) hasNextLink() bool {
  2390  	return slr.NextLink != nil && len(*slr.NextLink) != 0
  2391  }
  2392  
  2393  // serverListResultPreparer prepares a request to retrieve the next set of results.
  2394  // It returns nil if no more results exist.
  2395  func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) {
  2396  	if !slr.hasNextLink() {
  2397  		return nil, nil
  2398  	}
  2399  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  2400  		autorest.AsJSON(),
  2401  		autorest.AsGet(),
  2402  		autorest.WithBaseURL(to.String(slr.NextLink)))
  2403  }
  2404  
  2405  // ServerListResultPage contains a page of Server values.
  2406  type ServerListResultPage struct {
  2407  	fn  func(context.Context, ServerListResult) (ServerListResult, error)
  2408  	slr ServerListResult
  2409  }
  2410  
  2411  // NextWithContext advances to the next page of values.  If there was an error making
  2412  // the request the page does not advance and the error is returned.
  2413  func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) {
  2414  	if tracing.IsEnabled() {
  2415  		ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext")
  2416  		defer func() {
  2417  			sc := -1
  2418  			if page.Response().Response.Response != nil {
  2419  				sc = page.Response().Response.Response.StatusCode
  2420  			}
  2421  			tracing.EndSpan(ctx, sc, err)
  2422  		}()
  2423  	}
  2424  	for {
  2425  		next, err := page.fn(ctx, page.slr)
  2426  		if err != nil {
  2427  			return err
  2428  		}
  2429  		page.slr = next
  2430  		if !next.hasNextLink() || !next.IsEmpty() {
  2431  			break
  2432  		}
  2433  	}
  2434  	return nil
  2435  }
  2436  
  2437  // Next advances to the next page of values.  If there was an error making
  2438  // the request the page does not advance and the error is returned.
  2439  // Deprecated: Use NextWithContext() instead.
  2440  func (page *ServerListResultPage) Next() error {
  2441  	return page.NextWithContext(context.Background())
  2442  }
  2443  
  2444  // NotDone returns true if the page enumeration should be started or is not yet complete.
  2445  func (page ServerListResultPage) NotDone() bool {
  2446  	return !page.slr.IsEmpty()
  2447  }
  2448  
  2449  // Response returns the raw server response from the last page request.
  2450  func (page ServerListResultPage) Response() ServerListResult {
  2451  	return page.slr
  2452  }
  2453  
  2454  // Values returns the slice of values for the current page or nil if there are no values.
  2455  func (page ServerListResultPage) Values() []Server {
  2456  	if page.slr.IsEmpty() {
  2457  		return nil
  2458  	}
  2459  	return *page.slr.Value
  2460  }
  2461  
  2462  // Creates a new instance of the ServerListResultPage type.
  2463  func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage {
  2464  	return ServerListResultPage{
  2465  		fn:  getNextPage,
  2466  		slr: cur,
  2467  	}
  2468  }
  2469  
  2470  // ServerProperties the properties of a server.
  2471  type ServerProperties struct {
  2472  	// AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
  2473  	AdministratorLogin *string `json:"administratorLogin,omitempty"`
  2474  	// AdministratorLoginPassword - The password of the administrator login (required for server creation).
  2475  	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
  2476  	// Version - Server version. Possible values include: 'ServerVersionFiveFullStopSeven', 'ServerVersionEightFullStopZeroFullStopTwoOne'
  2477  	Version ServerVersion `json:"version,omitempty"`
  2478  	// AvailabilityZone - availability Zone information of the server.
  2479  	AvailabilityZone *string `json:"availabilityZone,omitempty"`
  2480  	// CreateMode - The mode to create a new MySQL server. Possible values include: 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeReplica', 'CreateModeGeoRestore'
  2481  	CreateMode CreateMode `json:"createMode,omitempty"`
  2482  	// SourceServerResourceID - The source MySQL server id.
  2483  	SourceServerResourceID *string `json:"sourceServerResourceId,omitempty"`
  2484  	// RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from.
  2485  	RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"`
  2486  	// ReplicationRole - The replication role. Possible values include: 'ReplicationRoleNone', 'ReplicationRoleSource', 'ReplicationRoleReplica'
  2487  	ReplicationRole ReplicationRole `json:"replicationRole,omitempty"`
  2488  	// ReplicaCapacity - READ-ONLY; The maximum number of replicas that a primary server can have.
  2489  	ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"`
  2490  	// State - READ-ONLY; The state of a server. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateStarting', 'ServerStateStopping', 'ServerStateStopped', 'ServerStateUpdating'
  2491  	State ServerState `json:"state,omitempty"`
  2492  	// FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of a server.
  2493  	FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
  2494  	// Storage - Storage related properties of a server.
  2495  	Storage *Storage `json:"storage,omitempty"`
  2496  	// Backup - Backup related properties of a server.
  2497  	Backup *Backup `json:"backup,omitempty"`
  2498  	// HighAvailability - High availability related properties of a server.
  2499  	HighAvailability *HighAvailability `json:"highAvailability,omitempty"`
  2500  	// Network - Network related properties of a server.
  2501  	Network *Network `json:"network,omitempty"`
  2502  	// MaintenanceWindow - Maintenance window of a server.
  2503  	MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
  2504  }
  2505  
  2506  // MarshalJSON is the custom marshaler for ServerProperties.
  2507  func (sp ServerProperties) MarshalJSON() ([]byte, error) {
  2508  	objectMap := make(map[string]interface{})
  2509  	if sp.AdministratorLogin != nil {
  2510  		objectMap["administratorLogin"] = sp.AdministratorLogin
  2511  	}
  2512  	if sp.AdministratorLoginPassword != nil {
  2513  		objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword
  2514  	}
  2515  	if sp.Version != "" {
  2516  		objectMap["version"] = sp.Version
  2517  	}
  2518  	if sp.AvailabilityZone != nil {
  2519  		objectMap["availabilityZone"] = sp.AvailabilityZone
  2520  	}
  2521  	if sp.CreateMode != "" {
  2522  		objectMap["createMode"] = sp.CreateMode
  2523  	}
  2524  	if sp.SourceServerResourceID != nil {
  2525  		objectMap["sourceServerResourceId"] = sp.SourceServerResourceID
  2526  	}
  2527  	if sp.RestorePointInTime != nil {
  2528  		objectMap["restorePointInTime"] = sp.RestorePointInTime
  2529  	}
  2530  	if sp.ReplicationRole != "" {
  2531  		objectMap["replicationRole"] = sp.ReplicationRole
  2532  	}
  2533  	if sp.Storage != nil {
  2534  		objectMap["storage"] = sp.Storage
  2535  	}
  2536  	if sp.Backup != nil {
  2537  		objectMap["backup"] = sp.Backup
  2538  	}
  2539  	if sp.HighAvailability != nil {
  2540  		objectMap["highAvailability"] = sp.HighAvailability
  2541  	}
  2542  	if sp.Network != nil {
  2543  		objectMap["network"] = sp.Network
  2544  	}
  2545  	if sp.MaintenanceWindow != nil {
  2546  		objectMap["maintenanceWindow"] = sp.MaintenanceWindow
  2547  	}
  2548  	return json.Marshal(objectMap)
  2549  }
  2550  
  2551  // ServerPropertiesForUpdate the properties that can be updated for a server.
  2552  type ServerPropertiesForUpdate struct {
  2553  	// AdministratorLoginPassword - The password of the administrator login.
  2554  	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
  2555  	// Storage - Storage related properties of a server.
  2556  	Storage *Storage `json:"storage,omitempty"`
  2557  	// Backup - Backup related properties of a server.
  2558  	Backup *Backup `json:"backup,omitempty"`
  2559  	// HighAvailability - High availability related properties of a server.
  2560  	HighAvailability *HighAvailability `json:"highAvailability,omitempty"`
  2561  	// MaintenanceWindow - Maintenance window of a server.
  2562  	MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
  2563  	// ReplicationRole - The replication role of the server. Possible values include: 'ReplicationRoleNone', 'ReplicationRoleSource', 'ReplicationRoleReplica'
  2564  	ReplicationRole ReplicationRole `json:"replicationRole,omitempty"`
  2565  }
  2566  
  2567  // ServerRestartParameter server restart parameters.
  2568  type ServerRestartParameter struct {
  2569  	// RestartWithFailover - Whether or not failover to standby server when restarting a server with high availability enabled. Possible values include: 'EnableStatusEnumEnabled', 'EnableStatusEnumDisabled'
  2570  	RestartWithFailover EnableStatusEnum `json:"restartWithFailover,omitempty"`
  2571  	// MaxFailoverSeconds - The maximum allowed failover time in seconds.
  2572  	MaxFailoverSeconds *int32 `json:"maxFailoverSeconds,omitempty"`
  2573  }
  2574  
  2575  // ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running
  2576  // operation.
  2577  type ServersCreateFuture struct {
  2578  	azure.FutureAPI
  2579  	// Result returns the result of the asynchronous operation.
  2580  	// If the operation has not completed it will return an error.
  2581  	Result func(ServersClient) (Server, error)
  2582  }
  2583  
  2584  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2585  func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
  2586  	var azFuture azure.Future
  2587  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2588  		return err
  2589  	}
  2590  	future.FutureAPI = &azFuture
  2591  	future.Result = future.result
  2592  	return nil
  2593  }
  2594  
  2595  // result is the default implementation for ServersCreateFuture.Result.
  2596  func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
  2597  	var done bool
  2598  	done, err = future.DoneWithContext(context.Background(), client)
  2599  	if err != nil {
  2600  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersCreateFuture", "Result", future.Response(), "Polling failure")
  2601  		return
  2602  	}
  2603  	if !done {
  2604  		s.Response.Response = future.Response()
  2605  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersCreateFuture")
  2606  		return
  2607  	}
  2608  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2609  	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
  2610  		s, err = client.CreateResponder(s.Response.Response)
  2611  		if err != nil {
  2612  			err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
  2613  		}
  2614  	}
  2615  	return
  2616  }
  2617  
  2618  // ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
  2619  // operation.
  2620  type ServersDeleteFuture struct {
  2621  	azure.FutureAPI
  2622  	// Result returns the result of the asynchronous operation.
  2623  	// If the operation has not completed it will return an error.
  2624  	Result func(ServersClient) (autorest.Response, error)
  2625  }
  2626  
  2627  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2628  func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
  2629  	var azFuture azure.Future
  2630  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2631  		return err
  2632  	}
  2633  	future.FutureAPI = &azFuture
  2634  	future.Result = future.result
  2635  	return nil
  2636  }
  2637  
  2638  // result is the default implementation for ServersDeleteFuture.Result.
  2639  func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2640  	var done bool
  2641  	done, err = future.DoneWithContext(context.Background(), client)
  2642  	if err != nil {
  2643  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
  2644  		return
  2645  	}
  2646  	if !done {
  2647  		ar.Response = future.Response()
  2648  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersDeleteFuture")
  2649  		return
  2650  	}
  2651  	ar.Response = future.Response()
  2652  	return
  2653  }
  2654  
  2655  // ServersFailoverFuture an abstraction for monitoring and retrieving the results of a long-running
  2656  // operation.
  2657  type ServersFailoverFuture struct {
  2658  	azure.FutureAPI
  2659  	// Result returns the result of the asynchronous operation.
  2660  	// If the operation has not completed it will return an error.
  2661  	Result func(ServersClient) (autorest.Response, error)
  2662  }
  2663  
  2664  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2665  func (future *ServersFailoverFuture) UnmarshalJSON(body []byte) error {
  2666  	var azFuture azure.Future
  2667  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2668  		return err
  2669  	}
  2670  	future.FutureAPI = &azFuture
  2671  	future.Result = future.result
  2672  	return nil
  2673  }
  2674  
  2675  // result is the default implementation for ServersFailoverFuture.Result.
  2676  func (future *ServersFailoverFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2677  	var done bool
  2678  	done, err = future.DoneWithContext(context.Background(), client)
  2679  	if err != nil {
  2680  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersFailoverFuture", "Result", future.Response(), "Polling failure")
  2681  		return
  2682  	}
  2683  	if !done {
  2684  		ar.Response = future.Response()
  2685  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersFailoverFuture")
  2686  		return
  2687  	}
  2688  	ar.Response = future.Response()
  2689  	return
  2690  }
  2691  
  2692  // ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running
  2693  // operation.
  2694  type ServersRestartFuture struct {
  2695  	azure.FutureAPI
  2696  	// Result returns the result of the asynchronous operation.
  2697  	// If the operation has not completed it will return an error.
  2698  	Result func(ServersClient) (autorest.Response, error)
  2699  }
  2700  
  2701  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2702  func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error {
  2703  	var azFuture azure.Future
  2704  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2705  		return err
  2706  	}
  2707  	future.FutureAPI = &azFuture
  2708  	future.Result = future.result
  2709  	return nil
  2710  }
  2711  
  2712  // result is the default implementation for ServersRestartFuture.Result.
  2713  func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2714  	var done bool
  2715  	done, err = future.DoneWithContext(context.Background(), client)
  2716  	if err != nil {
  2717  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersRestartFuture", "Result", future.Response(), "Polling failure")
  2718  		return
  2719  	}
  2720  	if !done {
  2721  		ar.Response = future.Response()
  2722  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersRestartFuture")
  2723  		return
  2724  	}
  2725  	ar.Response = future.Response()
  2726  	return
  2727  }
  2728  
  2729  // ServersStartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
  2730  type ServersStartFuture struct {
  2731  	azure.FutureAPI
  2732  	// Result returns the result of the asynchronous operation.
  2733  	// If the operation has not completed it will return an error.
  2734  	Result func(ServersClient) (autorest.Response, error)
  2735  }
  2736  
  2737  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2738  func (future *ServersStartFuture) UnmarshalJSON(body []byte) error {
  2739  	var azFuture azure.Future
  2740  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2741  		return err
  2742  	}
  2743  	future.FutureAPI = &azFuture
  2744  	future.Result = future.result
  2745  	return nil
  2746  }
  2747  
  2748  // result is the default implementation for ServersStartFuture.Result.
  2749  func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2750  	var done bool
  2751  	done, err = future.DoneWithContext(context.Background(), client)
  2752  	if err != nil {
  2753  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersStartFuture", "Result", future.Response(), "Polling failure")
  2754  		return
  2755  	}
  2756  	if !done {
  2757  		ar.Response = future.Response()
  2758  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersStartFuture")
  2759  		return
  2760  	}
  2761  	ar.Response = future.Response()
  2762  	return
  2763  }
  2764  
  2765  // ServersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation.
  2766  type ServersStopFuture struct {
  2767  	azure.FutureAPI
  2768  	// Result returns the result of the asynchronous operation.
  2769  	// If the operation has not completed it will return an error.
  2770  	Result func(ServersClient) (autorest.Response, error)
  2771  }
  2772  
  2773  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2774  func (future *ServersStopFuture) UnmarshalJSON(body []byte) error {
  2775  	var azFuture azure.Future
  2776  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2777  		return err
  2778  	}
  2779  	future.FutureAPI = &azFuture
  2780  	future.Result = future.result
  2781  	return nil
  2782  }
  2783  
  2784  // result is the default implementation for ServersStopFuture.Result.
  2785  func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) {
  2786  	var done bool
  2787  	done, err = future.DoneWithContext(context.Background(), client)
  2788  	if err != nil {
  2789  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersStopFuture", "Result", future.Response(), "Polling failure")
  2790  		return
  2791  	}
  2792  	if !done {
  2793  		ar.Response = future.Response()
  2794  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersStopFuture")
  2795  		return
  2796  	}
  2797  	ar.Response = future.Response()
  2798  	return
  2799  }
  2800  
  2801  // ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
  2802  // operation.
  2803  type ServersUpdateFuture struct {
  2804  	azure.FutureAPI
  2805  	// Result returns the result of the asynchronous operation.
  2806  	// If the operation has not completed it will return an error.
  2807  	Result func(ServersClient) (Server, error)
  2808  }
  2809  
  2810  // UnmarshalJSON is the custom unmarshaller for CreateFuture.
  2811  func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
  2812  	var azFuture azure.Future
  2813  	if err := json.Unmarshal(body, &azFuture); err != nil {
  2814  		return err
  2815  	}
  2816  	future.FutureAPI = &azFuture
  2817  	future.Result = future.result
  2818  	return nil
  2819  }
  2820  
  2821  // result is the default implementation for ServersUpdateFuture.Result.
  2822  func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
  2823  	var done bool
  2824  	done, err = future.DoneWithContext(context.Background(), client)
  2825  	if err != nil {
  2826  		err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
  2827  		return
  2828  	}
  2829  	if !done {
  2830  		s.Response.Response = future.Response()
  2831  		err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersUpdateFuture")
  2832  		return
  2833  	}
  2834  	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2835  	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
  2836  		s, err = client.UpdateResponder(s.Response.Response)
  2837  		if err != nil {
  2838  			err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
  2839  		}
  2840  	}
  2841  	return
  2842  }
  2843  
  2844  // ServerVersionCapability server version capabilities.
  2845  type ServerVersionCapability struct {
  2846  	// Name - READ-ONLY; server version
  2847  	Name *string `json:"name,omitempty"`
  2848  	// SupportedSkus - READ-ONLY; A list of supported Skus
  2849  	SupportedSkus *[]SkuCapability `json:"supportedSkus,omitempty"`
  2850  }
  2851  
  2852  // MarshalJSON is the custom marshaler for ServerVersionCapability.
  2853  func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) {
  2854  	objectMap := make(map[string]interface{})
  2855  	return json.Marshal(objectMap)
  2856  }
  2857  
  2858  // Sku billing information related properties of a server.
  2859  type Sku struct {
  2860  	// Name - The name of the sku, e.g. Standard_D32s_v3.
  2861  	Name *string `json:"name,omitempty"`
  2862  	// Tier - The tier of the particular SKU, e.g. GeneralPurpose. Possible values include: 'SkuTierBurstable', 'SkuTierGeneralPurpose', 'SkuTierMemoryOptimized'
  2863  	Tier SkuTier `json:"tier,omitempty"`
  2864  }
  2865  
  2866  // SkuCapability sku capability
  2867  type SkuCapability struct {
  2868  	// Name - READ-ONLY; vCore name
  2869  	Name *string `json:"name,omitempty"`
  2870  	// VCores - READ-ONLY; supported vCores
  2871  	VCores *int64 `json:"vCores,omitempty"`
  2872  	// SupportedIops - READ-ONLY; supported IOPS
  2873  	SupportedIops *int64 `json:"supportedIops,omitempty"`
  2874  	// SupportedMemoryPerVCoreMB - READ-ONLY; supported memory per vCore in MB
  2875  	SupportedMemoryPerVCoreMB *int64 `json:"supportedMemoryPerVCoreMB,omitempty"`
  2876  }
  2877  
  2878  // MarshalJSON is the custom marshaler for SkuCapability.
  2879  func (sc SkuCapability) MarshalJSON() ([]byte, error) {
  2880  	objectMap := make(map[string]interface{})
  2881  	return json.Marshal(objectMap)
  2882  }
  2883  
  2884  // Storage storage Profile properties of a server
  2885  type Storage struct {
  2886  	// StorageSizeGB - Max storage size allowed for a server.
  2887  	StorageSizeGB *int32 `json:"storageSizeGB,omitempty"`
  2888  	// Iops - Storage IOPS for a server.
  2889  	Iops *int32 `json:"iops,omitempty"`
  2890  	// AutoGrow - Enable Storage Auto Grow or not. Possible values include: 'EnableStatusEnumEnabled', 'EnableStatusEnumDisabled'
  2891  	AutoGrow EnableStatusEnum `json:"autoGrow,omitempty"`
  2892  	// StorageSku - READ-ONLY; The sku name of the server storage.
  2893  	StorageSku *string `json:"storageSku,omitempty"`
  2894  }
  2895  
  2896  // MarshalJSON is the custom marshaler for Storage.
  2897  func (s Storage) MarshalJSON() ([]byte, error) {
  2898  	objectMap := make(map[string]interface{})
  2899  	if s.StorageSizeGB != nil {
  2900  		objectMap["storageSizeGB"] = s.StorageSizeGB
  2901  	}
  2902  	if s.Iops != nil {
  2903  		objectMap["iops"] = s.Iops
  2904  	}
  2905  	if s.AutoGrow != "" {
  2906  		objectMap["autoGrow"] = s.AutoGrow
  2907  	}
  2908  	return json.Marshal(objectMap)
  2909  }
  2910  
  2911  // StorageEditionCapability storage edition capability
  2912  type StorageEditionCapability struct {
  2913  	// Name - READ-ONLY; storage edition name
  2914  	Name *string `json:"name,omitempty"`
  2915  	// MinStorageSize - READ-ONLY; The minimal supported storage size.
  2916  	MinStorageSize *int64 `json:"minStorageSize,omitempty"`
  2917  	// MaxStorageSize - READ-ONLY; The maximum supported storage size.
  2918  	MaxStorageSize *int64 `json:"maxStorageSize,omitempty"`
  2919  	// MinBackupRetentionDays - READ-ONLY; Minimal backup retention days
  2920  	MinBackupRetentionDays *int64 `json:"minBackupRetentionDays,omitempty"`
  2921  	// MaxBackupRetentionDays - READ-ONLY; Maximum backup retention days
  2922  	MaxBackupRetentionDays *int64 `json:"maxBackupRetentionDays,omitempty"`
  2923  }
  2924  
  2925  // MarshalJSON is the custom marshaler for StorageEditionCapability.
  2926  func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) {
  2927  	objectMap := make(map[string]interface{})
  2928  	return json.Marshal(objectMap)
  2929  }
  2930  
  2931  // SystemData metadata pertaining to creation and last modification of the resource.
  2932  type SystemData struct {
  2933  	// CreatedBy - The identity that created the resource.
  2934  	CreatedBy *string `json:"createdBy,omitempty"`
  2935  	// CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey'
  2936  	CreatedByType CreatedByType `json:"createdByType,omitempty"`
  2937  	// CreatedAt - The timestamp of resource creation (UTC).
  2938  	CreatedAt *date.Time `json:"createdAt,omitempty"`
  2939  	// LastModifiedBy - The identity that last modified the resource.
  2940  	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`
  2941  	// LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey'
  2942  	LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"`
  2943  	// LastModifiedAt - The timestamp of resource last modification (UTC)
  2944  	LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"`
  2945  }
  2946  
  2947  // TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource
  2948  // which has 'tags' and a 'location'
  2949  type TrackedResource struct {
  2950  	// Tags - Resource tags.
  2951  	Tags map[string]*string `json:"tags"`
  2952  	// Location - The geo-location where the resource lives
  2953  	Location *string `json:"location,omitempty"`
  2954  	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
  2955  	ID *string `json:"id,omitempty"`
  2956  	// Name - READ-ONLY; The name of the resource
  2957  	Name *string `json:"name,omitempty"`
  2958  	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
  2959  	Type *string `json:"type,omitempty"`
  2960  }
  2961  
  2962  // MarshalJSON is the custom marshaler for TrackedResource.
  2963  func (tr TrackedResource) MarshalJSON() ([]byte, error) {
  2964  	objectMap := make(map[string]interface{})
  2965  	if tr.Tags != nil {
  2966  		objectMap["tags"] = tr.Tags
  2967  	}
  2968  	if tr.Location != nil {
  2969  		objectMap["location"] = tr.Location
  2970  	}
  2971  	return json.Marshal(objectMap)
  2972  }
  2973  
  2974  // VirtualNetworkSubnetUsageParameter virtual network subnet usage parameter
  2975  type VirtualNetworkSubnetUsageParameter struct {
  2976  	// VirtualNetworkResourceID - Virtual network resource id.
  2977  	VirtualNetworkResourceID *string `json:"virtualNetworkResourceId,omitempty"`
  2978  }
  2979  
  2980  // VirtualNetworkSubnetUsageResult virtual network subnet usage data.
  2981  type VirtualNetworkSubnetUsageResult struct {
  2982  	autorest.Response `json:"-"`
  2983  	// DelegatedSubnetsUsage - READ-ONLY; A list of delegated subnet usage
  2984  	DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"`
  2985  }
  2986  
  2987  // MarshalJSON is the custom marshaler for VirtualNetworkSubnetUsageResult.
  2988  func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) {
  2989  	objectMap := make(map[string]interface{})
  2990  	return json.Marshal(objectMap)
  2991  }
  2992  

View as plain text