1package mariadb
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"encoding/json"
12	"github.com/Azure/go-autorest/autorest"
13	"github.com/Azure/go-autorest/autorest/azure"
14	"github.com/Azure/go-autorest/autorest/date"
15	"github.com/Azure/go-autorest/autorest/to"
16	"github.com/Azure/go-autorest/tracing"
17	"net/http"
18)
19
20// The package's fully qualified name.
21const fqdn = "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb"
22
23// Advisor represents a recommendation action advisor.
24type Advisor struct {
25	autorest.Response `json:"-"`
26	// Properties - The properties of a recommendation action advisor.
27	Properties interface{} `json:"properties,omitempty"`
28	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
29	ID *string `json:"id,omitempty"`
30	// Name - READ-ONLY; The name of the resource
31	Name *string `json:"name,omitempty"`
32	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
33	Type *string `json:"type,omitempty"`
34}
35
36// MarshalJSON is the custom marshaler for Advisor.
37func (a Advisor) MarshalJSON() ([]byte, error) {
38	objectMap := make(map[string]interface{})
39	if a.Properties != nil {
40		objectMap["properties"] = a.Properties
41	}
42	return json.Marshal(objectMap)
43}
44
45// AdvisorsResultList a list of query statistics.
46type AdvisorsResultList struct {
47	autorest.Response `json:"-"`
48	// Value - READ-ONLY; The list of recommendation action advisors.
49	Value *[]Advisor `json:"value,omitempty"`
50	// NextLink - READ-ONLY; Link to retrieve next page of results.
51	NextLink *string `json:"nextLink,omitempty"`
52}
53
54// MarshalJSON is the custom marshaler for AdvisorsResultList.
55func (arl AdvisorsResultList) MarshalJSON() ([]byte, error) {
56	objectMap := make(map[string]interface{})
57	return json.Marshal(objectMap)
58}
59
60// AdvisorsResultListIterator provides access to a complete listing of Advisor values.
61type AdvisorsResultListIterator struct {
62	i    int
63	page AdvisorsResultListPage
64}
65
66// NextWithContext advances to the next value.  If there was an error making
67// the request the iterator does not advance and the error is returned.
68func (iter *AdvisorsResultListIterator) NextWithContext(ctx context.Context) (err error) {
69	if tracing.IsEnabled() {
70		ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListIterator.NextWithContext")
71		defer func() {
72			sc := -1
73			if iter.Response().Response.Response != nil {
74				sc = iter.Response().Response.Response.StatusCode
75			}
76			tracing.EndSpan(ctx, sc, err)
77		}()
78	}
79	iter.i++
80	if iter.i < len(iter.page.Values()) {
81		return nil
82	}
83	err = iter.page.NextWithContext(ctx)
84	if err != nil {
85		iter.i--
86		return err
87	}
88	iter.i = 0
89	return nil
90}
91
92// Next advances to the next value.  If there was an error making
93// the request the iterator does not advance and the error is returned.
94// Deprecated: Use NextWithContext() instead.
95func (iter *AdvisorsResultListIterator) Next() error {
96	return iter.NextWithContext(context.Background())
97}
98
99// NotDone returns true if the enumeration should be started or is not yet complete.
100func (iter AdvisorsResultListIterator) NotDone() bool {
101	return iter.page.NotDone() && iter.i < len(iter.page.Values())
102}
103
104// Response returns the raw server response from the last page request.
105func (iter AdvisorsResultListIterator) Response() AdvisorsResultList {
106	return iter.page.Response()
107}
108
109// Value returns the current value or a zero-initialized value if the
110// iterator has advanced beyond the end of the collection.
111func (iter AdvisorsResultListIterator) Value() Advisor {
112	if !iter.page.NotDone() {
113		return Advisor{}
114	}
115	return iter.page.Values()[iter.i]
116}
117
118// Creates a new instance of the AdvisorsResultListIterator type.
119func NewAdvisorsResultListIterator(page AdvisorsResultListPage) AdvisorsResultListIterator {
120	return AdvisorsResultListIterator{page: page}
121}
122
123// IsEmpty returns true if the ListResult contains no values.
124func (arl AdvisorsResultList) IsEmpty() bool {
125	return arl.Value == nil || len(*arl.Value) == 0
126}
127
128// hasNextLink returns true if the NextLink is not empty.
129func (arl AdvisorsResultList) hasNextLink() bool {
130	return arl.NextLink != nil && len(*arl.NextLink) != 0
131}
132
133// advisorsResultListPreparer prepares a request to retrieve the next set of results.
134// It returns nil if no more results exist.
135func (arl AdvisorsResultList) advisorsResultListPreparer(ctx context.Context) (*http.Request, error) {
136	if !arl.hasNextLink() {
137		return nil, nil
138	}
139	return autorest.Prepare((&http.Request{}).WithContext(ctx),
140		autorest.AsJSON(),
141		autorest.AsGet(),
142		autorest.WithBaseURL(to.String(arl.NextLink)))
143}
144
145// AdvisorsResultListPage contains a page of Advisor values.
146type AdvisorsResultListPage struct {
147	fn  func(context.Context, AdvisorsResultList) (AdvisorsResultList, error)
148	arl AdvisorsResultList
149}
150
151// NextWithContext advances to the next page of values.  If there was an error making
152// the request the page does not advance and the error is returned.
153func (page *AdvisorsResultListPage) NextWithContext(ctx context.Context) (err error) {
154	if tracing.IsEnabled() {
155		ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListPage.NextWithContext")
156		defer func() {
157			sc := -1
158			if page.Response().Response.Response != nil {
159				sc = page.Response().Response.Response.StatusCode
160			}
161			tracing.EndSpan(ctx, sc, err)
162		}()
163	}
164	for {
165		next, err := page.fn(ctx, page.arl)
166		if err != nil {
167			return err
168		}
169		page.arl = next
170		if !next.hasNextLink() || !next.IsEmpty() {
171			break
172		}
173	}
174	return nil
175}
176
177// Next advances to the next page of values.  If there was an error making
178// the request the page does not advance and the error is returned.
179// Deprecated: Use NextWithContext() instead.
180func (page *AdvisorsResultListPage) Next() error {
181	return page.NextWithContext(context.Background())
182}
183
184// NotDone returns true if the page enumeration should be started or is not yet complete.
185func (page AdvisorsResultListPage) NotDone() bool {
186	return !page.arl.IsEmpty()
187}
188
189// Response returns the raw server response from the last page request.
190func (page AdvisorsResultListPage) Response() AdvisorsResultList {
191	return page.arl
192}
193
194// Values returns the slice of values for the current page or nil if there are no values.
195func (page AdvisorsResultListPage) Values() []Advisor {
196	if page.arl.IsEmpty() {
197		return nil
198	}
199	return *page.arl.Value
200}
201
202// Creates a new instance of the AdvisorsResultListPage type.
203func NewAdvisorsResultListPage(cur AdvisorsResultList, getNextPage func(context.Context, AdvisorsResultList) (AdvisorsResultList, error)) AdvisorsResultListPage {
204	return AdvisorsResultListPage{
205		fn:  getNextPage,
206		arl: cur,
207	}
208}
209
210// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag.
211type AzureEntityResource struct {
212	// Etag - READ-ONLY; Resource Etag.
213	Etag *string `json:"etag,omitempty"`
214	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
215	ID *string `json:"id,omitempty"`
216	// Name - READ-ONLY; The name of the resource
217	Name *string `json:"name,omitempty"`
218	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
219	Type *string `json:"type,omitempty"`
220}
221
222// MarshalJSON is the custom marshaler for AzureEntityResource.
223func (aer AzureEntityResource) MarshalJSON() ([]byte, error) {
224	objectMap := make(map[string]interface{})
225	return json.Marshal(objectMap)
226}
227
228// CloudError an error response from the Batch service.
229type CloudError struct {
230	Error *ErrorResponse `json:"error,omitempty"`
231}
232
233// Configuration represents a Configuration.
234type Configuration struct {
235	autorest.Response `json:"-"`
236	// ConfigurationProperties - The properties of a configuration.
237	*ConfigurationProperties `json:"properties,omitempty"`
238	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
239	ID *string `json:"id,omitempty"`
240	// Name - READ-ONLY; The name of the resource
241	Name *string `json:"name,omitempty"`
242	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
243	Type *string `json:"type,omitempty"`
244}
245
246// MarshalJSON is the custom marshaler for Configuration.
247func (c Configuration) MarshalJSON() ([]byte, error) {
248	objectMap := make(map[string]interface{})
249	if c.ConfigurationProperties != nil {
250		objectMap["properties"] = c.ConfigurationProperties
251	}
252	return json.Marshal(objectMap)
253}
254
255// UnmarshalJSON is the custom unmarshaler for Configuration struct.
256func (c *Configuration) UnmarshalJSON(body []byte) error {
257	var m map[string]*json.RawMessage
258	err := json.Unmarshal(body, &m)
259	if err != nil {
260		return err
261	}
262	for k, v := range m {
263		switch k {
264		case "properties":
265			if v != nil {
266				var configurationProperties ConfigurationProperties
267				err = json.Unmarshal(*v, &configurationProperties)
268				if err != nil {
269					return err
270				}
271				c.ConfigurationProperties = &configurationProperties
272			}
273		case "id":
274			if v != nil {
275				var ID string
276				err = json.Unmarshal(*v, &ID)
277				if err != nil {
278					return err
279				}
280				c.ID = &ID
281			}
282		case "name":
283			if v != nil {
284				var name string
285				err = json.Unmarshal(*v, &name)
286				if err != nil {
287					return err
288				}
289				c.Name = &name
290			}
291		case "type":
292			if v != nil {
293				var typeVar string
294				err = json.Unmarshal(*v, &typeVar)
295				if err != nil {
296					return err
297				}
298				c.Type = &typeVar
299			}
300		}
301	}
302
303	return nil
304}
305
306// ConfigurationListResult a list of server configurations.
307type ConfigurationListResult struct {
308	autorest.Response `json:"-"`
309	// Value - The list of server configurations.
310	Value *[]Configuration `json:"value,omitempty"`
311}
312
313// ConfigurationProperties the properties of a configuration.
314type ConfigurationProperties struct {
315	// Value - Value of the configuration.
316	Value *string `json:"value,omitempty"`
317	// Description - READ-ONLY; Description of the configuration.
318	Description *string `json:"description,omitempty"`
319	// DefaultValue - READ-ONLY; Default value of the configuration.
320	DefaultValue *string `json:"defaultValue,omitempty"`
321	// DataType - READ-ONLY; Data type of the configuration.
322	DataType *string `json:"dataType,omitempty"`
323	// AllowedValues - READ-ONLY; Allowed values of the configuration.
324	AllowedValues *string `json:"allowedValues,omitempty"`
325	// Source - Source of the configuration.
326	Source *string `json:"source,omitempty"`
327}
328
329// MarshalJSON is the custom marshaler for ConfigurationProperties.
330func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) {
331	objectMap := make(map[string]interface{})
332	if cp.Value != nil {
333		objectMap["value"] = cp.Value
334	}
335	if cp.Source != nil {
336		objectMap["source"] = cp.Source
337	}
338	return json.Marshal(objectMap)
339}
340
341// ConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
342// long-running operation.
343type ConfigurationsCreateOrUpdateFuture struct {
344	azure.FutureAPI
345	// Result returns the result of the asynchronous operation.
346	// If the operation has not completed it will return an error.
347	Result func(ConfigurationsClient) (Configuration, error)
348}
349
350// UnmarshalJSON is the custom unmarshaller for CreateFuture.
351func (future *ConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
352	var azFuture azure.Future
353	if err := json.Unmarshal(body, &azFuture); err != nil {
354		return err
355	}
356	future.FutureAPI = &azFuture
357	future.Result = future.result
358	return nil
359}
360
361// result is the default implementation for ConfigurationsCreateOrUpdateFuture.Result.
362func (future *ConfigurationsCreateOrUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) {
363	var done bool
364	done, err = future.DoneWithContext(context.Background(), client)
365	if err != nil {
366		err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
367		return
368	}
369	if !done {
370		c.Response.Response = future.Response()
371		err = azure.NewAsyncOpIncompleteError("mariadb.ConfigurationsCreateOrUpdateFuture")
372		return
373	}
374	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
375	if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent {
376		c, err = client.CreateOrUpdateResponder(c.Response.Response)
377		if err != nil {
378			err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request")
379		}
380	}
381	return
382}
383
384// CreateRecommendedActionSessionFuture an abstraction for monitoring and retrieving the results of a
385// long-running operation.
386type CreateRecommendedActionSessionFuture struct {
387	azure.FutureAPI
388	// Result returns the result of the asynchronous operation.
389	// If the operation has not completed it will return an error.
390	Result func(BaseClient) (autorest.Response, error)
391}
392
393// UnmarshalJSON is the custom unmarshaller for CreateFuture.
394func (future *CreateRecommendedActionSessionFuture) UnmarshalJSON(body []byte) error {
395	var azFuture azure.Future
396	if err := json.Unmarshal(body, &azFuture); err != nil {
397		return err
398	}
399	future.FutureAPI = &azFuture
400	future.Result = future.result
401	return nil
402}
403
404// result is the default implementation for CreateRecommendedActionSessionFuture.Result.
405func (future *CreateRecommendedActionSessionFuture) result(client BaseClient) (ar autorest.Response, err error) {
406	var done bool
407	done, err = future.DoneWithContext(context.Background(), client)
408	if err != nil {
409		err = autorest.NewErrorWithError(err, "mariadb.CreateRecommendedActionSessionFuture", "Result", future.Response(), "Polling failure")
410		return
411	}
412	if !done {
413		ar.Response = future.Response()
414		err = azure.NewAsyncOpIncompleteError("mariadb.CreateRecommendedActionSessionFuture")
415		return
416	}
417	ar.Response = future.Response()
418	return
419}
420
421// Database represents a Database.
422type Database struct {
423	autorest.Response `json:"-"`
424	// DatabaseProperties - The properties of a database.
425	*DatabaseProperties `json:"properties,omitempty"`
426	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
427	ID *string `json:"id,omitempty"`
428	// Name - READ-ONLY; The name of the resource
429	Name *string `json:"name,omitempty"`
430	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
431	Type *string `json:"type,omitempty"`
432}
433
434// MarshalJSON is the custom marshaler for Database.
435func (d Database) MarshalJSON() ([]byte, error) {
436	objectMap := make(map[string]interface{})
437	if d.DatabaseProperties != nil {
438		objectMap["properties"] = d.DatabaseProperties
439	}
440	return json.Marshal(objectMap)
441}
442
443// UnmarshalJSON is the custom unmarshaler for Database struct.
444func (d *Database) UnmarshalJSON(body []byte) error {
445	var m map[string]*json.RawMessage
446	err := json.Unmarshal(body, &m)
447	if err != nil {
448		return err
449	}
450	for k, v := range m {
451		switch k {
452		case "properties":
453			if v != nil {
454				var databaseProperties DatabaseProperties
455				err = json.Unmarshal(*v, &databaseProperties)
456				if err != nil {
457					return err
458				}
459				d.DatabaseProperties = &databaseProperties
460			}
461		case "id":
462			if v != nil {
463				var ID string
464				err = json.Unmarshal(*v, &ID)
465				if err != nil {
466					return err
467				}
468				d.ID = &ID
469			}
470		case "name":
471			if v != nil {
472				var name string
473				err = json.Unmarshal(*v, &name)
474				if err != nil {
475					return err
476				}
477				d.Name = &name
478			}
479		case "type":
480			if v != nil {
481				var typeVar string
482				err = json.Unmarshal(*v, &typeVar)
483				if err != nil {
484					return err
485				}
486				d.Type = &typeVar
487			}
488		}
489	}
490
491	return nil
492}
493
494// DatabaseListResult a List of databases.
495type DatabaseListResult struct {
496	autorest.Response `json:"-"`
497	// Value - The list of databases housed in a server
498	Value *[]Database `json:"value,omitempty"`
499}
500
501// DatabaseProperties the properties of a database.
502type DatabaseProperties struct {
503	// Charset - The charset of the database.
504	Charset *string `json:"charset,omitempty"`
505	// Collation - The collation of the database.
506	Collation *string `json:"collation,omitempty"`
507}
508
509// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
510// operation.
511type DatabasesCreateOrUpdateFuture struct {
512	azure.FutureAPI
513	// Result returns the result of the asynchronous operation.
514	// If the operation has not completed it will return an error.
515	Result func(DatabasesClient) (Database, error)
516}
517
518// UnmarshalJSON is the custom unmarshaller for CreateFuture.
519func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
520	var azFuture azure.Future
521	if err := json.Unmarshal(body, &azFuture); err != nil {
522		return err
523	}
524	future.FutureAPI = &azFuture
525	future.Result = future.result
526	return nil
527}
528
529// result is the default implementation for DatabasesCreateOrUpdateFuture.Result.
530func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) {
531	var done bool
532	done, err = future.DoneWithContext(context.Background(), client)
533	if err != nil {
534		err = autorest.NewErrorWithError(err, "mariadb.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
535		return
536	}
537	if !done {
538		d.Response.Response = future.Response()
539		err = azure.NewAsyncOpIncompleteError("mariadb.DatabasesCreateOrUpdateFuture")
540		return
541	}
542	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
543	if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent {
544		d, err = client.CreateOrUpdateResponder(d.Response.Response)
545		if err != nil {
546			err = autorest.NewErrorWithError(err, "mariadb.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request")
547		}
548	}
549	return
550}
551
552// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
553// operation.
554type DatabasesDeleteFuture struct {
555	azure.FutureAPI
556	// Result returns the result of the asynchronous operation.
557	// If the operation has not completed it will return an error.
558	Result func(DatabasesClient) (autorest.Response, error)
559}
560
561// UnmarshalJSON is the custom unmarshaller for CreateFuture.
562func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error {
563	var azFuture azure.Future
564	if err := json.Unmarshal(body, &azFuture); err != nil {
565		return err
566	}
567	future.FutureAPI = &azFuture
568	future.Result = future.result
569	return nil
570}
571
572// result is the default implementation for DatabasesDeleteFuture.Result.
573func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) {
574	var done bool
575	done, err = future.DoneWithContext(context.Background(), client)
576	if err != nil {
577		err = autorest.NewErrorWithError(err, "mariadb.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
578		return
579	}
580	if !done {
581		ar.Response = future.Response()
582		err = azure.NewAsyncOpIncompleteError("mariadb.DatabasesDeleteFuture")
583		return
584	}
585	ar.Response = future.Response()
586	return
587}
588
589// ErrorAdditionalInfo the resource management error additional info.
590type ErrorAdditionalInfo struct {
591	// Type - READ-ONLY; The additional info type.
592	Type *string `json:"type,omitempty"`
593	// Info - READ-ONLY; The additional info.
594	Info interface{} `json:"info,omitempty"`
595}
596
597// MarshalJSON is the custom marshaler for ErrorAdditionalInfo.
598func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) {
599	objectMap := make(map[string]interface{})
600	return json.Marshal(objectMap)
601}
602
603// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for
604// failed operations. (This also follows the OData error response format.)
605type ErrorResponse struct {
606	// Code - READ-ONLY; The error code.
607	Code *string `json:"code,omitempty"`
608	// Message - READ-ONLY; The error message.
609	Message *string `json:"message,omitempty"`
610	// Target - READ-ONLY; The error target.
611	Target *string `json:"target,omitempty"`
612	// Details - READ-ONLY; The error details.
613	Details *[]ErrorResponse `json:"details,omitempty"`
614	// AdditionalInfo - READ-ONLY; The error additional info.
615	AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
616}
617
618// MarshalJSON is the custom marshaler for ErrorResponse.
619func (er ErrorResponse) MarshalJSON() ([]byte, error) {
620	objectMap := make(map[string]interface{})
621	return json.Marshal(objectMap)
622}
623
624// FirewallRule represents a server firewall rule.
625type FirewallRule struct {
626	autorest.Response `json:"-"`
627	// FirewallRuleProperties - The properties of a firewall rule.
628	*FirewallRuleProperties `json:"properties,omitempty"`
629	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
630	ID *string `json:"id,omitempty"`
631	// Name - READ-ONLY; The name of the resource
632	Name *string `json:"name,omitempty"`
633	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
634	Type *string `json:"type,omitempty"`
635}
636
637// MarshalJSON is the custom marshaler for FirewallRule.
638func (fr FirewallRule) MarshalJSON() ([]byte, error) {
639	objectMap := make(map[string]interface{})
640	if fr.FirewallRuleProperties != nil {
641		objectMap["properties"] = fr.FirewallRuleProperties
642	}
643	return json.Marshal(objectMap)
644}
645
646// UnmarshalJSON is the custom unmarshaler for FirewallRule struct.
647func (fr *FirewallRule) UnmarshalJSON(body []byte) error {
648	var m map[string]*json.RawMessage
649	err := json.Unmarshal(body, &m)
650	if err != nil {
651		return err
652	}
653	for k, v := range m {
654		switch k {
655		case "properties":
656			if v != nil {
657				var firewallRuleProperties FirewallRuleProperties
658				err = json.Unmarshal(*v, &firewallRuleProperties)
659				if err != nil {
660					return err
661				}
662				fr.FirewallRuleProperties = &firewallRuleProperties
663			}
664		case "id":
665			if v != nil {
666				var ID string
667				err = json.Unmarshal(*v, &ID)
668				if err != nil {
669					return err
670				}
671				fr.ID = &ID
672			}
673		case "name":
674			if v != nil {
675				var name string
676				err = json.Unmarshal(*v, &name)
677				if err != nil {
678					return err
679				}
680				fr.Name = &name
681			}
682		case "type":
683			if v != nil {
684				var typeVar string
685				err = json.Unmarshal(*v, &typeVar)
686				if err != nil {
687					return err
688				}
689				fr.Type = &typeVar
690			}
691		}
692	}
693
694	return nil
695}
696
697// FirewallRuleListResult a list of firewall rules.
698type FirewallRuleListResult struct {
699	autorest.Response `json:"-"`
700	// Value - The list of firewall rules in a server.
701	Value *[]FirewallRule `json:"value,omitempty"`
702}
703
704// FirewallRuleProperties the properties of a server firewall rule.
705type FirewallRuleProperties struct {
706	// StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format.
707	StartIPAddress *string `json:"startIpAddress,omitempty"`
708	// EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format.
709	EndIPAddress *string `json:"endIpAddress,omitempty"`
710}
711
712// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
713// long-running operation.
714type FirewallRulesCreateOrUpdateFuture struct {
715	azure.FutureAPI
716	// Result returns the result of the asynchronous operation.
717	// If the operation has not completed it will return an error.
718	Result func(FirewallRulesClient) (FirewallRule, error)
719}
720
721// UnmarshalJSON is the custom unmarshaller for CreateFuture.
722func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
723	var azFuture azure.Future
724	if err := json.Unmarshal(body, &azFuture); err != nil {
725		return err
726	}
727	future.FutureAPI = &azFuture
728	future.Result = future.result
729	return nil
730}
731
732// result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result.
733func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) {
734	var done bool
735	done, err = future.DoneWithContext(context.Background(), client)
736	if err != nil {
737		err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
738		return
739	}
740	if !done {
741		fr.Response.Response = future.Response()
742		err = azure.NewAsyncOpIncompleteError("mariadb.FirewallRulesCreateOrUpdateFuture")
743		return
744	}
745	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
746	if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent {
747		fr, err = client.CreateOrUpdateResponder(fr.Response.Response)
748		if err != nil {
749			err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request")
750		}
751	}
752	return
753}
754
755// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
756// operation.
757type FirewallRulesDeleteFuture struct {
758	azure.FutureAPI
759	// Result returns the result of the asynchronous operation.
760	// If the operation has not completed it will return an error.
761	Result func(FirewallRulesClient) (autorest.Response, error)
762}
763
764// UnmarshalJSON is the custom unmarshaller for CreateFuture.
765func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error {
766	var azFuture azure.Future
767	if err := json.Unmarshal(body, &azFuture); err != nil {
768		return err
769	}
770	future.FutureAPI = &azFuture
771	future.Result = future.result
772	return nil
773}
774
775// result is the default implementation for FirewallRulesDeleteFuture.Result.
776func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) {
777	var done bool
778	done, err = future.DoneWithContext(context.Background(), client)
779	if err != nil {
780		err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure")
781		return
782	}
783	if !done {
784		ar.Response = future.Response()
785		err = azure.NewAsyncOpIncompleteError("mariadb.FirewallRulesDeleteFuture")
786		return
787	}
788	ar.Response = future.Response()
789	return
790}
791
792// LogFile represents a log file.
793type LogFile struct {
794	// LogFileProperties - The properties of the log file.
795	*LogFileProperties `json:"properties,omitempty"`
796	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
797	ID *string `json:"id,omitempty"`
798	// Name - READ-ONLY; The name of the resource
799	Name *string `json:"name,omitempty"`
800	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
801	Type *string `json:"type,omitempty"`
802}
803
804// MarshalJSON is the custom marshaler for LogFile.
805func (lf LogFile) MarshalJSON() ([]byte, error) {
806	objectMap := make(map[string]interface{})
807	if lf.LogFileProperties != nil {
808		objectMap["properties"] = lf.LogFileProperties
809	}
810	return json.Marshal(objectMap)
811}
812
813// UnmarshalJSON is the custom unmarshaler for LogFile struct.
814func (lf *LogFile) UnmarshalJSON(body []byte) error {
815	var m map[string]*json.RawMessage
816	err := json.Unmarshal(body, &m)
817	if err != nil {
818		return err
819	}
820	for k, v := range m {
821		switch k {
822		case "properties":
823			if v != nil {
824				var logFileProperties LogFileProperties
825				err = json.Unmarshal(*v, &logFileProperties)
826				if err != nil {
827					return err
828				}
829				lf.LogFileProperties = &logFileProperties
830			}
831		case "id":
832			if v != nil {
833				var ID string
834				err = json.Unmarshal(*v, &ID)
835				if err != nil {
836					return err
837				}
838				lf.ID = &ID
839			}
840		case "name":
841			if v != nil {
842				var name string
843				err = json.Unmarshal(*v, &name)
844				if err != nil {
845					return err
846				}
847				lf.Name = &name
848			}
849		case "type":
850			if v != nil {
851				var typeVar string
852				err = json.Unmarshal(*v, &typeVar)
853				if err != nil {
854					return err
855				}
856				lf.Type = &typeVar
857			}
858		}
859	}
860
861	return nil
862}
863
864// LogFileListResult a list of log files.
865type LogFileListResult struct {
866	autorest.Response `json:"-"`
867	// Value - The list of log files.
868	Value *[]LogFile `json:"value,omitempty"`
869}
870
871// LogFileProperties the properties of a log file.
872type LogFileProperties struct {
873	// SizeInKB - Size of the log file.
874	SizeInKB *int64 `json:"sizeInKB,omitempty"`
875	// CreatedTime - READ-ONLY; Creation timestamp of the log file.
876	CreatedTime *date.Time `json:"createdTime,omitempty"`
877	// LastModifiedTime - READ-ONLY; Last modified timestamp of the log file.
878	LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"`
879	// Type - Type of the log file.
880	Type *string `json:"type,omitempty"`
881	// URL - READ-ONLY; The url to download the log file from.
882	URL *string `json:"url,omitempty"`
883}
884
885// MarshalJSON is the custom marshaler for LogFileProperties.
886func (lfp LogFileProperties) MarshalJSON() ([]byte, error) {
887	objectMap := make(map[string]interface{})
888	if lfp.SizeInKB != nil {
889		objectMap["sizeInKB"] = lfp.SizeInKB
890	}
891	if lfp.Type != nil {
892		objectMap["type"] = lfp.Type
893	}
894	return json.Marshal(objectMap)
895}
896
897// NameAvailability represents a resource name availability.
898type NameAvailability struct {
899	autorest.Response `json:"-"`
900	// Message - Error Message.
901	Message *string `json:"message,omitempty"`
902	// NameAvailable - Indicates whether the resource name is available.
903	NameAvailable *bool `json:"nameAvailable,omitempty"`
904	// Reason - Reason for name being unavailable.
905	Reason *string `json:"reason,omitempty"`
906}
907
908// NameAvailabilityRequest request from client to check resource name availability.
909type NameAvailabilityRequest struct {
910	// Name - Resource name to verify.
911	Name *string `json:"name,omitempty"`
912	// Type - Resource type used for verification.
913	Type *string `json:"type,omitempty"`
914}
915
916// Operation REST API operation definition.
917type Operation struct {
918	// Name - READ-ONLY; The name of the operation being performed on this particular object.
919	Name *string `json:"name,omitempty"`
920	// Display - READ-ONLY; The localized display information for this particular operation or action.
921	Display *OperationDisplay `json:"display,omitempty"`
922	// Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System'
923	Origin OperationOrigin `json:"origin,omitempty"`
924	// Properties - READ-ONLY; Additional descriptions for the operation.
925	Properties map[string]interface{} `json:"properties"`
926}
927
928// MarshalJSON is the custom marshaler for Operation.
929func (o Operation) MarshalJSON() ([]byte, error) {
930	objectMap := make(map[string]interface{})
931	return json.Marshal(objectMap)
932}
933
934// OperationDisplay display metadata associated with the operation.
935type OperationDisplay struct {
936	// Provider - READ-ONLY; Operation resource provider name.
937	Provider *string `json:"provider,omitempty"`
938	// Resource - READ-ONLY; Resource on which the operation is performed.
939	Resource *string `json:"resource,omitempty"`
940	// Operation - READ-ONLY; Localized friendly name for the operation.
941	Operation *string `json:"operation,omitempty"`
942	// Description - READ-ONLY; Operation description.
943	Description *string `json:"description,omitempty"`
944}
945
946// MarshalJSON is the custom marshaler for OperationDisplay.
947func (od OperationDisplay) MarshalJSON() ([]byte, error) {
948	objectMap := make(map[string]interface{})
949	return json.Marshal(objectMap)
950}
951
952// OperationListResult a list of resource provider operations.
953type OperationListResult struct {
954	autorest.Response `json:"-"`
955	// Value - The list of resource provider operations.
956	Value *[]Operation `json:"value,omitempty"`
957}
958
959// PerformanceTierListResult a list of performance tiers.
960type PerformanceTierListResult struct {
961	autorest.Response `json:"-"`
962	// Value - The list of performance tiers
963	Value *[]PerformanceTierProperties `json:"value,omitempty"`
964}
965
966// PerformanceTierProperties performance tier properties
967type PerformanceTierProperties struct {
968	// ID - ID of the performance tier.
969	ID *string `json:"id,omitempty"`
970	// ServiceLevelObjectives - Service level objectives associated with the performance tier
971	ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"`
972}
973
974// PerformanceTierServiceLevelObjectives service level objectives for performance tier.
975type PerformanceTierServiceLevelObjectives struct {
976	// ID - ID for the service level objective.
977	ID *string `json:"id,omitempty"`
978	// Edition - Edition of the performance tier.
979	Edition *string `json:"edition,omitempty"`
980	// VCore - vCore associated with the service level objective
981	VCore *int32 `json:"vCore,omitempty"`
982	// HardwareGeneration - Hardware generation associated with the service level objective
983	HardwareGeneration *string `json:"hardwareGeneration,omitempty"`
984	// MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition
985	MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"`
986	// MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition
987	MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"`
988	// MaxStorageMB - Max storage allowed for a server.
989	MaxStorageMB *int32 `json:"maxStorageMB,omitempty"`
990	// MinStorageMB - Max storage allowed for a server.
991	MinStorageMB *int32 `json:"minStorageMB,omitempty"`
992}
993
994// PrivateEndpointConnection a private endpoint connection
995type PrivateEndpointConnection struct {
996	autorest.Response `json:"-"`
997	// PrivateEndpointConnectionProperties - Resource properties.
998	*PrivateEndpointConnectionProperties `json:"properties,omitempty"`
999	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1000	ID *string `json:"id,omitempty"`
1001	// Name - READ-ONLY; The name of the resource
1002	Name *string `json:"name,omitempty"`
1003	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1004	Type *string `json:"type,omitempty"`
1005}
1006
1007// MarshalJSON is the custom marshaler for PrivateEndpointConnection.
1008func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
1009	objectMap := make(map[string]interface{})
1010	if pec.PrivateEndpointConnectionProperties != nil {
1011		objectMap["properties"] = pec.PrivateEndpointConnectionProperties
1012	}
1013	return json.Marshal(objectMap)
1014}
1015
1016// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct.
1017func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error {
1018	var m map[string]*json.RawMessage
1019	err := json.Unmarshal(body, &m)
1020	if err != nil {
1021		return err
1022	}
1023	for k, v := range m {
1024		switch k {
1025		case "properties":
1026			if v != nil {
1027				var privateEndpointConnectionProperties PrivateEndpointConnectionProperties
1028				err = json.Unmarshal(*v, &privateEndpointConnectionProperties)
1029				if err != nil {
1030					return err
1031				}
1032				pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties
1033			}
1034		case "id":
1035			if v != nil {
1036				var ID string
1037				err = json.Unmarshal(*v, &ID)
1038				if err != nil {
1039					return err
1040				}
1041				pec.ID = &ID
1042			}
1043		case "name":
1044			if v != nil {
1045				var name string
1046				err = json.Unmarshal(*v, &name)
1047				if err != nil {
1048					return err
1049				}
1050				pec.Name = &name
1051			}
1052		case "type":
1053			if v != nil {
1054				var typeVar string
1055				err = json.Unmarshal(*v, &typeVar)
1056				if err != nil {
1057					return err
1058				}
1059				pec.Type = &typeVar
1060			}
1061		}
1062	}
1063
1064	return nil
1065}
1066
1067// PrivateEndpointConnectionListResult a list of private endpoint connections.
1068type PrivateEndpointConnectionListResult struct {
1069	autorest.Response `json:"-"`
1070	// Value - READ-ONLY; Array of results.
1071	Value *[]PrivateEndpointConnection `json:"value,omitempty"`
1072	// NextLink - READ-ONLY; Link to retrieve next page of results.
1073	NextLink *string `json:"nextLink,omitempty"`
1074}
1075
1076// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult.
1077func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) {
1078	objectMap := make(map[string]interface{})
1079	return json.Marshal(objectMap)
1080}
1081
1082// PrivateEndpointConnectionListResultIterator provides access to a complete listing of
1083// PrivateEndpointConnection values.
1084type PrivateEndpointConnectionListResultIterator struct {
1085	i    int
1086	page PrivateEndpointConnectionListResultPage
1087}
1088
1089// NextWithContext advances to the next value.  If there was an error making
1090// the request the iterator does not advance and the error is returned.
1091func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) {
1092	if tracing.IsEnabled() {
1093		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext")
1094		defer func() {
1095			sc := -1
1096			if iter.Response().Response.Response != nil {
1097				sc = iter.Response().Response.Response.StatusCode
1098			}
1099			tracing.EndSpan(ctx, sc, err)
1100		}()
1101	}
1102	iter.i++
1103	if iter.i < len(iter.page.Values()) {
1104		return nil
1105	}
1106	err = iter.page.NextWithContext(ctx)
1107	if err != nil {
1108		iter.i--
1109		return err
1110	}
1111	iter.i = 0
1112	return nil
1113}
1114
1115// Next advances to the next value.  If there was an error making
1116// the request the iterator does not advance and the error is returned.
1117// Deprecated: Use NextWithContext() instead.
1118func (iter *PrivateEndpointConnectionListResultIterator) Next() error {
1119	return iter.NextWithContext(context.Background())
1120}
1121
1122// NotDone returns true if the enumeration should be started or is not yet complete.
1123func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool {
1124	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1125}
1126
1127// Response returns the raw server response from the last page request.
1128func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult {
1129	return iter.page.Response()
1130}
1131
1132// Value returns the current value or a zero-initialized value if the
1133// iterator has advanced beyond the end of the collection.
1134func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection {
1135	if !iter.page.NotDone() {
1136		return PrivateEndpointConnection{}
1137	}
1138	return iter.page.Values()[iter.i]
1139}
1140
1141// Creates a new instance of the PrivateEndpointConnectionListResultIterator type.
1142func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator {
1143	return PrivateEndpointConnectionListResultIterator{page: page}
1144}
1145
1146// IsEmpty returns true if the ListResult contains no values.
1147func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool {
1148	return peclr.Value == nil || len(*peclr.Value) == 0
1149}
1150
1151// hasNextLink returns true if the NextLink is not empty.
1152func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool {
1153	return peclr.NextLink != nil && len(*peclr.NextLink) != 0
1154}
1155
1156// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results.
1157// It returns nil if no more results exist.
1158func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) {
1159	if !peclr.hasNextLink() {
1160		return nil, nil
1161	}
1162	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1163		autorest.AsJSON(),
1164		autorest.AsGet(),
1165		autorest.WithBaseURL(to.String(peclr.NextLink)))
1166}
1167
1168// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values.
1169type PrivateEndpointConnectionListResultPage struct {
1170	fn    func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)
1171	peclr PrivateEndpointConnectionListResult
1172}
1173
1174// NextWithContext advances to the next page of values.  If there was an error making
1175// the request the page does not advance and the error is returned.
1176func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) {
1177	if tracing.IsEnabled() {
1178		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext")
1179		defer func() {
1180			sc := -1
1181			if page.Response().Response.Response != nil {
1182				sc = page.Response().Response.Response.StatusCode
1183			}
1184			tracing.EndSpan(ctx, sc, err)
1185		}()
1186	}
1187	for {
1188		next, err := page.fn(ctx, page.peclr)
1189		if err != nil {
1190			return err
1191		}
1192		page.peclr = next
1193		if !next.hasNextLink() || !next.IsEmpty() {
1194			break
1195		}
1196	}
1197	return nil
1198}
1199
1200// Next advances to the next page of values.  If there was an error making
1201// the request the page does not advance and the error is returned.
1202// Deprecated: Use NextWithContext() instead.
1203func (page *PrivateEndpointConnectionListResultPage) Next() error {
1204	return page.NextWithContext(context.Background())
1205}
1206
1207// NotDone returns true if the page enumeration should be started or is not yet complete.
1208func (page PrivateEndpointConnectionListResultPage) NotDone() bool {
1209	return !page.peclr.IsEmpty()
1210}
1211
1212// Response returns the raw server response from the last page request.
1213func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult {
1214	return page.peclr
1215}
1216
1217// Values returns the slice of values for the current page or nil if there are no values.
1218func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection {
1219	if page.peclr.IsEmpty() {
1220		return nil
1221	}
1222	return *page.peclr.Value
1223}
1224
1225// Creates a new instance of the PrivateEndpointConnectionListResultPage type.
1226func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage {
1227	return PrivateEndpointConnectionListResultPage{
1228		fn:    getNextPage,
1229		peclr: cur,
1230	}
1231}
1232
1233// PrivateEndpointConnectionProperties properties of a private endpoint connection.
1234type PrivateEndpointConnectionProperties struct {
1235	// PrivateEndpoint - Private endpoint which the connection belongs to.
1236	PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"`
1237	// PrivateLinkServiceConnectionState - Connection state of the private endpoint connection.
1238	PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"`
1239	// ProvisioningState - READ-ONLY; State of the private endpoint connection.
1240	ProvisioningState *string `json:"provisioningState,omitempty"`
1241}
1242
1243// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties.
1244func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) {
1245	objectMap := make(map[string]interface{})
1246	if pecp.PrivateEndpoint != nil {
1247		objectMap["privateEndpoint"] = pecp.PrivateEndpoint
1248	}
1249	if pecp.PrivateLinkServiceConnectionState != nil {
1250		objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState
1251	}
1252	return json.Marshal(objectMap)
1253}
1254
1255// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results
1256// of a long-running operation.
1257type PrivateEndpointConnectionsCreateOrUpdateFuture struct {
1258	azure.FutureAPI
1259	// Result returns the result of the asynchronous operation.
1260	// If the operation has not completed it will return an error.
1261	Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error)
1262}
1263
1264// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1265func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
1266	var azFuture azure.Future
1267	if err := json.Unmarshal(body, &azFuture); err != nil {
1268		return err
1269	}
1270	future.FutureAPI = &azFuture
1271	future.Result = future.result
1272	return nil
1273}
1274
1275// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result.
1276func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) {
1277	var done bool
1278	done, err = future.DoneWithContext(context.Background(), client)
1279	if err != nil {
1280		err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1281		return
1282	}
1283	if !done {
1284		pec.Response.Response = future.Response()
1285		err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture")
1286		return
1287	}
1288	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1289	if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {
1290		pec, err = client.CreateOrUpdateResponder(pec.Response.Response)
1291		if err != nil {
1292			err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request")
1293		}
1294	}
1295	return
1296}
1297
1298// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a
1299// long-running operation.
1300type PrivateEndpointConnectionsDeleteFuture struct {
1301	azure.FutureAPI
1302	// Result returns the result of the asynchronous operation.
1303	// If the operation has not completed it will return an error.
1304	Result func(PrivateEndpointConnectionsClient) (autorest.Response, error)
1305}
1306
1307// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1308func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error {
1309	var azFuture azure.Future
1310	if err := json.Unmarshal(body, &azFuture); err != nil {
1311		return err
1312	}
1313	future.FutureAPI = &azFuture
1314	future.Result = future.result
1315	return nil
1316}
1317
1318// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result.
1319func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) {
1320	var done bool
1321	done, err = future.DoneWithContext(context.Background(), client)
1322	if err != nil {
1323		err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure")
1324		return
1325	}
1326	if !done {
1327		ar.Response = future.Response()
1328		err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsDeleteFuture")
1329		return
1330	}
1331	ar.Response = future.Response()
1332	return
1333}
1334
1335// PrivateEndpointConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a
1336// long-running operation.
1337type PrivateEndpointConnectionsUpdateTagsFuture struct {
1338	azure.FutureAPI
1339	// Result returns the result of the asynchronous operation.
1340	// If the operation has not completed it will return an error.
1341	Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error)
1342}
1343
1344// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1345func (future *PrivateEndpointConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error {
1346	var azFuture azure.Future
1347	if err := json.Unmarshal(body, &azFuture); err != nil {
1348		return err
1349	}
1350	future.FutureAPI = &azFuture
1351	future.Result = future.result
1352	return nil
1353}
1354
1355// result is the default implementation for PrivateEndpointConnectionsUpdateTagsFuture.Result.
1356func (future *PrivateEndpointConnectionsUpdateTagsFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) {
1357	var done bool
1358	done, err = future.DoneWithContext(context.Background(), client)
1359	if err != nil {
1360		err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure")
1361		return
1362	}
1363	if !done {
1364		pec.Response.Response = future.Response()
1365		err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsUpdateTagsFuture")
1366		return
1367	}
1368	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1369	if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {
1370		pec, err = client.UpdateTagsResponder(pec.Response.Response)
1371		if err != nil {
1372			err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsUpdateTagsFuture", "Result", pec.Response.Response, "Failure responding to request")
1373		}
1374	}
1375	return
1376}
1377
1378// PrivateEndpointProperty ...
1379type PrivateEndpointProperty struct {
1380	// ID - Resource id of the private endpoint.
1381	ID *string `json:"id,omitempty"`
1382}
1383
1384// PrivateLinkResource a private link resource
1385type PrivateLinkResource struct {
1386	autorest.Response `json:"-"`
1387	// Properties - READ-ONLY; The private link resource group id.
1388	Properties *PrivateLinkResourceProperties `json:"properties,omitempty"`
1389	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1390	ID *string `json:"id,omitempty"`
1391	// Name - READ-ONLY; The name of the resource
1392	Name *string `json:"name,omitempty"`
1393	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1394	Type *string `json:"type,omitempty"`
1395}
1396
1397// MarshalJSON is the custom marshaler for PrivateLinkResource.
1398func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) {
1399	objectMap := make(map[string]interface{})
1400	return json.Marshal(objectMap)
1401}
1402
1403// PrivateLinkResourceListResult a list of private link resources
1404type PrivateLinkResourceListResult struct {
1405	autorest.Response `json:"-"`
1406	// Value - READ-ONLY; Array of results.
1407	Value *[]PrivateLinkResource `json:"value,omitempty"`
1408	// NextLink - READ-ONLY; Link to retrieve next page of results.
1409	NextLink *string `json:"nextLink,omitempty"`
1410}
1411
1412// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult.
1413func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) {
1414	objectMap := make(map[string]interface{})
1415	return json.Marshal(objectMap)
1416}
1417
1418// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource
1419// values.
1420type PrivateLinkResourceListResultIterator struct {
1421	i    int
1422	page PrivateLinkResourceListResultPage
1423}
1424
1425// NextWithContext advances to the next value.  If there was an error making
1426// the request the iterator does not advance and the error is returned.
1427func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) {
1428	if tracing.IsEnabled() {
1429		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext")
1430		defer func() {
1431			sc := -1
1432			if iter.Response().Response.Response != nil {
1433				sc = iter.Response().Response.Response.StatusCode
1434			}
1435			tracing.EndSpan(ctx, sc, err)
1436		}()
1437	}
1438	iter.i++
1439	if iter.i < len(iter.page.Values()) {
1440		return nil
1441	}
1442	err = iter.page.NextWithContext(ctx)
1443	if err != nil {
1444		iter.i--
1445		return err
1446	}
1447	iter.i = 0
1448	return nil
1449}
1450
1451// Next advances to the next value.  If there was an error making
1452// the request the iterator does not advance and the error is returned.
1453// Deprecated: Use NextWithContext() instead.
1454func (iter *PrivateLinkResourceListResultIterator) Next() error {
1455	return iter.NextWithContext(context.Background())
1456}
1457
1458// NotDone returns true if the enumeration should be started or is not yet complete.
1459func (iter PrivateLinkResourceListResultIterator) NotDone() bool {
1460	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1461}
1462
1463// Response returns the raw server response from the last page request.
1464func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult {
1465	return iter.page.Response()
1466}
1467
1468// Value returns the current value or a zero-initialized value if the
1469// iterator has advanced beyond the end of the collection.
1470func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource {
1471	if !iter.page.NotDone() {
1472		return PrivateLinkResource{}
1473	}
1474	return iter.page.Values()[iter.i]
1475}
1476
1477// Creates a new instance of the PrivateLinkResourceListResultIterator type.
1478func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator {
1479	return PrivateLinkResourceListResultIterator{page: page}
1480}
1481
1482// IsEmpty returns true if the ListResult contains no values.
1483func (plrlr PrivateLinkResourceListResult) IsEmpty() bool {
1484	return plrlr.Value == nil || len(*plrlr.Value) == 0
1485}
1486
1487// hasNextLink returns true if the NextLink is not empty.
1488func (plrlr PrivateLinkResourceListResult) hasNextLink() bool {
1489	return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0
1490}
1491
1492// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results.
1493// It returns nil if no more results exist.
1494func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) {
1495	if !plrlr.hasNextLink() {
1496		return nil, nil
1497	}
1498	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1499		autorest.AsJSON(),
1500		autorest.AsGet(),
1501		autorest.WithBaseURL(to.String(plrlr.NextLink)))
1502}
1503
1504// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values.
1505type PrivateLinkResourceListResultPage struct {
1506	fn    func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)
1507	plrlr PrivateLinkResourceListResult
1508}
1509
1510// NextWithContext advances to the next page of values.  If there was an error making
1511// the request the page does not advance and the error is returned.
1512func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) {
1513	if tracing.IsEnabled() {
1514		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext")
1515		defer func() {
1516			sc := -1
1517			if page.Response().Response.Response != nil {
1518				sc = page.Response().Response.Response.StatusCode
1519			}
1520			tracing.EndSpan(ctx, sc, err)
1521		}()
1522	}
1523	for {
1524		next, err := page.fn(ctx, page.plrlr)
1525		if err != nil {
1526			return err
1527		}
1528		page.plrlr = next
1529		if !next.hasNextLink() || !next.IsEmpty() {
1530			break
1531		}
1532	}
1533	return nil
1534}
1535
1536// Next advances to the next page of values.  If there was an error making
1537// the request the page does not advance and the error is returned.
1538// Deprecated: Use NextWithContext() instead.
1539func (page *PrivateLinkResourceListResultPage) Next() error {
1540	return page.NextWithContext(context.Background())
1541}
1542
1543// NotDone returns true if the page enumeration should be started or is not yet complete.
1544func (page PrivateLinkResourceListResultPage) NotDone() bool {
1545	return !page.plrlr.IsEmpty()
1546}
1547
1548// Response returns the raw server response from the last page request.
1549func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult {
1550	return page.plrlr
1551}
1552
1553// Values returns the slice of values for the current page or nil if there are no values.
1554func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource {
1555	if page.plrlr.IsEmpty() {
1556		return nil
1557	}
1558	return *page.plrlr.Value
1559}
1560
1561// Creates a new instance of the PrivateLinkResourceListResultPage type.
1562func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage {
1563	return PrivateLinkResourceListResultPage{
1564		fn:    getNextPage,
1565		plrlr: cur,
1566	}
1567}
1568
1569// PrivateLinkResourceProperties properties of a private link resource.
1570type PrivateLinkResourceProperties struct {
1571	// GroupID - READ-ONLY; The private link resource group id.
1572	GroupID *string `json:"groupId,omitempty"`
1573	// RequiredMembers - READ-ONLY; The private link resource required member names.
1574	RequiredMembers *[]string `json:"requiredMembers,omitempty"`
1575}
1576
1577// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties.
1578func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) {
1579	objectMap := make(map[string]interface{})
1580	return json.Marshal(objectMap)
1581}
1582
1583// PrivateLinkServiceConnectionStateProperty ...
1584type PrivateLinkServiceConnectionStateProperty struct {
1585	// Status - The private link service connection status.
1586	Status *string `json:"status,omitempty"`
1587	// Description - The private link service connection description.
1588	Description *string `json:"description,omitempty"`
1589	// ActionsRequired - READ-ONLY; The actions required for private link service connection.
1590	ActionsRequired *string `json:"actionsRequired,omitempty"`
1591}
1592
1593// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty.
1594func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) {
1595	objectMap := make(map[string]interface{})
1596	if plscsp.Status != nil {
1597		objectMap["status"] = plscsp.Status
1598	}
1599	if plscsp.Description != nil {
1600		objectMap["description"] = plscsp.Description
1601	}
1602	return json.Marshal(objectMap)
1603}
1604
1605// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not
1606// have tags and a location
1607type ProxyResource struct {
1608	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1609	ID *string `json:"id,omitempty"`
1610	// Name - READ-ONLY; The name of the resource
1611	Name *string `json:"name,omitempty"`
1612	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1613	Type *string `json:"type,omitempty"`
1614}
1615
1616// MarshalJSON is the custom marshaler for ProxyResource.
1617func (pr ProxyResource) MarshalJSON() ([]byte, error) {
1618	objectMap := make(map[string]interface{})
1619	return json.Marshal(objectMap)
1620}
1621
1622// QueryStatistic represents a Query Statistic.
1623type QueryStatistic struct {
1624	autorest.Response `json:"-"`
1625	// QueryStatisticProperties - The properties of a query statistic.
1626	*QueryStatisticProperties `json:"properties,omitempty"`
1627	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1628	ID *string `json:"id,omitempty"`
1629	// Name - READ-ONLY; The name of the resource
1630	Name *string `json:"name,omitempty"`
1631	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1632	Type *string `json:"type,omitempty"`
1633}
1634
1635// MarshalJSON is the custom marshaler for QueryStatistic.
1636func (qs QueryStatistic) MarshalJSON() ([]byte, error) {
1637	objectMap := make(map[string]interface{})
1638	if qs.QueryStatisticProperties != nil {
1639		objectMap["properties"] = qs.QueryStatisticProperties
1640	}
1641	return json.Marshal(objectMap)
1642}
1643
1644// UnmarshalJSON is the custom unmarshaler for QueryStatistic struct.
1645func (qs *QueryStatistic) UnmarshalJSON(body []byte) error {
1646	var m map[string]*json.RawMessage
1647	err := json.Unmarshal(body, &m)
1648	if err != nil {
1649		return err
1650	}
1651	for k, v := range m {
1652		switch k {
1653		case "properties":
1654			if v != nil {
1655				var queryStatisticProperties QueryStatisticProperties
1656				err = json.Unmarshal(*v, &queryStatisticProperties)
1657				if err != nil {
1658					return err
1659				}
1660				qs.QueryStatisticProperties = &queryStatisticProperties
1661			}
1662		case "id":
1663			if v != nil {
1664				var ID string
1665				err = json.Unmarshal(*v, &ID)
1666				if err != nil {
1667					return err
1668				}
1669				qs.ID = &ID
1670			}
1671		case "name":
1672			if v != nil {
1673				var name string
1674				err = json.Unmarshal(*v, &name)
1675				if err != nil {
1676					return err
1677				}
1678				qs.Name = &name
1679			}
1680		case "type":
1681			if v != nil {
1682				var typeVar string
1683				err = json.Unmarshal(*v, &typeVar)
1684				if err != nil {
1685					return err
1686				}
1687				qs.Type = &typeVar
1688			}
1689		}
1690	}
1691
1692	return nil
1693}
1694
1695// QueryStatisticProperties the properties of a query statistic.
1696type QueryStatisticProperties struct {
1697	// QueryID - Database query identifier.
1698	QueryID *string `json:"queryId,omitempty"`
1699	// StartTime - Observation start time.
1700	StartTime *date.Time `json:"startTime,omitempty"`
1701	// EndTime - Observation end time.
1702	EndTime *date.Time `json:"endTime,omitempty"`
1703	// AggregationFunction - Aggregation function name.
1704	AggregationFunction *string `json:"aggregationFunction,omitempty"`
1705	// DatabaseNames - The list of database names.
1706	DatabaseNames *[]string `json:"databaseNames,omitempty"`
1707	// QueryExecutionCount - Number of query executions in this time interval.
1708	QueryExecutionCount *int64 `json:"queryExecutionCount,omitempty"`
1709	// MetricName - Metric name.
1710	MetricName *string `json:"metricName,omitempty"`
1711	// MetricDisplayName - Metric display name.
1712	MetricDisplayName *string `json:"metricDisplayName,omitempty"`
1713	// MetricValue - Metric value.
1714	MetricValue *float64 `json:"metricValue,omitempty"`
1715	// MetricValueUnit - Metric value unit.
1716	MetricValueUnit *string `json:"metricValueUnit,omitempty"`
1717}
1718
1719// QueryText represents a Query Text.
1720type QueryText struct {
1721	autorest.Response `json:"-"`
1722	// QueryTextProperties - The properties of a query text.
1723	*QueryTextProperties `json:"properties,omitempty"`
1724	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1725	ID *string `json:"id,omitempty"`
1726	// Name - READ-ONLY; The name of the resource
1727	Name *string `json:"name,omitempty"`
1728	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1729	Type *string `json:"type,omitempty"`
1730}
1731
1732// MarshalJSON is the custom marshaler for QueryText.
1733func (qt QueryText) MarshalJSON() ([]byte, error) {
1734	objectMap := make(map[string]interface{})
1735	if qt.QueryTextProperties != nil {
1736		objectMap["properties"] = qt.QueryTextProperties
1737	}
1738	return json.Marshal(objectMap)
1739}
1740
1741// UnmarshalJSON is the custom unmarshaler for QueryText struct.
1742func (qt *QueryText) UnmarshalJSON(body []byte) error {
1743	var m map[string]*json.RawMessage
1744	err := json.Unmarshal(body, &m)
1745	if err != nil {
1746		return err
1747	}
1748	for k, v := range m {
1749		switch k {
1750		case "properties":
1751			if v != nil {
1752				var queryTextProperties QueryTextProperties
1753				err = json.Unmarshal(*v, &queryTextProperties)
1754				if err != nil {
1755					return err
1756				}
1757				qt.QueryTextProperties = &queryTextProperties
1758			}
1759		case "id":
1760			if v != nil {
1761				var ID string
1762				err = json.Unmarshal(*v, &ID)
1763				if err != nil {
1764					return err
1765				}
1766				qt.ID = &ID
1767			}
1768		case "name":
1769			if v != nil {
1770				var name string
1771				err = json.Unmarshal(*v, &name)
1772				if err != nil {
1773					return err
1774				}
1775				qt.Name = &name
1776			}
1777		case "type":
1778			if v != nil {
1779				var typeVar string
1780				err = json.Unmarshal(*v, &typeVar)
1781				if err != nil {
1782					return err
1783				}
1784				qt.Type = &typeVar
1785			}
1786		}
1787	}
1788
1789	return nil
1790}
1791
1792// QueryTextProperties the properties of a query text.
1793type QueryTextProperties struct {
1794	// QueryID - Query identifier unique to the server.
1795	QueryID *string `json:"queryId,omitempty"`
1796	// QueryText - Query text.
1797	QueryText *string `json:"queryText,omitempty"`
1798}
1799
1800// QueryTextsResultList a list of query texts.
1801type QueryTextsResultList struct {
1802	autorest.Response `json:"-"`
1803	// Value - READ-ONLY; The list of query texts.
1804	Value *[]QueryText `json:"value,omitempty"`
1805	// NextLink - READ-ONLY; Link to retrieve next page of results.
1806	NextLink *string `json:"nextLink,omitempty"`
1807}
1808
1809// MarshalJSON is the custom marshaler for QueryTextsResultList.
1810func (qtrl QueryTextsResultList) MarshalJSON() ([]byte, error) {
1811	objectMap := make(map[string]interface{})
1812	return json.Marshal(objectMap)
1813}
1814
1815// QueryTextsResultListIterator provides access to a complete listing of QueryText values.
1816type QueryTextsResultListIterator struct {
1817	i    int
1818	page QueryTextsResultListPage
1819}
1820
1821// NextWithContext advances to the next value.  If there was an error making
1822// the request the iterator does not advance and the error is returned.
1823func (iter *QueryTextsResultListIterator) NextWithContext(ctx context.Context) (err error) {
1824	if tracing.IsEnabled() {
1825		ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListIterator.NextWithContext")
1826		defer func() {
1827			sc := -1
1828			if iter.Response().Response.Response != nil {
1829				sc = iter.Response().Response.Response.StatusCode
1830			}
1831			tracing.EndSpan(ctx, sc, err)
1832		}()
1833	}
1834	iter.i++
1835	if iter.i < len(iter.page.Values()) {
1836		return nil
1837	}
1838	err = iter.page.NextWithContext(ctx)
1839	if err != nil {
1840		iter.i--
1841		return err
1842	}
1843	iter.i = 0
1844	return nil
1845}
1846
1847// Next advances to the next value.  If there was an error making
1848// the request the iterator does not advance and the error is returned.
1849// Deprecated: Use NextWithContext() instead.
1850func (iter *QueryTextsResultListIterator) Next() error {
1851	return iter.NextWithContext(context.Background())
1852}
1853
1854// NotDone returns true if the enumeration should be started or is not yet complete.
1855func (iter QueryTextsResultListIterator) NotDone() bool {
1856	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1857}
1858
1859// Response returns the raw server response from the last page request.
1860func (iter QueryTextsResultListIterator) Response() QueryTextsResultList {
1861	return iter.page.Response()
1862}
1863
1864// Value returns the current value or a zero-initialized value if the
1865// iterator has advanced beyond the end of the collection.
1866func (iter QueryTextsResultListIterator) Value() QueryText {
1867	if !iter.page.NotDone() {
1868		return QueryText{}
1869	}
1870	return iter.page.Values()[iter.i]
1871}
1872
1873// Creates a new instance of the QueryTextsResultListIterator type.
1874func NewQueryTextsResultListIterator(page QueryTextsResultListPage) QueryTextsResultListIterator {
1875	return QueryTextsResultListIterator{page: page}
1876}
1877
1878// IsEmpty returns true if the ListResult contains no values.
1879func (qtrl QueryTextsResultList) IsEmpty() bool {
1880	return qtrl.Value == nil || len(*qtrl.Value) == 0
1881}
1882
1883// hasNextLink returns true if the NextLink is not empty.
1884func (qtrl QueryTextsResultList) hasNextLink() bool {
1885	return qtrl.NextLink != nil && len(*qtrl.NextLink) != 0
1886}
1887
1888// queryTextsResultListPreparer prepares a request to retrieve the next set of results.
1889// It returns nil if no more results exist.
1890func (qtrl QueryTextsResultList) queryTextsResultListPreparer(ctx context.Context) (*http.Request, error) {
1891	if !qtrl.hasNextLink() {
1892		return nil, nil
1893	}
1894	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1895		autorest.AsJSON(),
1896		autorest.AsGet(),
1897		autorest.WithBaseURL(to.String(qtrl.NextLink)))
1898}
1899
1900// QueryTextsResultListPage contains a page of QueryText values.
1901type QueryTextsResultListPage struct {
1902	fn   func(context.Context, QueryTextsResultList) (QueryTextsResultList, error)
1903	qtrl QueryTextsResultList
1904}
1905
1906// NextWithContext advances to the next page of values.  If there was an error making
1907// the request the page does not advance and the error is returned.
1908func (page *QueryTextsResultListPage) NextWithContext(ctx context.Context) (err error) {
1909	if tracing.IsEnabled() {
1910		ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListPage.NextWithContext")
1911		defer func() {
1912			sc := -1
1913			if page.Response().Response.Response != nil {
1914				sc = page.Response().Response.Response.StatusCode
1915			}
1916			tracing.EndSpan(ctx, sc, err)
1917		}()
1918	}
1919	for {
1920		next, err := page.fn(ctx, page.qtrl)
1921		if err != nil {
1922			return err
1923		}
1924		page.qtrl = next
1925		if !next.hasNextLink() || !next.IsEmpty() {
1926			break
1927		}
1928	}
1929	return nil
1930}
1931
1932// Next advances to the next page of values.  If there was an error making
1933// the request the page does not advance and the error is returned.
1934// Deprecated: Use NextWithContext() instead.
1935func (page *QueryTextsResultListPage) Next() error {
1936	return page.NextWithContext(context.Background())
1937}
1938
1939// NotDone returns true if the page enumeration should be started or is not yet complete.
1940func (page QueryTextsResultListPage) NotDone() bool {
1941	return !page.qtrl.IsEmpty()
1942}
1943
1944// Response returns the raw server response from the last page request.
1945func (page QueryTextsResultListPage) Response() QueryTextsResultList {
1946	return page.qtrl
1947}
1948
1949// Values returns the slice of values for the current page or nil if there are no values.
1950func (page QueryTextsResultListPage) Values() []QueryText {
1951	if page.qtrl.IsEmpty() {
1952		return nil
1953	}
1954	return *page.qtrl.Value
1955}
1956
1957// Creates a new instance of the QueryTextsResultListPage type.
1958func NewQueryTextsResultListPage(cur QueryTextsResultList, getNextPage func(context.Context, QueryTextsResultList) (QueryTextsResultList, error)) QueryTextsResultListPage {
1959	return QueryTextsResultListPage{
1960		fn:   getNextPage,
1961		qtrl: cur,
1962	}
1963}
1964
1965// RecommendationAction represents a Recommendation Action.
1966type RecommendationAction struct {
1967	autorest.Response `json:"-"`
1968	// RecommendationActionProperties - The properties of a recommendation action.
1969	*RecommendationActionProperties `json:"properties,omitempty"`
1970	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1971	ID *string `json:"id,omitempty"`
1972	// Name - READ-ONLY; The name of the resource
1973	Name *string `json:"name,omitempty"`
1974	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
1975	Type *string `json:"type,omitempty"`
1976}
1977
1978// MarshalJSON is the custom marshaler for RecommendationAction.
1979func (ra RecommendationAction) MarshalJSON() ([]byte, error) {
1980	objectMap := make(map[string]interface{})
1981	if ra.RecommendationActionProperties != nil {
1982		objectMap["properties"] = ra.RecommendationActionProperties
1983	}
1984	return json.Marshal(objectMap)
1985}
1986
1987// UnmarshalJSON is the custom unmarshaler for RecommendationAction struct.
1988func (ra *RecommendationAction) UnmarshalJSON(body []byte) error {
1989	var m map[string]*json.RawMessage
1990	err := json.Unmarshal(body, &m)
1991	if err != nil {
1992		return err
1993	}
1994	for k, v := range m {
1995		switch k {
1996		case "properties":
1997			if v != nil {
1998				var recommendationActionProperties RecommendationActionProperties
1999				err = json.Unmarshal(*v, &recommendationActionProperties)
2000				if err != nil {
2001					return err
2002				}
2003				ra.RecommendationActionProperties = &recommendationActionProperties
2004			}
2005		case "id":
2006			if v != nil {
2007				var ID string
2008				err = json.Unmarshal(*v, &ID)
2009				if err != nil {
2010					return err
2011				}
2012				ra.ID = &ID
2013			}
2014		case "name":
2015			if v != nil {
2016				var name string
2017				err = json.Unmarshal(*v, &name)
2018				if err != nil {
2019					return err
2020				}
2021				ra.Name = &name
2022			}
2023		case "type":
2024			if v != nil {
2025				var typeVar string
2026				err = json.Unmarshal(*v, &typeVar)
2027				if err != nil {
2028					return err
2029				}
2030				ra.Type = &typeVar
2031			}
2032		}
2033	}
2034
2035	return nil
2036}
2037
2038// RecommendationActionProperties the properties of a recommendation action.
2039type RecommendationActionProperties struct {
2040	// AdvisorName - Advisor name.
2041	AdvisorName *string `json:"advisorName,omitempty"`
2042	// SessionID - Recommendation action session identifier.
2043	SessionID *string `json:"sessionId,omitempty"`
2044	// ActionID - Recommendation action identifier.
2045	ActionID *int32 `json:"actionId,omitempty"`
2046	// CreatedTime - Recommendation action creation time.
2047	CreatedTime *date.Time `json:"createdTime,omitempty"`
2048	// ExpirationTime - Recommendation action expiration time.
2049	ExpirationTime *date.Time `json:"expirationTime,omitempty"`
2050	// Reason - Recommendation action reason.
2051	Reason *string `json:"reason,omitempty"`
2052	// RecommendationType - Recommendation action type.
2053	RecommendationType *string `json:"recommendationType,omitempty"`
2054	// Details - Recommendation action details.
2055	Details map[string]*string `json:"details"`
2056}
2057
2058// MarshalJSON is the custom marshaler for RecommendationActionProperties.
2059func (rap RecommendationActionProperties) MarshalJSON() ([]byte, error) {
2060	objectMap := make(map[string]interface{})
2061	if rap.AdvisorName != nil {
2062		objectMap["advisorName"] = rap.AdvisorName
2063	}
2064	if rap.SessionID != nil {
2065		objectMap["sessionId"] = rap.SessionID
2066	}
2067	if rap.ActionID != nil {
2068		objectMap["actionId"] = rap.ActionID
2069	}
2070	if rap.CreatedTime != nil {
2071		objectMap["createdTime"] = rap.CreatedTime
2072	}
2073	if rap.ExpirationTime != nil {
2074		objectMap["expirationTime"] = rap.ExpirationTime
2075	}
2076	if rap.Reason != nil {
2077		objectMap["reason"] = rap.Reason
2078	}
2079	if rap.RecommendationType != nil {
2080		objectMap["recommendationType"] = rap.RecommendationType
2081	}
2082	if rap.Details != nil {
2083		objectMap["details"] = rap.Details
2084	}
2085	return json.Marshal(objectMap)
2086}
2087
2088// RecommendationActionsResultList a list of recommendation actions.
2089type RecommendationActionsResultList struct {
2090	autorest.Response `json:"-"`
2091	// Value - READ-ONLY; The list of recommendation action advisors.
2092	Value *[]RecommendationAction `json:"value,omitempty"`
2093	// NextLink - READ-ONLY; Link to retrieve next page of results.
2094	NextLink *string `json:"nextLink,omitempty"`
2095}
2096
2097// MarshalJSON is the custom marshaler for RecommendationActionsResultList.
2098func (rarl RecommendationActionsResultList) MarshalJSON() ([]byte, error) {
2099	objectMap := make(map[string]interface{})
2100	return json.Marshal(objectMap)
2101}
2102
2103// RecommendationActionsResultListIterator provides access to a complete listing of RecommendationAction
2104// values.
2105type RecommendationActionsResultListIterator struct {
2106	i    int
2107	page RecommendationActionsResultListPage
2108}
2109
2110// NextWithContext advances to the next value.  If there was an error making
2111// the request the iterator does not advance and the error is returned.
2112func (iter *RecommendationActionsResultListIterator) NextWithContext(ctx context.Context) (err error) {
2113	if tracing.IsEnabled() {
2114		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListIterator.NextWithContext")
2115		defer func() {
2116			sc := -1
2117			if iter.Response().Response.Response != nil {
2118				sc = iter.Response().Response.Response.StatusCode
2119			}
2120			tracing.EndSpan(ctx, sc, err)
2121		}()
2122	}
2123	iter.i++
2124	if iter.i < len(iter.page.Values()) {
2125		return nil
2126	}
2127	err = iter.page.NextWithContext(ctx)
2128	if err != nil {
2129		iter.i--
2130		return err
2131	}
2132	iter.i = 0
2133	return nil
2134}
2135
2136// Next advances to the next value.  If there was an error making
2137// the request the iterator does not advance and the error is returned.
2138// Deprecated: Use NextWithContext() instead.
2139func (iter *RecommendationActionsResultListIterator) Next() error {
2140	return iter.NextWithContext(context.Background())
2141}
2142
2143// NotDone returns true if the enumeration should be started or is not yet complete.
2144func (iter RecommendationActionsResultListIterator) NotDone() bool {
2145	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2146}
2147
2148// Response returns the raw server response from the last page request.
2149func (iter RecommendationActionsResultListIterator) Response() RecommendationActionsResultList {
2150	return iter.page.Response()
2151}
2152
2153// Value returns the current value or a zero-initialized value if the
2154// iterator has advanced beyond the end of the collection.
2155func (iter RecommendationActionsResultListIterator) Value() RecommendationAction {
2156	if !iter.page.NotDone() {
2157		return RecommendationAction{}
2158	}
2159	return iter.page.Values()[iter.i]
2160}
2161
2162// Creates a new instance of the RecommendationActionsResultListIterator type.
2163func NewRecommendationActionsResultListIterator(page RecommendationActionsResultListPage) RecommendationActionsResultListIterator {
2164	return RecommendationActionsResultListIterator{page: page}
2165}
2166
2167// IsEmpty returns true if the ListResult contains no values.
2168func (rarl RecommendationActionsResultList) IsEmpty() bool {
2169	return rarl.Value == nil || len(*rarl.Value) == 0
2170}
2171
2172// hasNextLink returns true if the NextLink is not empty.
2173func (rarl RecommendationActionsResultList) hasNextLink() bool {
2174	return rarl.NextLink != nil && len(*rarl.NextLink) != 0
2175}
2176
2177// recommendationActionsResultListPreparer prepares a request to retrieve the next set of results.
2178// It returns nil if no more results exist.
2179func (rarl RecommendationActionsResultList) recommendationActionsResultListPreparer(ctx context.Context) (*http.Request, error) {
2180	if !rarl.hasNextLink() {
2181		return nil, nil
2182	}
2183	return autorest.Prepare((&http.Request{}).WithContext(ctx),
2184		autorest.AsJSON(),
2185		autorest.AsGet(),
2186		autorest.WithBaseURL(to.String(rarl.NextLink)))
2187}
2188
2189// RecommendationActionsResultListPage contains a page of RecommendationAction values.
2190type RecommendationActionsResultListPage struct {
2191	fn   func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error)
2192	rarl RecommendationActionsResultList
2193}
2194
2195// NextWithContext advances to the next page of values.  If there was an error making
2196// the request the page does not advance and the error is returned.
2197func (page *RecommendationActionsResultListPage) NextWithContext(ctx context.Context) (err error) {
2198	if tracing.IsEnabled() {
2199		ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListPage.NextWithContext")
2200		defer func() {
2201			sc := -1
2202			if page.Response().Response.Response != nil {
2203				sc = page.Response().Response.Response.StatusCode
2204			}
2205			tracing.EndSpan(ctx, sc, err)
2206		}()
2207	}
2208	for {
2209		next, err := page.fn(ctx, page.rarl)
2210		if err != nil {
2211			return err
2212		}
2213		page.rarl = next
2214		if !next.hasNextLink() || !next.IsEmpty() {
2215			break
2216		}
2217	}
2218	return nil
2219}
2220
2221// Next advances to the next page of values.  If there was an error making
2222// the request the page does not advance and the error is returned.
2223// Deprecated: Use NextWithContext() instead.
2224func (page *RecommendationActionsResultListPage) Next() error {
2225	return page.NextWithContext(context.Background())
2226}
2227
2228// NotDone returns true if the page enumeration should be started or is not yet complete.
2229func (page RecommendationActionsResultListPage) NotDone() bool {
2230	return !page.rarl.IsEmpty()
2231}
2232
2233// Response returns the raw server response from the last page request.
2234func (page RecommendationActionsResultListPage) Response() RecommendationActionsResultList {
2235	return page.rarl
2236}
2237
2238// Values returns the slice of values for the current page or nil if there are no values.
2239func (page RecommendationActionsResultListPage) Values() []RecommendationAction {
2240	if page.rarl.IsEmpty() {
2241		return nil
2242	}
2243	return *page.rarl.Value
2244}
2245
2246// Creates a new instance of the RecommendationActionsResultListPage type.
2247func NewRecommendationActionsResultListPage(cur RecommendationActionsResultList, getNextPage func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error)) RecommendationActionsResultListPage {
2248	return RecommendationActionsResultListPage{
2249		fn:   getNextPage,
2250		rarl: cur,
2251	}
2252}
2253
2254// RecommendedActionSessionsOperationStatus recommendation action session operation status.
2255type RecommendedActionSessionsOperationStatus struct {
2256	autorest.Response `json:"-"`
2257	// Name - Operation identifier.
2258	Name *string `json:"name,omitempty"`
2259	// StartTime - Operation start time.
2260	StartTime *date.Time `json:"startTime,omitempty"`
2261	// Status - Operation status.
2262	Status *string `json:"status,omitempty"`
2263}
2264
2265// Resource common fields that are returned in the response for all Azure Resource Manager resources
2266type Resource struct {
2267	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
2268	ID *string `json:"id,omitempty"`
2269	// Name - READ-ONLY; The name of the resource
2270	Name *string `json:"name,omitempty"`
2271	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
2272	Type *string `json:"type,omitempty"`
2273}
2274
2275// MarshalJSON is the custom marshaler for Resource.
2276func (r Resource) MarshalJSON() ([]byte, error) {
2277	objectMap := make(map[string]interface{})
2278	return json.Marshal(objectMap)
2279}
2280
2281// SecurityAlertPolicyProperties properties of a security alert policy.
2282type SecurityAlertPolicyProperties struct {
2283	// State - Specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'ServerSecurityAlertPolicyStateEnabled', 'ServerSecurityAlertPolicyStateDisabled'
2284	State ServerSecurityAlertPolicyState `json:"state,omitempty"`
2285	// DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly
2286	DisabledAlerts *[]string `json:"disabledAlerts,omitempty"`
2287	// EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent.
2288	EmailAddresses *[]string `json:"emailAddresses,omitempty"`
2289	// EmailAccountAdmins - Specifies that the alert is sent to the account administrators.
2290	EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"`
2291	// StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
2292	StorageEndpoint *string `json:"storageEndpoint,omitempty"`
2293	// StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account.
2294	StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"`
2295	// RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs.
2296	RetentionDays *int32 `json:"retentionDays,omitempty"`
2297}
2298
2299// Server represents a server.
2300type Server struct {
2301	autorest.Response `json:"-"`
2302	// Sku - The SKU (pricing tier) of the server.
2303	Sku *Sku `json:"sku,omitempty"`
2304	// ServerProperties - Properties of the server.
2305	*ServerProperties `json:"properties,omitempty"`
2306	// Tags - Resource tags.
2307	Tags map[string]*string `json:"tags"`
2308	// Location - The geo-location where the resource lives
2309	Location *string `json:"location,omitempty"`
2310	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
2311	ID *string `json:"id,omitempty"`
2312	// Name - READ-ONLY; The name of the resource
2313	Name *string `json:"name,omitempty"`
2314	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
2315	Type *string `json:"type,omitempty"`
2316}
2317
2318// MarshalJSON is the custom marshaler for Server.
2319func (s Server) MarshalJSON() ([]byte, error) {
2320	objectMap := make(map[string]interface{})
2321	if s.Sku != nil {
2322		objectMap["sku"] = s.Sku
2323	}
2324	if s.ServerProperties != nil {
2325		objectMap["properties"] = s.ServerProperties
2326	}
2327	if s.Tags != nil {
2328		objectMap["tags"] = s.Tags
2329	}
2330	if s.Location != nil {
2331		objectMap["location"] = s.Location
2332	}
2333	return json.Marshal(objectMap)
2334}
2335
2336// UnmarshalJSON is the custom unmarshaler for Server struct.
2337func (s *Server) UnmarshalJSON(body []byte) error {
2338	var m map[string]*json.RawMessage
2339	err := json.Unmarshal(body, &m)
2340	if err != nil {
2341		return err
2342	}
2343	for k, v := range m {
2344		switch k {
2345		case "sku":
2346			if v != nil {
2347				var sku Sku
2348				err = json.Unmarshal(*v, &sku)
2349				if err != nil {
2350					return err
2351				}
2352				s.Sku = &sku
2353			}
2354		case "properties":
2355			if v != nil {
2356				var serverProperties ServerProperties
2357				err = json.Unmarshal(*v, &serverProperties)
2358				if err != nil {
2359					return err
2360				}
2361				s.ServerProperties = &serverProperties
2362			}
2363		case "tags":
2364			if v != nil {
2365				var tags map[string]*string
2366				err = json.Unmarshal(*v, &tags)
2367				if err != nil {
2368					return err
2369				}
2370				s.Tags = tags
2371			}
2372		case "location":
2373			if v != nil {
2374				var location string
2375				err = json.Unmarshal(*v, &location)
2376				if err != nil {
2377					return err
2378				}
2379				s.Location = &location
2380			}
2381		case "id":
2382			if v != nil {
2383				var ID string
2384				err = json.Unmarshal(*v, &ID)
2385				if err != nil {
2386					return err
2387				}
2388				s.ID = &ID
2389			}
2390		case "name":
2391			if v != nil {
2392				var name string
2393				err = json.Unmarshal(*v, &name)
2394				if err != nil {
2395					return err
2396				}
2397				s.Name = &name
2398			}
2399		case "type":
2400			if v != nil {
2401				var typeVar string
2402				err = json.Unmarshal(*v, &typeVar)
2403				if err != nil {
2404					return err
2405				}
2406				s.Type = &typeVar
2407			}
2408		}
2409	}
2410
2411	return nil
2412}
2413
2414// ServerForCreate represents a server to be created.
2415type ServerForCreate struct {
2416	// Sku - The SKU (pricing tier) of the server.
2417	Sku *Sku `json:"sku,omitempty"`
2418	// Properties - Properties of the server.
2419	Properties BasicServerPropertiesForCreate `json:"properties,omitempty"`
2420	// Location - The location the resource resides in.
2421	Location *string `json:"location,omitempty"`
2422	// Tags - Application-specific metadata in the form of key-value pairs.
2423	Tags map[string]*string `json:"tags"`
2424}
2425
2426// MarshalJSON is the custom marshaler for ServerForCreate.
2427func (sfc ServerForCreate) MarshalJSON() ([]byte, error) {
2428	objectMap := make(map[string]interface{})
2429	if sfc.Sku != nil {
2430		objectMap["sku"] = sfc.Sku
2431	}
2432	objectMap["properties"] = sfc.Properties
2433	if sfc.Location != nil {
2434		objectMap["location"] = sfc.Location
2435	}
2436	if sfc.Tags != nil {
2437		objectMap["tags"] = sfc.Tags
2438	}
2439	return json.Marshal(objectMap)
2440}
2441
2442// UnmarshalJSON is the custom unmarshaler for ServerForCreate struct.
2443func (sfc *ServerForCreate) UnmarshalJSON(body []byte) error {
2444	var m map[string]*json.RawMessage
2445	err := json.Unmarshal(body, &m)
2446	if err != nil {
2447		return err
2448	}
2449	for k, v := range m {
2450		switch k {
2451		case "sku":
2452			if v != nil {
2453				var sku Sku
2454				err = json.Unmarshal(*v, &sku)
2455				if err != nil {
2456					return err
2457				}
2458				sfc.Sku = &sku
2459			}
2460		case "properties":
2461			if v != nil {
2462				properties, err := unmarshalBasicServerPropertiesForCreate(*v)
2463				if err != nil {
2464					return err
2465				}
2466				sfc.Properties = properties
2467			}
2468		case "location":
2469			if v != nil {
2470				var location string
2471				err = json.Unmarshal(*v, &location)
2472				if err != nil {
2473					return err
2474				}
2475				sfc.Location = &location
2476			}
2477		case "tags":
2478			if v != nil {
2479				var tags map[string]*string
2480				err = json.Unmarshal(*v, &tags)
2481				if err != nil {
2482					return err
2483				}
2484				sfc.Tags = tags
2485			}
2486		}
2487	}
2488
2489	return nil
2490}
2491
2492// ServerListResult a list of servers.
2493type ServerListResult struct {
2494	autorest.Response `json:"-"`
2495	// Value - The list of servers
2496	Value *[]Server `json:"value,omitempty"`
2497}
2498
2499// ServerPrivateEndpointConnection a private endpoint connection under a server
2500type ServerPrivateEndpointConnection struct {
2501	// ID - READ-ONLY; Resource Id of the private endpoint connection.
2502	ID *string `json:"id,omitempty"`
2503	// Properties - READ-ONLY; Private endpoint connection properties
2504	Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"`
2505}
2506
2507// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnection.
2508func (spec ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) {
2509	objectMap := make(map[string]interface{})
2510	return json.Marshal(objectMap)
2511}
2512
2513// ServerPrivateEndpointConnectionProperties properties of a private endpoint connection.
2514type ServerPrivateEndpointConnectionProperties struct {
2515	// PrivateEndpoint - Private endpoint which the connection belongs to.
2516	PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"`
2517	// PrivateLinkServiceConnectionState - Connection state of the private endpoint connection.
2518	PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"`
2519	// ProvisioningState - READ-ONLY; State of the private endpoint connection. Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', 'Rejecting'
2520	ProvisioningState PrivateEndpointProvisioningState `json:"provisioningState,omitempty"`
2521}
2522
2523// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnectionProperties.
2524func (specp ServerPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) {
2525	objectMap := make(map[string]interface{})
2526	if specp.PrivateEndpoint != nil {
2527		objectMap["privateEndpoint"] = specp.PrivateEndpoint
2528	}
2529	if specp.PrivateLinkServiceConnectionState != nil {
2530		objectMap["privateLinkServiceConnectionState"] = specp.PrivateLinkServiceConnectionState
2531	}
2532	return json.Marshal(objectMap)
2533}
2534
2535// ServerPrivateLinkServiceConnectionStateProperty ...
2536type ServerPrivateLinkServiceConnectionStateProperty struct {
2537	// Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected'
2538	Status PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"`
2539	// Description - The private link service connection description.
2540	Description *string `json:"description,omitempty"`
2541	// ActionsRequired - READ-ONLY; The actions required for private link service connection. Possible values include: 'None'
2542	ActionsRequired PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"`
2543}
2544
2545// MarshalJSON is the custom marshaler for ServerPrivateLinkServiceConnectionStateProperty.
2546func (splscsp ServerPrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) {
2547	objectMap := make(map[string]interface{})
2548	if splscsp.Status != "" {
2549		objectMap["status"] = splscsp.Status
2550	}
2551	if splscsp.Description != nil {
2552		objectMap["description"] = splscsp.Description
2553	}
2554	return json.Marshal(objectMap)
2555}
2556
2557// ServerProperties the properties of a server.
2558type ServerProperties struct {
2559	// AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
2560	AdministratorLogin *string `json:"administratorLogin,omitempty"`
2561	// Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven'
2562	Version ServerVersion `json:"version,omitempty"`
2563	// SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled'
2564	SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2565	// UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled'
2566	UserVisibleState ServerState `json:"userVisibleState,omitempty"`
2567	// FullyQualifiedDomainName - The fully qualified domain name of a server.
2568	FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
2569	// EarliestRestoreDate - Earliest restore point creation time (ISO8601 format)
2570	EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"`
2571	// StorageProfile - Storage profile of a server.
2572	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2573	// ReplicationRole - The replication role of the server.
2574	ReplicationRole *string `json:"replicationRole,omitempty"`
2575	// MasterServerID - The master server id of a replica server.
2576	MasterServerID *string `json:"masterServerId,omitempty"`
2577	// ReplicaCapacity - The maximum number of replicas that a master server can have.
2578	ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"`
2579	// PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled'
2580	PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2581	// PrivateEndpointConnections - READ-ONLY; List of private endpoint connections on a server
2582	PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"`
2583}
2584
2585// MarshalJSON is the custom marshaler for ServerProperties.
2586func (sp ServerProperties) MarshalJSON() ([]byte, error) {
2587	objectMap := make(map[string]interface{})
2588	if sp.AdministratorLogin != nil {
2589		objectMap["administratorLogin"] = sp.AdministratorLogin
2590	}
2591	if sp.Version != "" {
2592		objectMap["version"] = sp.Version
2593	}
2594	if sp.SslEnforcement != "" {
2595		objectMap["sslEnforcement"] = sp.SslEnforcement
2596	}
2597	if sp.UserVisibleState != "" {
2598		objectMap["userVisibleState"] = sp.UserVisibleState
2599	}
2600	if sp.FullyQualifiedDomainName != nil {
2601		objectMap["fullyQualifiedDomainName"] = sp.FullyQualifiedDomainName
2602	}
2603	if sp.EarliestRestoreDate != nil {
2604		objectMap["earliestRestoreDate"] = sp.EarliestRestoreDate
2605	}
2606	if sp.StorageProfile != nil {
2607		objectMap["storageProfile"] = sp.StorageProfile
2608	}
2609	if sp.ReplicationRole != nil {
2610		objectMap["replicationRole"] = sp.ReplicationRole
2611	}
2612	if sp.MasterServerID != nil {
2613		objectMap["masterServerId"] = sp.MasterServerID
2614	}
2615	if sp.ReplicaCapacity != nil {
2616		objectMap["replicaCapacity"] = sp.ReplicaCapacity
2617	}
2618	if sp.PublicNetworkAccess != "" {
2619		objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess
2620	}
2621	return json.Marshal(objectMap)
2622}
2623
2624// BasicServerPropertiesForCreate the properties used to create a new server.
2625type BasicServerPropertiesForCreate interface {
2626	AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool)
2627	AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool)
2628	AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool)
2629	AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool)
2630	AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool)
2631}
2632
2633// ServerPropertiesForCreate the properties used to create a new server.
2634type ServerPropertiesForCreate struct {
2635	// Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven'
2636	Version ServerVersion `json:"version,omitempty"`
2637	// SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled'
2638	SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2639	// PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled'
2640	PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2641	// StorageProfile - Storage profile of a server.
2642	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2643	// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
2644	CreateMode CreateMode `json:"createMode,omitempty"`
2645}
2646
2647func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerPropertiesForCreate, error) {
2648	var m map[string]interface{}
2649	err := json.Unmarshal(body, &m)
2650	if err != nil {
2651		return nil, err
2652	}
2653
2654	switch m["createMode"] {
2655	case string(CreateModeDefault):
2656		var spfdc ServerPropertiesForDefaultCreate
2657		err := json.Unmarshal(body, &spfdc)
2658		return spfdc, err
2659	case string(CreateModePointInTimeRestore):
2660		var spfr ServerPropertiesForRestore
2661		err := json.Unmarshal(body, &spfr)
2662		return spfr, err
2663	case string(CreateModeGeoRestore):
2664		var spfgr ServerPropertiesForGeoRestore
2665		err := json.Unmarshal(body, &spfgr)
2666		return spfgr, err
2667	case string(CreateModeReplica):
2668		var spfr ServerPropertiesForReplica
2669		err := json.Unmarshal(body, &spfr)
2670		return spfr, err
2671	default:
2672		var spfc ServerPropertiesForCreate
2673		err := json.Unmarshal(body, &spfc)
2674		return spfc, err
2675	}
2676}
2677func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPropertiesForCreate, error) {
2678	var rawMessages []*json.RawMessage
2679	err := json.Unmarshal(body, &rawMessages)
2680	if err != nil {
2681		return nil, err
2682	}
2683
2684	spfcArray := make([]BasicServerPropertiesForCreate, len(rawMessages))
2685
2686	for index, rawMessage := range rawMessages {
2687		spfc, err := unmarshalBasicServerPropertiesForCreate(*rawMessage)
2688		if err != nil {
2689			return nil, err
2690		}
2691		spfcArray[index] = spfc
2692	}
2693	return spfcArray, nil
2694}
2695
2696// MarshalJSON is the custom marshaler for ServerPropertiesForCreate.
2697func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) {
2698	spfc.CreateMode = CreateModeServerPropertiesForCreate
2699	objectMap := make(map[string]interface{})
2700	if spfc.Version != "" {
2701		objectMap["version"] = spfc.Version
2702	}
2703	if spfc.SslEnforcement != "" {
2704		objectMap["sslEnforcement"] = spfc.SslEnforcement
2705	}
2706	if spfc.PublicNetworkAccess != "" {
2707		objectMap["publicNetworkAccess"] = spfc.PublicNetworkAccess
2708	}
2709	if spfc.StorageProfile != nil {
2710		objectMap["storageProfile"] = spfc.StorageProfile
2711	}
2712	if spfc.CreateMode != "" {
2713		objectMap["createMode"] = spfc.CreateMode
2714	}
2715	return json.Marshal(objectMap)
2716}
2717
2718// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
2719func (spfc ServerPropertiesForCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
2720	return nil, false
2721}
2722
2723// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
2724func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
2725	return nil, false
2726}
2727
2728// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
2729func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
2730	return nil, false
2731}
2732
2733// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
2734func (spfc ServerPropertiesForCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
2735	return nil, false
2736}
2737
2738// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
2739func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
2740	return &spfc, true
2741}
2742
2743// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate.
2744func (spfc ServerPropertiesForCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
2745	return &spfc, true
2746}
2747
2748// ServerPropertiesForDefaultCreate the properties used to create a new server.
2749type ServerPropertiesForDefaultCreate struct {
2750	// AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation).
2751	AdministratorLogin *string `json:"administratorLogin,omitempty"`
2752	// AdministratorLoginPassword - The password of the administrator login.
2753	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
2754	// Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven'
2755	Version ServerVersion `json:"version,omitempty"`
2756	// SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled'
2757	SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2758	// PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled'
2759	PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2760	// StorageProfile - Storage profile of a server.
2761	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2762	// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
2763	CreateMode CreateMode `json:"createMode,omitempty"`
2764}
2765
2766// MarshalJSON is the custom marshaler for ServerPropertiesForDefaultCreate.
2767func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) {
2768	spfdc.CreateMode = CreateModeDefault
2769	objectMap := make(map[string]interface{})
2770	if spfdc.AdministratorLogin != nil {
2771		objectMap["administratorLogin"] = spfdc.AdministratorLogin
2772	}
2773	if spfdc.AdministratorLoginPassword != nil {
2774		objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword
2775	}
2776	if spfdc.Version != "" {
2777		objectMap["version"] = spfdc.Version
2778	}
2779	if spfdc.SslEnforcement != "" {
2780		objectMap["sslEnforcement"] = spfdc.SslEnforcement
2781	}
2782	if spfdc.PublicNetworkAccess != "" {
2783		objectMap["publicNetworkAccess"] = spfdc.PublicNetworkAccess
2784	}
2785	if spfdc.StorageProfile != nil {
2786		objectMap["storageProfile"] = spfdc.StorageProfile
2787	}
2788	if spfdc.CreateMode != "" {
2789		objectMap["createMode"] = spfdc.CreateMode
2790	}
2791	return json.Marshal(objectMap)
2792}
2793
2794// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
2795func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
2796	return &spfdc, true
2797}
2798
2799// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
2800func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
2801	return nil, false
2802}
2803
2804// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
2805func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
2806	return nil, false
2807}
2808
2809// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
2810func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
2811	return nil, false
2812}
2813
2814// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
2815func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
2816	return nil, false
2817}
2818
2819// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate.
2820func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
2821	return &spfdc, true
2822}
2823
2824// ServerPropertiesForGeoRestore the properties used to create a new server by restoring to a different
2825// region from a geo replicated backup.
2826type ServerPropertiesForGeoRestore struct {
2827	// SourceServerID - The source server id to restore from.
2828	SourceServerID *string `json:"sourceServerId,omitempty"`
2829	// Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven'
2830	Version ServerVersion `json:"version,omitempty"`
2831	// SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled'
2832	SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2833	// PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled'
2834	PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2835	// StorageProfile - Storage profile of a server.
2836	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2837	// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
2838	CreateMode CreateMode `json:"createMode,omitempty"`
2839}
2840
2841// MarshalJSON is the custom marshaler for ServerPropertiesForGeoRestore.
2842func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) {
2843	spfgr.CreateMode = CreateModeGeoRestore
2844	objectMap := make(map[string]interface{})
2845	if spfgr.SourceServerID != nil {
2846		objectMap["sourceServerId"] = spfgr.SourceServerID
2847	}
2848	if spfgr.Version != "" {
2849		objectMap["version"] = spfgr.Version
2850	}
2851	if spfgr.SslEnforcement != "" {
2852		objectMap["sslEnforcement"] = spfgr.SslEnforcement
2853	}
2854	if spfgr.PublicNetworkAccess != "" {
2855		objectMap["publicNetworkAccess"] = spfgr.PublicNetworkAccess
2856	}
2857	if spfgr.StorageProfile != nil {
2858		objectMap["storageProfile"] = spfgr.StorageProfile
2859	}
2860	if spfgr.CreateMode != "" {
2861		objectMap["createMode"] = spfgr.CreateMode
2862	}
2863	return json.Marshal(objectMap)
2864}
2865
2866// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
2867func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
2868	return nil, false
2869}
2870
2871// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
2872func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
2873	return nil, false
2874}
2875
2876// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
2877func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
2878	return &spfgr, true
2879}
2880
2881// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
2882func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
2883	return nil, false
2884}
2885
2886// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
2887func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
2888	return nil, false
2889}
2890
2891// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore.
2892func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
2893	return &spfgr, true
2894}
2895
2896// ServerPropertiesForReplica the properties to create a new replica.
2897type ServerPropertiesForReplica struct {
2898	// SourceServerID - The master server id to create replica from.
2899	SourceServerID *string `json:"sourceServerId,omitempty"`
2900	// Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven'
2901	Version ServerVersion `json:"version,omitempty"`
2902	// SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled'
2903	SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2904	// PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled'
2905	PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2906	// StorageProfile - Storage profile of a server.
2907	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2908	// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
2909	CreateMode CreateMode `json:"createMode,omitempty"`
2910}
2911
2912// MarshalJSON is the custom marshaler for ServerPropertiesForReplica.
2913func (spfr ServerPropertiesForReplica) MarshalJSON() ([]byte, error) {
2914	spfr.CreateMode = CreateModeReplica
2915	objectMap := make(map[string]interface{})
2916	if spfr.SourceServerID != nil {
2917		objectMap["sourceServerId"] = spfr.SourceServerID
2918	}
2919	if spfr.Version != "" {
2920		objectMap["version"] = spfr.Version
2921	}
2922	if spfr.SslEnforcement != "" {
2923		objectMap["sslEnforcement"] = spfr.SslEnforcement
2924	}
2925	if spfr.PublicNetworkAccess != "" {
2926		objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess
2927	}
2928	if spfr.StorageProfile != nil {
2929		objectMap["storageProfile"] = spfr.StorageProfile
2930	}
2931	if spfr.CreateMode != "" {
2932		objectMap["createMode"] = spfr.CreateMode
2933	}
2934	return json.Marshal(objectMap)
2935}
2936
2937// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
2938func (spfr ServerPropertiesForReplica) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
2939	return nil, false
2940}
2941
2942// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
2943func (spfr ServerPropertiesForReplica) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
2944	return nil, false
2945}
2946
2947// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
2948func (spfr ServerPropertiesForReplica) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
2949	return nil, false
2950}
2951
2952// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
2953func (spfr ServerPropertiesForReplica) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
2954	return &spfr, true
2955}
2956
2957// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
2958func (spfr ServerPropertiesForReplica) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
2959	return nil, false
2960}
2961
2962// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica.
2963func (spfr ServerPropertiesForReplica) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
2964	return &spfr, true
2965}
2966
2967// ServerPropertiesForRestore the properties used to create a new server by restoring from a backup.
2968type ServerPropertiesForRestore struct {
2969	// SourceServerID - The source server id to restore from.
2970	SourceServerID *string `json:"sourceServerId,omitempty"`
2971	// RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from.
2972	RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"`
2973	// Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven'
2974	Version ServerVersion `json:"version,omitempty"`
2975	// SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled'
2976	SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
2977	// PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled'
2978	PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
2979	// StorageProfile - Storage profile of a server.
2980	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
2981	// CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica'
2982	CreateMode CreateMode `json:"createMode,omitempty"`
2983}
2984
2985// MarshalJSON is the custom marshaler for ServerPropertiesForRestore.
2986func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) {
2987	spfr.CreateMode = CreateModePointInTimeRestore
2988	objectMap := make(map[string]interface{})
2989	if spfr.SourceServerID != nil {
2990		objectMap["sourceServerId"] = spfr.SourceServerID
2991	}
2992	if spfr.RestorePointInTime != nil {
2993		objectMap["restorePointInTime"] = spfr.RestorePointInTime
2994	}
2995	if spfr.Version != "" {
2996		objectMap["version"] = spfr.Version
2997	}
2998	if spfr.SslEnforcement != "" {
2999		objectMap["sslEnforcement"] = spfr.SslEnforcement
3000	}
3001	if spfr.PublicNetworkAccess != "" {
3002		objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess
3003	}
3004	if spfr.StorageProfile != nil {
3005		objectMap["storageProfile"] = spfr.StorageProfile
3006	}
3007	if spfr.CreateMode != "" {
3008		objectMap["createMode"] = spfr.CreateMode
3009	}
3010	return json.Marshal(objectMap)
3011}
3012
3013// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
3014func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) {
3015	return nil, false
3016}
3017
3018// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
3019func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) {
3020	return &spfr, true
3021}
3022
3023// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
3024func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) {
3025	return nil, false
3026}
3027
3028// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
3029func (spfr ServerPropertiesForRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) {
3030	return nil, false
3031}
3032
3033// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
3034func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) {
3035	return nil, false
3036}
3037
3038// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore.
3039func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) {
3040	return &spfr, true
3041}
3042
3043// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running
3044// operation.
3045type ServersCreateFuture struct {
3046	azure.FutureAPI
3047	// Result returns the result of the asynchronous operation.
3048	// If the operation has not completed it will return an error.
3049	Result func(ServersClient) (Server, error)
3050}
3051
3052// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3053func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error {
3054	var azFuture azure.Future
3055	if err := json.Unmarshal(body, &azFuture); err != nil {
3056		return err
3057	}
3058	future.FutureAPI = &azFuture
3059	future.Result = future.result
3060	return nil
3061}
3062
3063// result is the default implementation for ServersCreateFuture.Result.
3064func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) {
3065	var done bool
3066	done, err = future.DoneWithContext(context.Background(), client)
3067	if err != nil {
3068		err = autorest.NewErrorWithError(err, "mariadb.ServersCreateFuture", "Result", future.Response(), "Polling failure")
3069		return
3070	}
3071	if !done {
3072		s.Response.Response = future.Response()
3073		err = azure.NewAsyncOpIncompleteError("mariadb.ServersCreateFuture")
3074		return
3075	}
3076	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3077	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
3078		s, err = client.CreateResponder(s.Response.Response)
3079		if err != nil {
3080			err = autorest.NewErrorWithError(err, "mariadb.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request")
3081		}
3082	}
3083	return
3084}
3085
3086// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
3087// operation.
3088type ServersDeleteFuture struct {
3089	azure.FutureAPI
3090	// Result returns the result of the asynchronous operation.
3091	// If the operation has not completed it will return an error.
3092	Result func(ServersClient) (autorest.Response, error)
3093}
3094
3095// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3096func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error {
3097	var azFuture azure.Future
3098	if err := json.Unmarshal(body, &azFuture); err != nil {
3099		return err
3100	}
3101	future.FutureAPI = &azFuture
3102	future.Result = future.result
3103	return nil
3104}
3105
3106// result is the default implementation for ServersDeleteFuture.Result.
3107func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) {
3108	var done bool
3109	done, err = future.DoneWithContext(context.Background(), client)
3110	if err != nil {
3111		err = autorest.NewErrorWithError(err, "mariadb.ServersDeleteFuture", "Result", future.Response(), "Polling failure")
3112		return
3113	}
3114	if !done {
3115		ar.Response = future.Response()
3116		err = azure.NewAsyncOpIncompleteError("mariadb.ServersDeleteFuture")
3117		return
3118	}
3119	ar.Response = future.Response()
3120	return
3121}
3122
3123// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results
3124// of a long-running operation.
3125type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct {
3126	azure.FutureAPI
3127	// Result returns the result of the asynchronous operation.
3128	// If the operation has not completed it will return an error.
3129	Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error)
3130}
3131
3132// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3133func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
3134	var azFuture azure.Future
3135	if err := json.Unmarshal(body, &azFuture); err != nil {
3136		return err
3137	}
3138	future.FutureAPI = &azFuture
3139	future.Result = future.result
3140	return nil
3141}
3142
3143// result is the default implementation for ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result.
3144func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) {
3145	var done bool
3146	done, err = future.DoneWithContext(context.Background(), client)
3147	if err != nil {
3148		err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
3149		return
3150	}
3151	if !done {
3152		ssap.Response.Response = future.Response()
3153		err = azure.NewAsyncOpIncompleteError("mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture")
3154		return
3155	}
3156	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3157	if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent {
3158		ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response)
3159		if err != nil {
3160			err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request")
3161		}
3162	}
3163	return
3164}
3165
3166// ServerSecurityAlertPolicy a server security alert policy.
3167type ServerSecurityAlertPolicy struct {
3168	autorest.Response `json:"-"`
3169	// SecurityAlertPolicyProperties - Resource properties.
3170	*SecurityAlertPolicyProperties `json:"properties,omitempty"`
3171	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
3172	ID *string `json:"id,omitempty"`
3173	// Name - READ-ONLY; The name of the resource
3174	Name *string `json:"name,omitempty"`
3175	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
3176	Type *string `json:"type,omitempty"`
3177}
3178
3179// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy.
3180func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) {
3181	objectMap := make(map[string]interface{})
3182	if ssap.SecurityAlertPolicyProperties != nil {
3183		objectMap["properties"] = ssap.SecurityAlertPolicyProperties
3184	}
3185	return json.Marshal(objectMap)
3186}
3187
3188// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct.
3189func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error {
3190	var m map[string]*json.RawMessage
3191	err := json.Unmarshal(body, &m)
3192	if err != nil {
3193		return err
3194	}
3195	for k, v := range m {
3196		switch k {
3197		case "properties":
3198			if v != nil {
3199				var securityAlertPolicyProperties SecurityAlertPolicyProperties
3200				err = json.Unmarshal(*v, &securityAlertPolicyProperties)
3201				if err != nil {
3202					return err
3203				}
3204				ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties
3205			}
3206		case "id":
3207			if v != nil {
3208				var ID string
3209				err = json.Unmarshal(*v, &ID)
3210				if err != nil {
3211					return err
3212				}
3213				ssap.ID = &ID
3214			}
3215		case "name":
3216			if v != nil {
3217				var name string
3218				err = json.Unmarshal(*v, &name)
3219				if err != nil {
3220					return err
3221				}
3222				ssap.Name = &name
3223			}
3224		case "type":
3225			if v != nil {
3226				var typeVar string
3227				err = json.Unmarshal(*v, &typeVar)
3228				if err != nil {
3229					return err
3230				}
3231				ssap.Type = &typeVar
3232			}
3233		}
3234	}
3235
3236	return nil
3237}
3238
3239// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running
3240// operation.
3241type ServersRestartFuture struct {
3242	azure.FutureAPI
3243	// Result returns the result of the asynchronous operation.
3244	// If the operation has not completed it will return an error.
3245	Result func(ServersClient) (autorest.Response, error)
3246}
3247
3248// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3249func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error {
3250	var azFuture azure.Future
3251	if err := json.Unmarshal(body, &azFuture); err != nil {
3252		return err
3253	}
3254	future.FutureAPI = &azFuture
3255	future.Result = future.result
3256	return nil
3257}
3258
3259// result is the default implementation for ServersRestartFuture.Result.
3260func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {
3261	var done bool
3262	done, err = future.DoneWithContext(context.Background(), client)
3263	if err != nil {
3264		err = autorest.NewErrorWithError(err, "mariadb.ServersRestartFuture", "Result", future.Response(), "Polling failure")
3265		return
3266	}
3267	if !done {
3268		ar.Response = future.Response()
3269		err = azure.NewAsyncOpIncompleteError("mariadb.ServersRestartFuture")
3270		return
3271	}
3272	ar.Response = future.Response()
3273	return
3274}
3275
3276// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
3277// operation.
3278type ServersUpdateFuture struct {
3279	azure.FutureAPI
3280	// Result returns the result of the asynchronous operation.
3281	// If the operation has not completed it will return an error.
3282	Result func(ServersClient) (Server, error)
3283}
3284
3285// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3286func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error {
3287	var azFuture azure.Future
3288	if err := json.Unmarshal(body, &azFuture); err != nil {
3289		return err
3290	}
3291	future.FutureAPI = &azFuture
3292	future.Result = future.result
3293	return nil
3294}
3295
3296// result is the default implementation for ServersUpdateFuture.Result.
3297func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) {
3298	var done bool
3299	done, err = future.DoneWithContext(context.Background(), client)
3300	if err != nil {
3301		err = autorest.NewErrorWithError(err, "mariadb.ServersUpdateFuture", "Result", future.Response(), "Polling failure")
3302		return
3303	}
3304	if !done {
3305		s.Response.Response = future.Response()
3306		err = azure.NewAsyncOpIncompleteError("mariadb.ServersUpdateFuture")
3307		return
3308	}
3309	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3310	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
3311		s, err = client.UpdateResponder(s.Response.Response)
3312		if err != nil {
3313			err = autorest.NewErrorWithError(err, "mariadb.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
3314		}
3315	}
3316	return
3317}
3318
3319// ServerUpdateParameters parameters allowed to update for a server.
3320type ServerUpdateParameters struct {
3321	// Sku - The SKU (pricing tier) of the server.
3322	Sku *Sku `json:"sku,omitempty"`
3323	// ServerUpdateParametersProperties - The properties that can be updated for a server.
3324	*ServerUpdateParametersProperties `json:"properties,omitempty"`
3325	// Tags - Application-specific metadata in the form of key-value pairs.
3326	Tags map[string]*string `json:"tags"`
3327}
3328
3329// MarshalJSON is the custom marshaler for ServerUpdateParameters.
3330func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) {
3331	objectMap := make(map[string]interface{})
3332	if sup.Sku != nil {
3333		objectMap["sku"] = sup.Sku
3334	}
3335	if sup.ServerUpdateParametersProperties != nil {
3336		objectMap["properties"] = sup.ServerUpdateParametersProperties
3337	}
3338	if sup.Tags != nil {
3339		objectMap["tags"] = sup.Tags
3340	}
3341	return json.Marshal(objectMap)
3342}
3343
3344// UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct.
3345func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error {
3346	var m map[string]*json.RawMessage
3347	err := json.Unmarshal(body, &m)
3348	if err != nil {
3349		return err
3350	}
3351	for k, v := range m {
3352		switch k {
3353		case "sku":
3354			if v != nil {
3355				var sku Sku
3356				err = json.Unmarshal(*v, &sku)
3357				if err != nil {
3358					return err
3359				}
3360				sup.Sku = &sku
3361			}
3362		case "properties":
3363			if v != nil {
3364				var serverUpdateParametersProperties ServerUpdateParametersProperties
3365				err = json.Unmarshal(*v, &serverUpdateParametersProperties)
3366				if err != nil {
3367					return err
3368				}
3369				sup.ServerUpdateParametersProperties = &serverUpdateParametersProperties
3370			}
3371		case "tags":
3372			if v != nil {
3373				var tags map[string]*string
3374				err = json.Unmarshal(*v, &tags)
3375				if err != nil {
3376					return err
3377				}
3378				sup.Tags = tags
3379			}
3380		}
3381	}
3382
3383	return nil
3384}
3385
3386// ServerUpdateParametersProperties the properties that can be updated for a server.
3387type ServerUpdateParametersProperties struct {
3388	// StorageProfile - Storage profile of a server.
3389	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
3390	// AdministratorLoginPassword - The password of the administrator login.
3391	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
3392	// Version - The version of a server. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven'
3393	Version ServerVersion `json:"version,omitempty"`
3394	// SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled'
3395	SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"`
3396	// PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled'
3397	PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"`
3398	// ReplicationRole - The replication role of the server.
3399	ReplicationRole *string `json:"replicationRole,omitempty"`
3400}
3401
3402// Sku billing information related properties of a server.
3403type Sku struct {
3404	// Name - The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.
3405	Name *string `json:"name,omitempty"`
3406	// Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized'
3407	Tier SkuTier `json:"tier,omitempty"`
3408	// Capacity - The scale up/out capacity, representing server's compute units.
3409	Capacity *int32 `json:"capacity,omitempty"`
3410	// Size - The size code, to be interpreted by resource as appropriate.
3411	Size *string `json:"size,omitempty"`
3412	// Family - The family of hardware.
3413	Family *string `json:"family,omitempty"`
3414}
3415
3416// StorageProfile storage Profile properties of a server
3417type StorageProfile struct {
3418	// BackupRetentionDays - Backup retention days for the server.
3419	BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"`
3420	// GeoRedundantBackup - Enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled'
3421	GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"`
3422	// StorageMB - Max storage allowed for a server.
3423	StorageMB *int32 `json:"storageMB,omitempty"`
3424	// StorageAutogrow - Enable Storage Auto Grow. Possible values include: 'StorageAutogrowEnabled', 'StorageAutogrowDisabled'
3425	StorageAutogrow StorageAutogrow `json:"storageAutogrow,omitempty"`
3426}
3427
3428// TagsObject tags object for patch operations.
3429type TagsObject struct {
3430	// Tags - Resource tags.
3431	Tags map[string]*string `json:"tags"`
3432}
3433
3434// MarshalJSON is the custom marshaler for TagsObject.
3435func (toVar TagsObject) MarshalJSON() ([]byte, error) {
3436	objectMap := make(map[string]interface{})
3437	if toVar.Tags != nil {
3438		objectMap["tags"] = toVar.Tags
3439	}
3440	return json.Marshal(objectMap)
3441}
3442
3443// TopQueryStatisticsInput input to get top query statistics
3444type TopQueryStatisticsInput struct {
3445	// TopQueryStatisticsInputProperties - The properties of a wait statistics input.
3446	*TopQueryStatisticsInputProperties `json:"properties,omitempty"`
3447}
3448
3449// MarshalJSON is the custom marshaler for TopQueryStatisticsInput.
3450func (tqsi TopQueryStatisticsInput) MarshalJSON() ([]byte, error) {
3451	objectMap := make(map[string]interface{})
3452	if tqsi.TopQueryStatisticsInputProperties != nil {
3453		objectMap["properties"] = tqsi.TopQueryStatisticsInputProperties
3454	}
3455	return json.Marshal(objectMap)
3456}
3457
3458// UnmarshalJSON is the custom unmarshaler for TopQueryStatisticsInput struct.
3459func (tqsi *TopQueryStatisticsInput) UnmarshalJSON(body []byte) error {
3460	var m map[string]*json.RawMessage
3461	err := json.Unmarshal(body, &m)
3462	if err != nil {
3463		return err
3464	}
3465	for k, v := range m {
3466		switch k {
3467		case "properties":
3468			if v != nil {
3469				var topQueryStatisticsInputProperties TopQueryStatisticsInputProperties
3470				err = json.Unmarshal(*v, &topQueryStatisticsInputProperties)
3471				if err != nil {
3472					return err
3473				}
3474				tqsi.TopQueryStatisticsInputProperties = &topQueryStatisticsInputProperties
3475			}
3476		}
3477	}
3478
3479	return nil
3480}
3481
3482// TopQueryStatisticsInputProperties the properties for input to get top query statistics
3483type TopQueryStatisticsInputProperties struct {
3484	// NumberOfTopQueries - Max number of top queries to return.
3485	NumberOfTopQueries *int32 `json:"numberOfTopQueries,omitempty"`
3486	// AggregationFunction - Aggregation function name.
3487	AggregationFunction *string `json:"aggregationFunction,omitempty"`
3488	// ObservedMetric - Observed metric name.
3489	ObservedMetric *string `json:"observedMetric,omitempty"`
3490	// ObservationStartTime - Observation start time.
3491	ObservationStartTime *date.Time `json:"observationStartTime,omitempty"`
3492	// ObservationEndTime - Observation end time.
3493	ObservationEndTime *date.Time `json:"observationEndTime,omitempty"`
3494	// AggregationWindow - Aggregation interval type in ISO 8601 format.
3495	AggregationWindow *string `json:"aggregationWindow,omitempty"`
3496}
3497
3498// TopQueryStatisticsResultList a list of query statistics.
3499type TopQueryStatisticsResultList struct {
3500	autorest.Response `json:"-"`
3501	// Value - READ-ONLY; The list of top query statistics.
3502	Value *[]QueryStatistic `json:"value,omitempty"`
3503	// NextLink - READ-ONLY; Link to retrieve next page of results.
3504	NextLink *string `json:"nextLink,omitempty"`
3505}
3506
3507// MarshalJSON is the custom marshaler for TopQueryStatisticsResultList.
3508func (tqsrl TopQueryStatisticsResultList) MarshalJSON() ([]byte, error) {
3509	objectMap := make(map[string]interface{})
3510	return json.Marshal(objectMap)
3511}
3512
3513// TopQueryStatisticsResultListIterator provides access to a complete listing of QueryStatistic values.
3514type TopQueryStatisticsResultListIterator struct {
3515	i    int
3516	page TopQueryStatisticsResultListPage
3517}
3518
3519// NextWithContext advances to the next value.  If there was an error making
3520// the request the iterator does not advance and the error is returned.
3521func (iter *TopQueryStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) {
3522	if tracing.IsEnabled() {
3523		ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListIterator.NextWithContext")
3524		defer func() {
3525			sc := -1
3526			if iter.Response().Response.Response != nil {
3527				sc = iter.Response().Response.Response.StatusCode
3528			}
3529			tracing.EndSpan(ctx, sc, err)
3530		}()
3531	}
3532	iter.i++
3533	if iter.i < len(iter.page.Values()) {
3534		return nil
3535	}
3536	err = iter.page.NextWithContext(ctx)
3537	if err != nil {
3538		iter.i--
3539		return err
3540	}
3541	iter.i = 0
3542	return nil
3543}
3544
3545// Next advances to the next value.  If there was an error making
3546// the request the iterator does not advance and the error is returned.
3547// Deprecated: Use NextWithContext() instead.
3548func (iter *TopQueryStatisticsResultListIterator) Next() error {
3549	return iter.NextWithContext(context.Background())
3550}
3551
3552// NotDone returns true if the enumeration should be started or is not yet complete.
3553func (iter TopQueryStatisticsResultListIterator) NotDone() bool {
3554	return iter.page.NotDone() && iter.i < len(iter.page.Values())
3555}
3556
3557// Response returns the raw server response from the last page request.
3558func (iter TopQueryStatisticsResultListIterator) Response() TopQueryStatisticsResultList {
3559	return iter.page.Response()
3560}
3561
3562// Value returns the current value or a zero-initialized value if the
3563// iterator has advanced beyond the end of the collection.
3564func (iter TopQueryStatisticsResultListIterator) Value() QueryStatistic {
3565	if !iter.page.NotDone() {
3566		return QueryStatistic{}
3567	}
3568	return iter.page.Values()[iter.i]
3569}
3570
3571// Creates a new instance of the TopQueryStatisticsResultListIterator type.
3572func NewTopQueryStatisticsResultListIterator(page TopQueryStatisticsResultListPage) TopQueryStatisticsResultListIterator {
3573	return TopQueryStatisticsResultListIterator{page: page}
3574}
3575
3576// IsEmpty returns true if the ListResult contains no values.
3577func (tqsrl TopQueryStatisticsResultList) IsEmpty() bool {
3578	return tqsrl.Value == nil || len(*tqsrl.Value) == 0
3579}
3580
3581// hasNextLink returns true if the NextLink is not empty.
3582func (tqsrl TopQueryStatisticsResultList) hasNextLink() bool {
3583	return tqsrl.NextLink != nil && len(*tqsrl.NextLink) != 0
3584}
3585
3586// topQueryStatisticsResultListPreparer prepares a request to retrieve the next set of results.
3587// It returns nil if no more results exist.
3588func (tqsrl TopQueryStatisticsResultList) topQueryStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) {
3589	if !tqsrl.hasNextLink() {
3590		return nil, nil
3591	}
3592	return autorest.Prepare((&http.Request{}).WithContext(ctx),
3593		autorest.AsJSON(),
3594		autorest.AsGet(),
3595		autorest.WithBaseURL(to.String(tqsrl.NextLink)))
3596}
3597
3598// TopQueryStatisticsResultListPage contains a page of QueryStatistic values.
3599type TopQueryStatisticsResultListPage struct {
3600	fn    func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error)
3601	tqsrl TopQueryStatisticsResultList
3602}
3603
3604// NextWithContext advances to the next page of values.  If there was an error making
3605// the request the page does not advance and the error is returned.
3606func (page *TopQueryStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) {
3607	if tracing.IsEnabled() {
3608		ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListPage.NextWithContext")
3609		defer func() {
3610			sc := -1
3611			if page.Response().Response.Response != nil {
3612				sc = page.Response().Response.Response.StatusCode
3613			}
3614			tracing.EndSpan(ctx, sc, err)
3615		}()
3616	}
3617	for {
3618		next, err := page.fn(ctx, page.tqsrl)
3619		if err != nil {
3620			return err
3621		}
3622		page.tqsrl = next
3623		if !next.hasNextLink() || !next.IsEmpty() {
3624			break
3625		}
3626	}
3627	return nil
3628}
3629
3630// Next advances to the next page of values.  If there was an error making
3631// the request the page does not advance and the error is returned.
3632// Deprecated: Use NextWithContext() instead.
3633func (page *TopQueryStatisticsResultListPage) Next() error {
3634	return page.NextWithContext(context.Background())
3635}
3636
3637// NotDone returns true if the page enumeration should be started or is not yet complete.
3638func (page TopQueryStatisticsResultListPage) NotDone() bool {
3639	return !page.tqsrl.IsEmpty()
3640}
3641
3642// Response returns the raw server response from the last page request.
3643func (page TopQueryStatisticsResultListPage) Response() TopQueryStatisticsResultList {
3644	return page.tqsrl
3645}
3646
3647// Values returns the slice of values for the current page or nil if there are no values.
3648func (page TopQueryStatisticsResultListPage) Values() []QueryStatistic {
3649	if page.tqsrl.IsEmpty() {
3650		return nil
3651	}
3652	return *page.tqsrl.Value
3653}
3654
3655// Creates a new instance of the TopQueryStatisticsResultListPage type.
3656func NewTopQueryStatisticsResultListPage(cur TopQueryStatisticsResultList, getNextPage func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error)) TopQueryStatisticsResultListPage {
3657	return TopQueryStatisticsResultListPage{
3658		fn:    getNextPage,
3659		tqsrl: cur,
3660	}
3661}
3662
3663// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource
3664// which has 'tags' and a 'location'
3665type TrackedResource struct {
3666	// Tags - Resource tags.
3667	Tags map[string]*string `json:"tags"`
3668	// Location - The geo-location where the resource lives
3669	Location *string `json:"location,omitempty"`
3670	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
3671	ID *string `json:"id,omitempty"`
3672	// Name - READ-ONLY; The name of the resource
3673	Name *string `json:"name,omitempty"`
3674	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
3675	Type *string `json:"type,omitempty"`
3676}
3677
3678// MarshalJSON is the custom marshaler for TrackedResource.
3679func (tr TrackedResource) MarshalJSON() ([]byte, error) {
3680	objectMap := make(map[string]interface{})
3681	if tr.Tags != nil {
3682		objectMap["tags"] = tr.Tags
3683	}
3684	if tr.Location != nil {
3685		objectMap["location"] = tr.Location
3686	}
3687	return json.Marshal(objectMap)
3688}
3689
3690// VirtualNetworkRule a virtual network rule.
3691type VirtualNetworkRule struct {
3692	autorest.Response `json:"-"`
3693	// VirtualNetworkRuleProperties - Resource properties.
3694	*VirtualNetworkRuleProperties `json:"properties,omitempty"`
3695	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
3696	ID *string `json:"id,omitempty"`
3697	// Name - READ-ONLY; The name of the resource
3698	Name *string `json:"name,omitempty"`
3699	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
3700	Type *string `json:"type,omitempty"`
3701}
3702
3703// MarshalJSON is the custom marshaler for VirtualNetworkRule.
3704func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) {
3705	objectMap := make(map[string]interface{})
3706	if vnr.VirtualNetworkRuleProperties != nil {
3707		objectMap["properties"] = vnr.VirtualNetworkRuleProperties
3708	}
3709	return json.Marshal(objectMap)
3710}
3711
3712// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct.
3713func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error {
3714	var m map[string]*json.RawMessage
3715	err := json.Unmarshal(body, &m)
3716	if err != nil {
3717		return err
3718	}
3719	for k, v := range m {
3720		switch k {
3721		case "properties":
3722			if v != nil {
3723				var virtualNetworkRuleProperties VirtualNetworkRuleProperties
3724				err = json.Unmarshal(*v, &virtualNetworkRuleProperties)
3725				if err != nil {
3726					return err
3727				}
3728				vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties
3729			}
3730		case "id":
3731			if v != nil {
3732				var ID string
3733				err = json.Unmarshal(*v, &ID)
3734				if err != nil {
3735					return err
3736				}
3737				vnr.ID = &ID
3738			}
3739		case "name":
3740			if v != nil {
3741				var name string
3742				err = json.Unmarshal(*v, &name)
3743				if err != nil {
3744					return err
3745				}
3746				vnr.Name = &name
3747			}
3748		case "type":
3749			if v != nil {
3750				var typeVar string
3751				err = json.Unmarshal(*v, &typeVar)
3752				if err != nil {
3753					return err
3754				}
3755				vnr.Type = &typeVar
3756			}
3757		}
3758	}
3759
3760	return nil
3761}
3762
3763// VirtualNetworkRuleListResult a list of virtual network rules.
3764type VirtualNetworkRuleListResult struct {
3765	autorest.Response `json:"-"`
3766	// Value - READ-ONLY; Array of results.
3767	Value *[]VirtualNetworkRule `json:"value,omitempty"`
3768	// NextLink - READ-ONLY; Link to retrieve next page of results.
3769	NextLink *string `json:"nextLink,omitempty"`
3770}
3771
3772// MarshalJSON is the custom marshaler for VirtualNetworkRuleListResult.
3773func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) {
3774	objectMap := make(map[string]interface{})
3775	return json.Marshal(objectMap)
3776}
3777
3778// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values.
3779type VirtualNetworkRuleListResultIterator struct {
3780	i    int
3781	page VirtualNetworkRuleListResultPage
3782}
3783
3784// NextWithContext advances to the next value.  If there was an error making
3785// the request the iterator does not advance and the error is returned.
3786func (iter *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) {
3787	if tracing.IsEnabled() {
3788		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.NextWithContext")
3789		defer func() {
3790			sc := -1
3791			if iter.Response().Response.Response != nil {
3792				sc = iter.Response().Response.Response.StatusCode
3793			}
3794			tracing.EndSpan(ctx, sc, err)
3795		}()
3796	}
3797	iter.i++
3798	if iter.i < len(iter.page.Values()) {
3799		return nil
3800	}
3801	err = iter.page.NextWithContext(ctx)
3802	if err != nil {
3803		iter.i--
3804		return err
3805	}
3806	iter.i = 0
3807	return nil
3808}
3809
3810// Next advances to the next value.  If there was an error making
3811// the request the iterator does not advance and the error is returned.
3812// Deprecated: Use NextWithContext() instead.
3813func (iter *VirtualNetworkRuleListResultIterator) Next() error {
3814	return iter.NextWithContext(context.Background())
3815}
3816
3817// NotDone returns true if the enumeration should be started or is not yet complete.
3818func (iter VirtualNetworkRuleListResultIterator) NotDone() bool {
3819	return iter.page.NotDone() && iter.i < len(iter.page.Values())
3820}
3821
3822// Response returns the raw server response from the last page request.
3823func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult {
3824	return iter.page.Response()
3825}
3826
3827// Value returns the current value or a zero-initialized value if the
3828// iterator has advanced beyond the end of the collection.
3829func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule {
3830	if !iter.page.NotDone() {
3831		return VirtualNetworkRule{}
3832	}
3833	return iter.page.Values()[iter.i]
3834}
3835
3836// Creates a new instance of the VirtualNetworkRuleListResultIterator type.
3837func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator {
3838	return VirtualNetworkRuleListResultIterator{page: page}
3839}
3840
3841// IsEmpty returns true if the ListResult contains no values.
3842func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool {
3843	return vnrlr.Value == nil || len(*vnrlr.Value) == 0
3844}
3845
3846// hasNextLink returns true if the NextLink is not empty.
3847func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool {
3848	return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0
3849}
3850
3851// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results.
3852// It returns nil if no more results exist.
3853func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) {
3854	if !vnrlr.hasNextLink() {
3855		return nil, nil
3856	}
3857	return autorest.Prepare((&http.Request{}).WithContext(ctx),
3858		autorest.AsJSON(),
3859		autorest.AsGet(),
3860		autorest.WithBaseURL(to.String(vnrlr.NextLink)))
3861}
3862
3863// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values.
3864type VirtualNetworkRuleListResultPage struct {
3865	fn    func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)
3866	vnrlr VirtualNetworkRuleListResult
3867}
3868
3869// NextWithContext advances to the next page of values.  If there was an error making
3870// the request the page does not advance and the error is returned.
3871func (page *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) {
3872	if tracing.IsEnabled() {
3873		ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.NextWithContext")
3874		defer func() {
3875			sc := -1
3876			if page.Response().Response.Response != nil {
3877				sc = page.Response().Response.Response.StatusCode
3878			}
3879			tracing.EndSpan(ctx, sc, err)
3880		}()
3881	}
3882	for {
3883		next, err := page.fn(ctx, page.vnrlr)
3884		if err != nil {
3885			return err
3886		}
3887		page.vnrlr = next
3888		if !next.hasNextLink() || !next.IsEmpty() {
3889			break
3890		}
3891	}
3892	return nil
3893}
3894
3895// Next advances to the next page of values.  If there was an error making
3896// the request the page does not advance and the error is returned.
3897// Deprecated: Use NextWithContext() instead.
3898func (page *VirtualNetworkRuleListResultPage) Next() error {
3899	return page.NextWithContext(context.Background())
3900}
3901
3902// NotDone returns true if the page enumeration should be started or is not yet complete.
3903func (page VirtualNetworkRuleListResultPage) NotDone() bool {
3904	return !page.vnrlr.IsEmpty()
3905}
3906
3907// Response returns the raw server response from the last page request.
3908func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult {
3909	return page.vnrlr
3910}
3911
3912// Values returns the slice of values for the current page or nil if there are no values.
3913func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule {
3914	if page.vnrlr.IsEmpty() {
3915		return nil
3916	}
3917	return *page.vnrlr.Value
3918}
3919
3920// Creates a new instance of the VirtualNetworkRuleListResultPage type.
3921func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage {
3922	return VirtualNetworkRuleListResultPage{
3923		fn:    getNextPage,
3924		vnrlr: cur,
3925	}
3926}
3927
3928// VirtualNetworkRuleProperties properties of a virtual network rule.
3929type VirtualNetworkRuleProperties struct {
3930	// VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet.
3931	VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"`
3932	// IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled.
3933	IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"`
3934	// State - READ-ONLY; Virtual Network Rule State. Possible values include: 'VirtualNetworkRuleStateInitializing', 'VirtualNetworkRuleStateInProgress', 'VirtualNetworkRuleStateReady', 'VirtualNetworkRuleStateDeleting', 'VirtualNetworkRuleStateUnknown'
3935	State VirtualNetworkRuleState `json:"state,omitempty"`
3936}
3937
3938// MarshalJSON is the custom marshaler for VirtualNetworkRuleProperties.
3939func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) {
3940	objectMap := make(map[string]interface{})
3941	if vnrp.VirtualNetworkSubnetID != nil {
3942		objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID
3943	}
3944	if vnrp.IgnoreMissingVnetServiceEndpoint != nil {
3945		objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint
3946	}
3947	return json.Marshal(objectMap)
3948}
3949
3950// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
3951// long-running operation.
3952type VirtualNetworkRulesCreateOrUpdateFuture struct {
3953	azure.FutureAPI
3954	// Result returns the result of the asynchronous operation.
3955	// If the operation has not completed it will return an error.
3956	Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error)
3957}
3958
3959// UnmarshalJSON is the custom unmarshaller for CreateFuture.
3960func (future *VirtualNetworkRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
3961	var azFuture azure.Future
3962	if err := json.Unmarshal(body, &azFuture); err != nil {
3963		return err
3964	}
3965	future.FutureAPI = &azFuture
3966	future.Result = future.result
3967	return nil
3968}
3969
3970// result is the default implementation for VirtualNetworkRulesCreateOrUpdateFuture.Result.
3971func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) {
3972	var done bool
3973	done, err = future.DoneWithContext(context.Background(), client)
3974	if err != nil {
3975		err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
3976		return
3977	}
3978	if !done {
3979		vnr.Response.Response = future.Response()
3980		err = azure.NewAsyncOpIncompleteError("mariadb.VirtualNetworkRulesCreateOrUpdateFuture")
3981		return
3982	}
3983	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3984	if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent {
3985		vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response)
3986		if err != nil {
3987			err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request")
3988		}
3989	}
3990	return
3991}
3992
3993// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a
3994// long-running operation.
3995type VirtualNetworkRulesDeleteFuture struct {
3996	azure.FutureAPI
3997	// Result returns the result of the asynchronous operation.
3998	// If the operation has not completed it will return an error.
3999	Result func(VirtualNetworkRulesClient) (autorest.Response, error)
4000}
4001
4002// UnmarshalJSON is the custom unmarshaller for CreateFuture.
4003func (future *VirtualNetworkRulesDeleteFuture) UnmarshalJSON(body []byte) error {
4004	var azFuture azure.Future
4005	if err := json.Unmarshal(body, &azFuture); err != nil {
4006		return err
4007	}
4008	future.FutureAPI = &azFuture
4009	future.Result = future.result
4010	return nil
4011}
4012
4013// result is the default implementation for VirtualNetworkRulesDeleteFuture.Result.
4014func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) {
4015	var done bool
4016	done, err = future.DoneWithContext(context.Background(), client)
4017	if err != nil {
4018		err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure")
4019		return
4020	}
4021	if !done {
4022		ar.Response = future.Response()
4023		err = azure.NewAsyncOpIncompleteError("mariadb.VirtualNetworkRulesDeleteFuture")
4024		return
4025	}
4026	ar.Response = future.Response()
4027	return
4028}
4029
4030// WaitStatistic represents a Wait Statistic.
4031type WaitStatistic struct {
4032	autorest.Response `json:"-"`
4033	// WaitStatisticProperties - The properties of a wait statistic.
4034	*WaitStatisticProperties `json:"properties,omitempty"`
4035	// ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
4036	ID *string `json:"id,omitempty"`
4037	// Name - READ-ONLY; The name of the resource
4038	Name *string `json:"name,omitempty"`
4039	// Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
4040	Type *string `json:"type,omitempty"`
4041}
4042
4043// MarshalJSON is the custom marshaler for WaitStatistic.
4044func (ws WaitStatistic) MarshalJSON() ([]byte, error) {
4045	objectMap := make(map[string]interface{})
4046	if ws.WaitStatisticProperties != nil {
4047		objectMap["properties"] = ws.WaitStatisticProperties
4048	}
4049	return json.Marshal(objectMap)
4050}
4051
4052// UnmarshalJSON is the custom unmarshaler for WaitStatistic struct.
4053func (ws *WaitStatistic) UnmarshalJSON(body []byte) error {
4054	var m map[string]*json.RawMessage
4055	err := json.Unmarshal(body, &m)
4056	if err != nil {
4057		return err
4058	}
4059	for k, v := range m {
4060		switch k {
4061		case "properties":
4062			if v != nil {
4063				var waitStatisticProperties WaitStatisticProperties
4064				err = json.Unmarshal(*v, &waitStatisticProperties)
4065				if err != nil {
4066					return err
4067				}
4068				ws.WaitStatisticProperties = &waitStatisticProperties
4069			}
4070		case "id":
4071			if v != nil {
4072				var ID string
4073				err = json.Unmarshal(*v, &ID)
4074				if err != nil {
4075					return err
4076				}
4077				ws.ID = &ID
4078			}
4079		case "name":
4080			if v != nil {
4081				var name string
4082				err = json.Unmarshal(*v, &name)
4083				if err != nil {
4084					return err
4085				}
4086				ws.Name = &name
4087			}
4088		case "type":
4089			if v != nil {
4090				var typeVar string
4091				err = json.Unmarshal(*v, &typeVar)
4092				if err != nil {
4093					return err
4094				}
4095				ws.Type = &typeVar
4096			}
4097		}
4098	}
4099
4100	return nil
4101}
4102
4103// WaitStatisticProperties the properties of a wait statistic.
4104type WaitStatisticProperties struct {
4105	// StartTime - Observation start time.
4106	StartTime *date.Time `json:"startTime,omitempty"`
4107	// EndTime - Observation end time.
4108	EndTime *date.Time `json:"endTime,omitempty"`
4109	// EventName - Wait event name.
4110	EventName *string `json:"eventName,omitempty"`
4111	// EventTypeName - Wait event type name.
4112	EventTypeName *string `json:"eventTypeName,omitempty"`
4113	// QueryID - Database query identifier.
4114	QueryID *int64 `json:"queryId,omitempty"`
4115	// DatabaseName - Database Name.
4116	DatabaseName *string `json:"databaseName,omitempty"`
4117	// UserID - Database user identifier.
4118	UserID *int64 `json:"userId,omitempty"`
4119	// Count - Wait event count observed in this time interval.
4120	Count *int64 `json:"count,omitempty"`
4121	// TotalTimeInMs - Total time of wait in milliseconds in this time interval.
4122	TotalTimeInMs *float64 `json:"totalTimeInMs,omitempty"`
4123}
4124
4125// WaitStatisticsInput input to get wait statistics
4126type WaitStatisticsInput struct {
4127	// WaitStatisticsInputProperties - The properties of a wait statistics input.
4128	*WaitStatisticsInputProperties `json:"properties,omitempty"`
4129}
4130
4131// MarshalJSON is the custom marshaler for WaitStatisticsInput.
4132func (wsi WaitStatisticsInput) MarshalJSON() ([]byte, error) {
4133	objectMap := make(map[string]interface{})
4134	if wsi.WaitStatisticsInputProperties != nil {
4135		objectMap["properties"] = wsi.WaitStatisticsInputProperties
4136	}
4137	return json.Marshal(objectMap)
4138}
4139
4140// UnmarshalJSON is the custom unmarshaler for WaitStatisticsInput struct.
4141func (wsi *WaitStatisticsInput) UnmarshalJSON(body []byte) error {
4142	var m map[string]*json.RawMessage
4143	err := json.Unmarshal(body, &m)
4144	if err != nil {
4145		return err
4146	}
4147	for k, v := range m {
4148		switch k {
4149		case "properties":
4150			if v != nil {
4151				var waitStatisticsInputProperties WaitStatisticsInputProperties
4152				err = json.Unmarshal(*v, &waitStatisticsInputProperties)
4153				if err != nil {
4154					return err
4155				}
4156				wsi.WaitStatisticsInputProperties = &waitStatisticsInputProperties
4157			}
4158		}
4159	}
4160
4161	return nil
4162}
4163
4164// WaitStatisticsInputProperties the properties for input to get wait statistics
4165type WaitStatisticsInputProperties struct {
4166	// ObservationStartTime - Observation start time.
4167	ObservationStartTime *date.Time `json:"observationStartTime,omitempty"`
4168	// ObservationEndTime - Observation end time.
4169	ObservationEndTime *date.Time `json:"observationEndTime,omitempty"`
4170	// AggregationWindow - Aggregation interval type in ISO 8601 format.
4171	AggregationWindow *string `json:"aggregationWindow,omitempty"`
4172}
4173
4174// WaitStatisticsResultList a list of wait statistics.
4175type WaitStatisticsResultList struct {
4176	autorest.Response `json:"-"`
4177	// Value - READ-ONLY; The list of wait statistics.
4178	Value *[]WaitStatistic `json:"value,omitempty"`
4179	// NextLink - READ-ONLY; Link to retrieve next page of results.
4180	NextLink *string `json:"nextLink,omitempty"`
4181}
4182
4183// MarshalJSON is the custom marshaler for WaitStatisticsResultList.
4184func (wsrl WaitStatisticsResultList) MarshalJSON() ([]byte, error) {
4185	objectMap := make(map[string]interface{})
4186	return json.Marshal(objectMap)
4187}
4188
4189// WaitStatisticsResultListIterator provides access to a complete listing of WaitStatistic values.
4190type WaitStatisticsResultListIterator struct {
4191	i    int
4192	page WaitStatisticsResultListPage
4193}
4194
4195// NextWithContext advances to the next value.  If there was an error making
4196// the request the iterator does not advance and the error is returned.
4197func (iter *WaitStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) {
4198	if tracing.IsEnabled() {
4199		ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListIterator.NextWithContext")
4200		defer func() {
4201			sc := -1
4202			if iter.Response().Response.Response != nil {
4203				sc = iter.Response().Response.Response.StatusCode
4204			}
4205			tracing.EndSpan(ctx, sc, err)
4206		}()
4207	}
4208	iter.i++
4209	if iter.i < len(iter.page.Values()) {
4210		return nil
4211	}
4212	err = iter.page.NextWithContext(ctx)
4213	if err != nil {
4214		iter.i--
4215		return err
4216	}
4217	iter.i = 0
4218	return nil
4219}
4220
4221// Next advances to the next value.  If there was an error making
4222// the request the iterator does not advance and the error is returned.
4223// Deprecated: Use NextWithContext() instead.
4224func (iter *WaitStatisticsResultListIterator) Next() error {
4225	return iter.NextWithContext(context.Background())
4226}
4227
4228// NotDone returns true if the enumeration should be started or is not yet complete.
4229func (iter WaitStatisticsResultListIterator) NotDone() bool {
4230	return iter.page.NotDone() && iter.i < len(iter.page.Values())
4231}
4232
4233// Response returns the raw server response from the last page request.
4234func (iter WaitStatisticsResultListIterator) Response() WaitStatisticsResultList {
4235	return iter.page.Response()
4236}
4237
4238// Value returns the current value or a zero-initialized value if the
4239// iterator has advanced beyond the end of the collection.
4240func (iter WaitStatisticsResultListIterator) Value() WaitStatistic {
4241	if !iter.page.NotDone() {
4242		return WaitStatistic{}
4243	}
4244	return iter.page.Values()[iter.i]
4245}
4246
4247// Creates a new instance of the WaitStatisticsResultListIterator type.
4248func NewWaitStatisticsResultListIterator(page WaitStatisticsResultListPage) WaitStatisticsResultListIterator {
4249	return WaitStatisticsResultListIterator{page: page}
4250}
4251
4252// IsEmpty returns true if the ListResult contains no values.
4253func (wsrl WaitStatisticsResultList) IsEmpty() bool {
4254	return wsrl.Value == nil || len(*wsrl.Value) == 0
4255}
4256
4257// hasNextLink returns true if the NextLink is not empty.
4258func (wsrl WaitStatisticsResultList) hasNextLink() bool {
4259	return wsrl.NextLink != nil && len(*wsrl.NextLink) != 0
4260}
4261
4262// waitStatisticsResultListPreparer prepares a request to retrieve the next set of results.
4263// It returns nil if no more results exist.
4264func (wsrl WaitStatisticsResultList) waitStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) {
4265	if !wsrl.hasNextLink() {
4266		return nil, nil
4267	}
4268	return autorest.Prepare((&http.Request{}).WithContext(ctx),
4269		autorest.AsJSON(),
4270		autorest.AsGet(),
4271		autorest.WithBaseURL(to.String(wsrl.NextLink)))
4272}
4273
4274// WaitStatisticsResultListPage contains a page of WaitStatistic values.
4275type WaitStatisticsResultListPage struct {
4276	fn   func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error)
4277	wsrl WaitStatisticsResultList
4278}
4279
4280// NextWithContext advances to the next page of values.  If there was an error making
4281// the request the page does not advance and the error is returned.
4282func (page *WaitStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) {
4283	if tracing.IsEnabled() {
4284		ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListPage.NextWithContext")
4285		defer func() {
4286			sc := -1
4287			if page.Response().Response.Response != nil {
4288				sc = page.Response().Response.Response.StatusCode
4289			}
4290			tracing.EndSpan(ctx, sc, err)
4291		}()
4292	}
4293	for {
4294		next, err := page.fn(ctx, page.wsrl)
4295		if err != nil {
4296			return err
4297		}
4298		page.wsrl = next
4299		if !next.hasNextLink() || !next.IsEmpty() {
4300			break
4301		}
4302	}
4303	return nil
4304}
4305
4306// Next advances to the next page of values.  If there was an error making
4307// the request the page does not advance and the error is returned.
4308// Deprecated: Use NextWithContext() instead.
4309func (page *WaitStatisticsResultListPage) Next() error {
4310	return page.NextWithContext(context.Background())
4311}
4312
4313// NotDone returns true if the page enumeration should be started or is not yet complete.
4314func (page WaitStatisticsResultListPage) NotDone() bool {
4315	return !page.wsrl.IsEmpty()
4316}
4317
4318// Response returns the raw server response from the last page request.
4319func (page WaitStatisticsResultListPage) Response() WaitStatisticsResultList {
4320	return page.wsrl
4321}
4322
4323// Values returns the slice of values for the current page or nil if there are no values.
4324func (page WaitStatisticsResultListPage) Values() []WaitStatistic {
4325	if page.wsrl.IsEmpty() {
4326		return nil
4327	}
4328	return *page.wsrl.Value
4329}
4330
4331// Creates a new instance of the WaitStatisticsResultListPage type.
4332func NewWaitStatisticsResultListPage(cur WaitStatisticsResultList, getNextPage func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error)) WaitStatisticsResultListPage {
4333	return WaitStatisticsResultListPage{
4334		fn:   getNextPage,
4335		wsrl: cur,
4336	}
4337}
4338