1package sql
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/azure"
25	"github.com/Azure/go-autorest/autorest/date"
26	"github.com/Azure/go-autorest/autorest/to"
27	"github.com/Azure/go-autorest/tracing"
28	"github.com/satori/go.uuid"
29	"net/http"
30)
31
32// The package's fully qualified name.
33const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2018-06-01-preview/sql"
34
35// CatalogCollationType enumerates the values for catalog collation type.
36type CatalogCollationType string
37
38const (
39	// DATABASEDEFAULT ...
40	DATABASEDEFAULT CatalogCollationType = "DATABASE_DEFAULT"
41	// SQLLatin1GeneralCP1CIAS ...
42	SQLLatin1GeneralCP1CIAS CatalogCollationType = "SQL_Latin1_General_CP1_CI_AS"
43)
44
45// PossibleCatalogCollationTypeValues returns an array of possible values for the CatalogCollationType const type.
46func PossibleCatalogCollationTypeValues() []CatalogCollationType {
47	return []CatalogCollationType{DATABASEDEFAULT, SQLLatin1GeneralCP1CIAS}
48}
49
50// DatabaseState enumerates the values for database state.
51type DatabaseState string
52
53const (
54	// All ...
55	All DatabaseState = "All"
56	// Deleted ...
57	Deleted DatabaseState = "Deleted"
58	// Live ...
59	Live DatabaseState = "Live"
60)
61
62// PossibleDatabaseStateValues returns an array of possible values for the DatabaseState const type.
63func PossibleDatabaseStateValues() []DatabaseState {
64	return []DatabaseState{All, Deleted, Live}
65}
66
67// IdentityType enumerates the values for identity type.
68type IdentityType string
69
70const (
71	// SystemAssigned ...
72	SystemAssigned IdentityType = "SystemAssigned"
73)
74
75// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type.
76func PossibleIdentityTypeValues() []IdentityType {
77	return []IdentityType{SystemAssigned}
78}
79
80// InstancePoolLicenseType enumerates the values for instance pool license type.
81type InstancePoolLicenseType string
82
83const (
84	// BasePrice ...
85	BasePrice InstancePoolLicenseType = "BasePrice"
86	// LicenseIncluded ...
87	LicenseIncluded InstancePoolLicenseType = "LicenseIncluded"
88)
89
90// PossibleInstancePoolLicenseTypeValues returns an array of possible values for the InstancePoolLicenseType const type.
91func PossibleInstancePoolLicenseTypeValues() []InstancePoolLicenseType {
92	return []InstancePoolLicenseType{BasePrice, LicenseIncluded}
93}
94
95// ManagedDatabaseCreateMode enumerates the values for managed database create mode.
96type ManagedDatabaseCreateMode string
97
98const (
99	// Default ...
100	Default ManagedDatabaseCreateMode = "Default"
101	// PointInTimeRestore ...
102	PointInTimeRestore ManagedDatabaseCreateMode = "PointInTimeRestore"
103	// Recovery ...
104	Recovery ManagedDatabaseCreateMode = "Recovery"
105	// RestoreExternalBackup ...
106	RestoreExternalBackup ManagedDatabaseCreateMode = "RestoreExternalBackup"
107	// RestoreLongTermRetentionBackup ...
108	RestoreLongTermRetentionBackup ManagedDatabaseCreateMode = "RestoreLongTermRetentionBackup"
109)
110
111// PossibleManagedDatabaseCreateModeValues returns an array of possible values for the ManagedDatabaseCreateMode const type.
112func PossibleManagedDatabaseCreateModeValues() []ManagedDatabaseCreateMode {
113	return []ManagedDatabaseCreateMode{Default, PointInTimeRestore, Recovery, RestoreExternalBackup, RestoreLongTermRetentionBackup}
114}
115
116// ManagedDatabaseStatus enumerates the values for managed database status.
117type ManagedDatabaseStatus string
118
119const (
120	// Creating ...
121	Creating ManagedDatabaseStatus = "Creating"
122	// Inaccessible ...
123	Inaccessible ManagedDatabaseStatus = "Inaccessible"
124	// Offline ...
125	Offline ManagedDatabaseStatus = "Offline"
126	// Online ...
127	Online ManagedDatabaseStatus = "Online"
128	// Restoring ...
129	Restoring ManagedDatabaseStatus = "Restoring"
130	// Shutdown ...
131	Shutdown ManagedDatabaseStatus = "Shutdown"
132	// Updating ...
133	Updating ManagedDatabaseStatus = "Updating"
134)
135
136// PossibleManagedDatabaseStatusValues returns an array of possible values for the ManagedDatabaseStatus const type.
137func PossibleManagedDatabaseStatusValues() []ManagedDatabaseStatus {
138	return []ManagedDatabaseStatus{Creating, Inaccessible, Offline, Online, Restoring, Shutdown, Updating}
139}
140
141// ManagedInstanceLicenseType enumerates the values for managed instance license type.
142type ManagedInstanceLicenseType string
143
144const (
145	// ManagedInstanceLicenseTypeBasePrice ...
146	ManagedInstanceLicenseTypeBasePrice ManagedInstanceLicenseType = "BasePrice"
147	// ManagedInstanceLicenseTypeLicenseIncluded ...
148	ManagedInstanceLicenseTypeLicenseIncluded ManagedInstanceLicenseType = "LicenseIncluded"
149)
150
151// PossibleManagedInstanceLicenseTypeValues returns an array of possible values for the ManagedInstanceLicenseType const type.
152func PossibleManagedInstanceLicenseTypeValues() []ManagedInstanceLicenseType {
153	return []ManagedInstanceLicenseType{ManagedInstanceLicenseTypeBasePrice, ManagedInstanceLicenseTypeLicenseIncluded}
154}
155
156// ManagedInstanceProxyOverride enumerates the values for managed instance proxy override.
157type ManagedInstanceProxyOverride string
158
159const (
160	// ManagedInstanceProxyOverrideDefault ...
161	ManagedInstanceProxyOverrideDefault ManagedInstanceProxyOverride = "Default"
162	// ManagedInstanceProxyOverrideProxy ...
163	ManagedInstanceProxyOverrideProxy ManagedInstanceProxyOverride = "Proxy"
164	// ManagedInstanceProxyOverrideRedirect ...
165	ManagedInstanceProxyOverrideRedirect ManagedInstanceProxyOverride = "Redirect"
166)
167
168// PossibleManagedInstanceProxyOverrideValues returns an array of possible values for the ManagedInstanceProxyOverride const type.
169func PossibleManagedInstanceProxyOverrideValues() []ManagedInstanceProxyOverride {
170	return []ManagedInstanceProxyOverride{ManagedInstanceProxyOverrideDefault, ManagedInstanceProxyOverrideProxy, ManagedInstanceProxyOverrideRedirect}
171}
172
173// ManagedServerCreateMode enumerates the values for managed server create mode.
174type ManagedServerCreateMode string
175
176const (
177	// ManagedServerCreateModeDefault ...
178	ManagedServerCreateModeDefault ManagedServerCreateMode = "Default"
179	// ManagedServerCreateModePointInTimeRestore ...
180	ManagedServerCreateModePointInTimeRestore ManagedServerCreateMode = "PointInTimeRestore"
181)
182
183// PossibleManagedServerCreateModeValues returns an array of possible values for the ManagedServerCreateMode const type.
184func PossibleManagedServerCreateModeValues() []ManagedServerCreateMode {
185	return []ManagedServerCreateMode{ManagedServerCreateModeDefault, ManagedServerCreateModePointInTimeRestore}
186}
187
188// ManagementOperationState enumerates the values for management operation state.
189type ManagementOperationState string
190
191const (
192	// CancelInProgress ...
193	CancelInProgress ManagementOperationState = "CancelInProgress"
194	// Cancelled ...
195	Cancelled ManagementOperationState = "Cancelled"
196	// Failed ...
197	Failed ManagementOperationState = "Failed"
198	// InProgress ...
199	InProgress ManagementOperationState = "InProgress"
200	// Pending ...
201	Pending ManagementOperationState = "Pending"
202	// Succeeded ...
203	Succeeded ManagementOperationState = "Succeeded"
204)
205
206// PossibleManagementOperationStateValues returns an array of possible values for the ManagementOperationState const type.
207func PossibleManagementOperationStateValues() []ManagementOperationState {
208	return []ManagementOperationState{CancelInProgress, Cancelled, Failed, InProgress, Pending, Succeeded}
209}
210
211// ReplicaType enumerates the values for replica type.
212type ReplicaType string
213
214const (
215	// Primary ...
216	Primary ReplicaType = "Primary"
217	// ReadableSecondary ...
218	ReadableSecondary ReplicaType = "ReadableSecondary"
219)
220
221// PossibleReplicaTypeValues returns an array of possible values for the ReplicaType const type.
222func PossibleReplicaTypeValues() []ReplicaType {
223	return []ReplicaType{Primary, ReadableSecondary}
224}
225
226// SecurityAlertPolicyState enumerates the values for security alert policy state.
227type SecurityAlertPolicyState string
228
229const (
230	// SecurityAlertPolicyStateDisabled ...
231	SecurityAlertPolicyStateDisabled SecurityAlertPolicyState = "Disabled"
232	// SecurityAlertPolicyStateEnabled ...
233	SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled"
234	// SecurityAlertPolicyStateNew ...
235	SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New"
236)
237
238// PossibleSecurityAlertPolicyStateValues returns an array of possible values for the SecurityAlertPolicyState const type.
239func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState {
240	return []SecurityAlertPolicyState{SecurityAlertPolicyStateDisabled, SecurityAlertPolicyStateEnabled, SecurityAlertPolicyStateNew}
241}
242
243// SensitivityLabelRank enumerates the values for sensitivity label rank.
244type SensitivityLabelRank string
245
246const (
247	// Critical ...
248	Critical SensitivityLabelRank = "Critical"
249	// High ...
250	High SensitivityLabelRank = "High"
251	// Low ...
252	Low SensitivityLabelRank = "Low"
253	// Medium ...
254	Medium SensitivityLabelRank = "Medium"
255	// None ...
256	None SensitivityLabelRank = "None"
257)
258
259// PossibleSensitivityLabelRankValues returns an array of possible values for the SensitivityLabelRank const type.
260func PossibleSensitivityLabelRankValues() []SensitivityLabelRank {
261	return []SensitivityLabelRank{Critical, High, Low, Medium, None}
262}
263
264// SensitivityLabelSource enumerates the values for sensitivity label source.
265type SensitivityLabelSource string
266
267const (
268	// Current ...
269	Current SensitivityLabelSource = "current"
270	// Recommended ...
271	Recommended SensitivityLabelSource = "recommended"
272)
273
274// PossibleSensitivityLabelSourceValues returns an array of possible values for the SensitivityLabelSource const type.
275func PossibleSensitivityLabelSourceValues() []SensitivityLabelSource {
276	return []SensitivityLabelSource{Current, Recommended}
277}
278
279// AdministratorListResult a list of active directory administrators.
280type AdministratorListResult struct {
281	autorest.Response `json:"-"`
282	// Value - READ-ONLY; Array of results.
283	Value *[]ServerAzureADAdministrator `json:"value,omitempty"`
284	// NextLink - READ-ONLY; Link to retrieve next page of results.
285	NextLink *string `json:"nextLink,omitempty"`
286}
287
288// AdministratorListResultIterator provides access to a complete listing of ServerAzureADAdministrator
289// values.
290type AdministratorListResultIterator struct {
291	i    int
292	page AdministratorListResultPage
293}
294
295// NextWithContext advances to the next value.  If there was an error making
296// the request the iterator does not advance and the error is returned.
297func (iter *AdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) {
298	if tracing.IsEnabled() {
299		ctx = tracing.StartSpan(ctx, fqdn+"/AdministratorListResultIterator.NextWithContext")
300		defer func() {
301			sc := -1
302			if iter.Response().Response.Response != nil {
303				sc = iter.Response().Response.Response.StatusCode
304			}
305			tracing.EndSpan(ctx, sc, err)
306		}()
307	}
308	iter.i++
309	if iter.i < len(iter.page.Values()) {
310		return nil
311	}
312	err = iter.page.NextWithContext(ctx)
313	if err != nil {
314		iter.i--
315		return err
316	}
317	iter.i = 0
318	return nil
319}
320
321// Next advances to the next value.  If there was an error making
322// the request the iterator does not advance and the error is returned.
323// Deprecated: Use NextWithContext() instead.
324func (iter *AdministratorListResultIterator) Next() error {
325	return iter.NextWithContext(context.Background())
326}
327
328// NotDone returns true if the enumeration should be started or is not yet complete.
329func (iter AdministratorListResultIterator) NotDone() bool {
330	return iter.page.NotDone() && iter.i < len(iter.page.Values())
331}
332
333// Response returns the raw server response from the last page request.
334func (iter AdministratorListResultIterator) Response() AdministratorListResult {
335	return iter.page.Response()
336}
337
338// Value returns the current value or a zero-initialized value if the
339// iterator has advanced beyond the end of the collection.
340func (iter AdministratorListResultIterator) Value() ServerAzureADAdministrator {
341	if !iter.page.NotDone() {
342		return ServerAzureADAdministrator{}
343	}
344	return iter.page.Values()[iter.i]
345}
346
347// Creates a new instance of the AdministratorListResultIterator type.
348func NewAdministratorListResultIterator(page AdministratorListResultPage) AdministratorListResultIterator {
349	return AdministratorListResultIterator{page: page}
350}
351
352// IsEmpty returns true if the ListResult contains no values.
353func (alr AdministratorListResult) IsEmpty() bool {
354	return alr.Value == nil || len(*alr.Value) == 0
355}
356
357// administratorListResultPreparer prepares a request to retrieve the next set of results.
358// It returns nil if no more results exist.
359func (alr AdministratorListResult) administratorListResultPreparer(ctx context.Context) (*http.Request, error) {
360	if alr.NextLink == nil || len(to.String(alr.NextLink)) < 1 {
361		return nil, nil
362	}
363	return autorest.Prepare((&http.Request{}).WithContext(ctx),
364		autorest.AsJSON(),
365		autorest.AsGet(),
366		autorest.WithBaseURL(to.String(alr.NextLink)))
367}
368
369// AdministratorListResultPage contains a page of ServerAzureADAdministrator values.
370type AdministratorListResultPage struct {
371	fn  func(context.Context, AdministratorListResult) (AdministratorListResult, error)
372	alr AdministratorListResult
373}
374
375// NextWithContext advances to the next page of values.  If there was an error making
376// the request the page does not advance and the error is returned.
377func (page *AdministratorListResultPage) NextWithContext(ctx context.Context) (err error) {
378	if tracing.IsEnabled() {
379		ctx = tracing.StartSpan(ctx, fqdn+"/AdministratorListResultPage.NextWithContext")
380		defer func() {
381			sc := -1
382			if page.Response().Response.Response != nil {
383				sc = page.Response().Response.Response.StatusCode
384			}
385			tracing.EndSpan(ctx, sc, err)
386		}()
387	}
388	next, err := page.fn(ctx, page.alr)
389	if err != nil {
390		return err
391	}
392	page.alr = next
393	return nil
394}
395
396// Next advances to the next page of values.  If there was an error making
397// the request the page does not advance and the error is returned.
398// Deprecated: Use NextWithContext() instead.
399func (page *AdministratorListResultPage) Next() error {
400	return page.NextWithContext(context.Background())
401}
402
403// NotDone returns true if the page enumeration should be started or is not yet complete.
404func (page AdministratorListResultPage) NotDone() bool {
405	return !page.alr.IsEmpty()
406}
407
408// Response returns the raw server response from the last page request.
409func (page AdministratorListResultPage) Response() AdministratorListResult {
410	return page.alr
411}
412
413// Values returns the slice of values for the current page or nil if there are no values.
414func (page AdministratorListResultPage) Values() []ServerAzureADAdministrator {
415	if page.alr.IsEmpty() {
416		return nil
417	}
418	return *page.alr.Value
419}
420
421// Creates a new instance of the AdministratorListResultPage type.
422func NewAdministratorListResultPage(getNextPage func(context.Context, AdministratorListResult) (AdministratorListResult, error)) AdministratorListResultPage {
423	return AdministratorListResultPage{fn: getNextPage}
424}
425
426// AdministratorProperties properties of a active directory administrator.
427type AdministratorProperties struct {
428	// AdministratorType - Type of the sever administrator.
429	AdministratorType *string `json:"administratorType,omitempty"`
430	// Login - Login name of the server administrator.
431	Login *string `json:"login,omitempty"`
432	// Sid - SID (object ID) of the server administrator.
433	Sid *uuid.UUID `json:"sid,omitempty"`
434	// TenantID - Tenant ID of the administrator.
435	TenantID *uuid.UUID `json:"tenantId,omitempty"`
436}
437
438// BaseLongTermRetentionPolicyProperties properties of a long term retention policy
439type BaseLongTermRetentionPolicyProperties struct {
440	// WeeklyRetention - The weekly retention policy for an LTR backup in an ISO 8601 format.
441	WeeklyRetention *string `json:"weeklyRetention,omitempty"`
442	// MonthlyRetention - The monthly retention policy for an LTR backup in an ISO 8601 format.
443	MonthlyRetention *string `json:"monthlyRetention,omitempty"`
444	// YearlyRetention - The yearly retention policy for an LTR backup in an ISO 8601 format.
445	YearlyRetention *string `json:"yearlyRetention,omitempty"`
446	// WeekOfYear - The week of year to take the yearly backup in an ISO 8601 format.
447	WeekOfYear *int32 `json:"weekOfYear,omitempty"`
448}
449
450// CompleteDatabaseRestoreDefinition contains the information necessary to perform a complete database
451// restore operation.
452type CompleteDatabaseRestoreDefinition struct {
453	// LastBackupName - The last backup name to apply
454	LastBackupName *string `json:"lastBackupName,omitempty"`
455}
456
457// DatabaseSecurityAlertListResult a list of the database's security alert policies.
458type DatabaseSecurityAlertListResult struct {
459	autorest.Response `json:"-"`
460	// Value - READ-ONLY; Array of results.
461	Value *[]DatabaseSecurityAlertPolicy `json:"value,omitempty"`
462	// NextLink - READ-ONLY; Link to retrieve next page of results.
463	NextLink *string `json:"nextLink,omitempty"`
464}
465
466// DatabaseSecurityAlertListResultIterator provides access to a complete listing of
467// DatabaseSecurityAlertPolicy values.
468type DatabaseSecurityAlertListResultIterator struct {
469	i    int
470	page DatabaseSecurityAlertListResultPage
471}
472
473// NextWithContext advances to the next value.  If there was an error making
474// the request the iterator does not advance and the error is returned.
475func (iter *DatabaseSecurityAlertListResultIterator) NextWithContext(ctx context.Context) (err error) {
476	if tracing.IsEnabled() {
477		ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseSecurityAlertListResultIterator.NextWithContext")
478		defer func() {
479			sc := -1
480			if iter.Response().Response.Response != nil {
481				sc = iter.Response().Response.Response.StatusCode
482			}
483			tracing.EndSpan(ctx, sc, err)
484		}()
485	}
486	iter.i++
487	if iter.i < len(iter.page.Values()) {
488		return nil
489	}
490	err = iter.page.NextWithContext(ctx)
491	if err != nil {
492		iter.i--
493		return err
494	}
495	iter.i = 0
496	return nil
497}
498
499// Next advances to the next value.  If there was an error making
500// the request the iterator does not advance and the error is returned.
501// Deprecated: Use NextWithContext() instead.
502func (iter *DatabaseSecurityAlertListResultIterator) Next() error {
503	return iter.NextWithContext(context.Background())
504}
505
506// NotDone returns true if the enumeration should be started or is not yet complete.
507func (iter DatabaseSecurityAlertListResultIterator) NotDone() bool {
508	return iter.page.NotDone() && iter.i < len(iter.page.Values())
509}
510
511// Response returns the raw server response from the last page request.
512func (iter DatabaseSecurityAlertListResultIterator) Response() DatabaseSecurityAlertListResult {
513	return iter.page.Response()
514}
515
516// Value returns the current value or a zero-initialized value if the
517// iterator has advanced beyond the end of the collection.
518func (iter DatabaseSecurityAlertListResultIterator) Value() DatabaseSecurityAlertPolicy {
519	if !iter.page.NotDone() {
520		return DatabaseSecurityAlertPolicy{}
521	}
522	return iter.page.Values()[iter.i]
523}
524
525// Creates a new instance of the DatabaseSecurityAlertListResultIterator type.
526func NewDatabaseSecurityAlertListResultIterator(page DatabaseSecurityAlertListResultPage) DatabaseSecurityAlertListResultIterator {
527	return DatabaseSecurityAlertListResultIterator{page: page}
528}
529
530// IsEmpty returns true if the ListResult contains no values.
531func (dsalr DatabaseSecurityAlertListResult) IsEmpty() bool {
532	return dsalr.Value == nil || len(*dsalr.Value) == 0
533}
534
535// databaseSecurityAlertListResultPreparer prepares a request to retrieve the next set of results.
536// It returns nil if no more results exist.
537func (dsalr DatabaseSecurityAlertListResult) databaseSecurityAlertListResultPreparer(ctx context.Context) (*http.Request, error) {
538	if dsalr.NextLink == nil || len(to.String(dsalr.NextLink)) < 1 {
539		return nil, nil
540	}
541	return autorest.Prepare((&http.Request{}).WithContext(ctx),
542		autorest.AsJSON(),
543		autorest.AsGet(),
544		autorest.WithBaseURL(to.String(dsalr.NextLink)))
545}
546
547// DatabaseSecurityAlertListResultPage contains a page of DatabaseSecurityAlertPolicy values.
548type DatabaseSecurityAlertListResultPage struct {
549	fn    func(context.Context, DatabaseSecurityAlertListResult) (DatabaseSecurityAlertListResult, error)
550	dsalr DatabaseSecurityAlertListResult
551}
552
553// NextWithContext advances to the next page of values.  If there was an error making
554// the request the page does not advance and the error is returned.
555func (page *DatabaseSecurityAlertListResultPage) NextWithContext(ctx context.Context) (err error) {
556	if tracing.IsEnabled() {
557		ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseSecurityAlertListResultPage.NextWithContext")
558		defer func() {
559			sc := -1
560			if page.Response().Response.Response != nil {
561				sc = page.Response().Response.Response.StatusCode
562			}
563			tracing.EndSpan(ctx, sc, err)
564		}()
565	}
566	next, err := page.fn(ctx, page.dsalr)
567	if err != nil {
568		return err
569	}
570	page.dsalr = next
571	return nil
572}
573
574// Next advances to the next page of values.  If there was an error making
575// the request the page does not advance and the error is returned.
576// Deprecated: Use NextWithContext() instead.
577func (page *DatabaseSecurityAlertListResultPage) Next() error {
578	return page.NextWithContext(context.Background())
579}
580
581// NotDone returns true if the page enumeration should be started or is not yet complete.
582func (page DatabaseSecurityAlertListResultPage) NotDone() bool {
583	return !page.dsalr.IsEmpty()
584}
585
586// Response returns the raw server response from the last page request.
587func (page DatabaseSecurityAlertListResultPage) Response() DatabaseSecurityAlertListResult {
588	return page.dsalr
589}
590
591// Values returns the slice of values for the current page or nil if there are no values.
592func (page DatabaseSecurityAlertListResultPage) Values() []DatabaseSecurityAlertPolicy {
593	if page.dsalr.IsEmpty() {
594		return nil
595	}
596	return *page.dsalr.Value
597}
598
599// Creates a new instance of the DatabaseSecurityAlertListResultPage type.
600func NewDatabaseSecurityAlertListResultPage(getNextPage func(context.Context, DatabaseSecurityAlertListResult) (DatabaseSecurityAlertListResult, error)) DatabaseSecurityAlertListResultPage {
601	return DatabaseSecurityAlertListResultPage{fn: getNextPage}
602}
603
604// DatabaseSecurityAlertPolicy a database security alert policy.
605type DatabaseSecurityAlertPolicy struct {
606	autorest.Response `json:"-"`
607	// SecurityAlertPolicyProperties - Resource properties.
608	*SecurityAlertPolicyProperties `json:"properties,omitempty"`
609	// ID - READ-ONLY; Resource ID.
610	ID *string `json:"id,omitempty"`
611	// Name - READ-ONLY; Resource name.
612	Name *string `json:"name,omitempty"`
613	// Type - READ-ONLY; Resource type.
614	Type *string `json:"type,omitempty"`
615}
616
617// MarshalJSON is the custom marshaler for DatabaseSecurityAlertPolicy.
618func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) {
619	objectMap := make(map[string]interface{})
620	if dsap.SecurityAlertPolicyProperties != nil {
621		objectMap["properties"] = dsap.SecurityAlertPolicyProperties
622	}
623	return json.Marshal(objectMap)
624}
625
626// UnmarshalJSON is the custom unmarshaler for DatabaseSecurityAlertPolicy struct.
627func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error {
628	var m map[string]*json.RawMessage
629	err := json.Unmarshal(body, &m)
630	if err != nil {
631		return err
632	}
633	for k, v := range m {
634		switch k {
635		case "properties":
636			if v != nil {
637				var securityAlertPolicyProperties SecurityAlertPolicyProperties
638				err = json.Unmarshal(*v, &securityAlertPolicyProperties)
639				if err != nil {
640					return err
641				}
642				dsap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties
643			}
644		case "id":
645			if v != nil {
646				var ID string
647				err = json.Unmarshal(*v, &ID)
648				if err != nil {
649					return err
650				}
651				dsap.ID = &ID
652			}
653		case "name":
654			if v != nil {
655				var name string
656				err = json.Unmarshal(*v, &name)
657				if err != nil {
658					return err
659				}
660				dsap.Name = &name
661			}
662		case "type":
663			if v != nil {
664				var typeVar string
665				err = json.Unmarshal(*v, &typeVar)
666				if err != nil {
667					return err
668				}
669				dsap.Type = &typeVar
670			}
671		}
672	}
673
674	return nil
675}
676
677// DatabasesFailoverFuture an abstraction for monitoring and retrieving the results of a long-running
678// operation.
679type DatabasesFailoverFuture struct {
680	azure.Future
681}
682
683// Result returns the result of the asynchronous operation.
684// If the operation has not completed it will return an error.
685func (future *DatabasesFailoverFuture) Result(client DatabasesClient) (ar autorest.Response, err error) {
686	var done bool
687	done, err = future.DoneWithContext(context.Background(), client)
688	if err != nil {
689		err = autorest.NewErrorWithError(err, "sql.DatabasesFailoverFuture", "Result", future.Response(), "Polling failure")
690		return
691	}
692	if !done {
693		err = azure.NewAsyncOpIncompleteError("sql.DatabasesFailoverFuture")
694		return
695	}
696	ar.Response = future.Response()
697	return
698}
699
700// ElasticPoolsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running
701// operation.
702type ElasticPoolsFailoverFuture struct {
703	azure.Future
704}
705
706// Result returns the result of the asynchronous operation.
707// If the operation has not completed it will return an error.
708func (future *ElasticPoolsFailoverFuture) Result(client ElasticPoolsClient) (ar autorest.Response, err error) {
709	var done bool
710	done, err = future.DoneWithContext(context.Background(), client)
711	if err != nil {
712		err = autorest.NewErrorWithError(err, "sql.ElasticPoolsFailoverFuture", "Result", future.Response(), "Polling failure")
713		return
714	}
715	if !done {
716		err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsFailoverFuture")
717		return
718	}
719	ar.Response = future.Response()
720	return
721}
722
723// InstancePool an Azure SQL instance pool.
724type InstancePool struct {
725	autorest.Response `json:"-"`
726	// Sku - The name and tier of the SKU.
727	Sku *Sku `json:"sku,omitempty"`
728	// InstancePoolProperties - Resource properties.
729	*InstancePoolProperties `json:"properties,omitempty"`
730	// Location - Resource location.
731	Location *string `json:"location,omitempty"`
732	// Tags - Resource tags.
733	Tags map[string]*string `json:"tags"`
734	// ID - READ-ONLY; Resource ID.
735	ID *string `json:"id,omitempty"`
736	// Name - READ-ONLY; Resource name.
737	Name *string `json:"name,omitempty"`
738	// Type - READ-ONLY; Resource type.
739	Type *string `json:"type,omitempty"`
740}
741
742// MarshalJSON is the custom marshaler for InstancePool.
743func (IP InstancePool) MarshalJSON() ([]byte, error) {
744	objectMap := make(map[string]interface{})
745	if IP.Sku != nil {
746		objectMap["sku"] = IP.Sku
747	}
748	if IP.InstancePoolProperties != nil {
749		objectMap["properties"] = IP.InstancePoolProperties
750	}
751	if IP.Location != nil {
752		objectMap["location"] = IP.Location
753	}
754	if IP.Tags != nil {
755		objectMap["tags"] = IP.Tags
756	}
757	return json.Marshal(objectMap)
758}
759
760// UnmarshalJSON is the custom unmarshaler for InstancePool struct.
761func (IP *InstancePool) UnmarshalJSON(body []byte) error {
762	var m map[string]*json.RawMessage
763	err := json.Unmarshal(body, &m)
764	if err != nil {
765		return err
766	}
767	for k, v := range m {
768		switch k {
769		case "sku":
770			if v != nil {
771				var sku Sku
772				err = json.Unmarshal(*v, &sku)
773				if err != nil {
774					return err
775				}
776				IP.Sku = &sku
777			}
778		case "properties":
779			if v != nil {
780				var instancePoolProperties InstancePoolProperties
781				err = json.Unmarshal(*v, &instancePoolProperties)
782				if err != nil {
783					return err
784				}
785				IP.InstancePoolProperties = &instancePoolProperties
786			}
787		case "location":
788			if v != nil {
789				var location string
790				err = json.Unmarshal(*v, &location)
791				if err != nil {
792					return err
793				}
794				IP.Location = &location
795			}
796		case "tags":
797			if v != nil {
798				var tags map[string]*string
799				err = json.Unmarshal(*v, &tags)
800				if err != nil {
801					return err
802				}
803				IP.Tags = tags
804			}
805		case "id":
806			if v != nil {
807				var ID string
808				err = json.Unmarshal(*v, &ID)
809				if err != nil {
810					return err
811				}
812				IP.ID = &ID
813			}
814		case "name":
815			if v != nil {
816				var name string
817				err = json.Unmarshal(*v, &name)
818				if err != nil {
819					return err
820				}
821				IP.Name = &name
822			}
823		case "type":
824			if v != nil {
825				var typeVar string
826				err = json.Unmarshal(*v, &typeVar)
827				if err != nil {
828					return err
829				}
830				IP.Type = &typeVar
831			}
832		}
833	}
834
835	return nil
836}
837
838// InstancePoolListResult a list of Azure SQL instance pools.
839type InstancePoolListResult struct {
840	autorest.Response `json:"-"`
841	// Value - READ-ONLY; Array of results.
842	Value *[]InstancePool `json:"value,omitempty"`
843	// NextLink - READ-ONLY; Link to retrieve next page of results.
844	NextLink *string `json:"nextLink,omitempty"`
845}
846
847// InstancePoolListResultIterator provides access to a complete listing of InstancePool values.
848type InstancePoolListResultIterator struct {
849	i    int
850	page InstancePoolListResultPage
851}
852
853// NextWithContext advances to the next value.  If there was an error making
854// the request the iterator does not advance and the error is returned.
855func (iter *InstancePoolListResultIterator) NextWithContext(ctx context.Context) (err error) {
856	if tracing.IsEnabled() {
857		ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultIterator.NextWithContext")
858		defer func() {
859			sc := -1
860			if iter.Response().Response.Response != nil {
861				sc = iter.Response().Response.Response.StatusCode
862			}
863			tracing.EndSpan(ctx, sc, err)
864		}()
865	}
866	iter.i++
867	if iter.i < len(iter.page.Values()) {
868		return nil
869	}
870	err = iter.page.NextWithContext(ctx)
871	if err != nil {
872		iter.i--
873		return err
874	}
875	iter.i = 0
876	return nil
877}
878
879// Next advances to the next value.  If there was an error making
880// the request the iterator does not advance and the error is returned.
881// Deprecated: Use NextWithContext() instead.
882func (iter *InstancePoolListResultIterator) Next() error {
883	return iter.NextWithContext(context.Background())
884}
885
886// NotDone returns true if the enumeration should be started or is not yet complete.
887func (iter InstancePoolListResultIterator) NotDone() bool {
888	return iter.page.NotDone() && iter.i < len(iter.page.Values())
889}
890
891// Response returns the raw server response from the last page request.
892func (iter InstancePoolListResultIterator) Response() InstancePoolListResult {
893	return iter.page.Response()
894}
895
896// Value returns the current value or a zero-initialized value if the
897// iterator has advanced beyond the end of the collection.
898func (iter InstancePoolListResultIterator) Value() InstancePool {
899	if !iter.page.NotDone() {
900		return InstancePool{}
901	}
902	return iter.page.Values()[iter.i]
903}
904
905// Creates a new instance of the InstancePoolListResultIterator type.
906func NewInstancePoolListResultIterator(page InstancePoolListResultPage) InstancePoolListResultIterator {
907	return InstancePoolListResultIterator{page: page}
908}
909
910// IsEmpty returns true if the ListResult contains no values.
911func (iplr InstancePoolListResult) IsEmpty() bool {
912	return iplr.Value == nil || len(*iplr.Value) == 0
913}
914
915// instancePoolListResultPreparer prepares a request to retrieve the next set of results.
916// It returns nil if no more results exist.
917func (iplr InstancePoolListResult) instancePoolListResultPreparer(ctx context.Context) (*http.Request, error) {
918	if iplr.NextLink == nil || len(to.String(iplr.NextLink)) < 1 {
919		return nil, nil
920	}
921	return autorest.Prepare((&http.Request{}).WithContext(ctx),
922		autorest.AsJSON(),
923		autorest.AsGet(),
924		autorest.WithBaseURL(to.String(iplr.NextLink)))
925}
926
927// InstancePoolListResultPage contains a page of InstancePool values.
928type InstancePoolListResultPage struct {
929	fn   func(context.Context, InstancePoolListResult) (InstancePoolListResult, error)
930	iplr InstancePoolListResult
931}
932
933// NextWithContext advances to the next page of values.  If there was an error making
934// the request the page does not advance and the error is returned.
935func (page *InstancePoolListResultPage) NextWithContext(ctx context.Context) (err error) {
936	if tracing.IsEnabled() {
937		ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultPage.NextWithContext")
938		defer func() {
939			sc := -1
940			if page.Response().Response.Response != nil {
941				sc = page.Response().Response.Response.StatusCode
942			}
943			tracing.EndSpan(ctx, sc, err)
944		}()
945	}
946	next, err := page.fn(ctx, page.iplr)
947	if err != nil {
948		return err
949	}
950	page.iplr = next
951	return nil
952}
953
954// Next advances to the next page of values.  If there was an error making
955// the request the page does not advance and the error is returned.
956// Deprecated: Use NextWithContext() instead.
957func (page *InstancePoolListResultPage) Next() error {
958	return page.NextWithContext(context.Background())
959}
960
961// NotDone returns true if the page enumeration should be started or is not yet complete.
962func (page InstancePoolListResultPage) NotDone() bool {
963	return !page.iplr.IsEmpty()
964}
965
966// Response returns the raw server response from the last page request.
967func (page InstancePoolListResultPage) Response() InstancePoolListResult {
968	return page.iplr
969}
970
971// Values returns the slice of values for the current page or nil if there are no values.
972func (page InstancePoolListResultPage) Values() []InstancePool {
973	if page.iplr.IsEmpty() {
974		return nil
975	}
976	return *page.iplr.Value
977}
978
979// Creates a new instance of the InstancePoolListResultPage type.
980func NewInstancePoolListResultPage(getNextPage func(context.Context, InstancePoolListResult) (InstancePoolListResult, error)) InstancePoolListResultPage {
981	return InstancePoolListResultPage{fn: getNextPage}
982}
983
984// InstancePoolProperties properties of an instance pool.
985type InstancePoolProperties struct {
986	// SubnetID - Resource ID of the subnet to place this instance pool in.
987	SubnetID *string `json:"subnetId,omitempty"`
988	// VCores - Count of vCores belonging to this instance pool.
989	VCores *int32 `json:"vCores,omitempty"`
990	// LicenseType - The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'LicenseIncluded', 'BasePrice'
991	LicenseType InstancePoolLicenseType `json:"licenseType,omitempty"`
992}
993
994// InstancePoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
995// long-running operation.
996type InstancePoolsCreateOrUpdateFuture struct {
997	azure.Future
998}
999
1000// Result returns the result of the asynchronous operation.
1001// If the operation has not completed it will return an error.
1002func (future *InstancePoolsCreateOrUpdateFuture) Result(client InstancePoolsClient) (IP InstancePool, err error) {
1003	var done bool
1004	done, err = future.DoneWithContext(context.Background(), client)
1005	if err != nil {
1006		err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1007		return
1008	}
1009	if !done {
1010		err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsCreateOrUpdateFuture")
1011		return
1012	}
1013	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1014	if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent {
1015		IP, err = client.CreateOrUpdateResponder(IP.Response.Response)
1016		if err != nil {
1017			err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", IP.Response.Response, "Failure responding to request")
1018		}
1019	}
1020	return
1021}
1022
1023// InstancePoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1024// operation.
1025type InstancePoolsDeleteFuture struct {
1026	azure.Future
1027}
1028
1029// Result returns the result of the asynchronous operation.
1030// If the operation has not completed it will return an error.
1031func (future *InstancePoolsDeleteFuture) Result(client InstancePoolsClient) (ar autorest.Response, err error) {
1032	var done bool
1033	done, err = future.DoneWithContext(context.Background(), client)
1034	if err != nil {
1035		err = autorest.NewErrorWithError(err, "sql.InstancePoolsDeleteFuture", "Result", future.Response(), "Polling failure")
1036		return
1037	}
1038	if !done {
1039		err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsDeleteFuture")
1040		return
1041	}
1042	ar.Response = future.Response()
1043	return
1044}
1045
1046// InstancePoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1047// operation.
1048type InstancePoolsUpdateFuture struct {
1049	azure.Future
1050}
1051
1052// Result returns the result of the asynchronous operation.
1053// If the operation has not completed it will return an error.
1054func (future *InstancePoolsUpdateFuture) Result(client InstancePoolsClient) (IP InstancePool, err error) {
1055	var done bool
1056	done, err = future.DoneWithContext(context.Background(), client)
1057	if err != nil {
1058		err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", future.Response(), "Polling failure")
1059		return
1060	}
1061	if !done {
1062		err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsUpdateFuture")
1063		return
1064	}
1065	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1066	if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent {
1067		IP, err = client.UpdateResponder(IP.Response.Response)
1068		if err != nil {
1069			err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", IP.Response.Response, "Failure responding to request")
1070		}
1071	}
1072	return
1073}
1074
1075// InstancePoolUpdate an update to an Instance pool.
1076type InstancePoolUpdate struct {
1077	// Tags - Resource tags.
1078	Tags map[string]*string `json:"tags"`
1079}
1080
1081// MarshalJSON is the custom marshaler for InstancePoolUpdate.
1082func (ipu InstancePoolUpdate) MarshalJSON() ([]byte, error) {
1083	objectMap := make(map[string]interface{})
1084	if ipu.Tags != nil {
1085		objectMap["tags"] = ipu.Tags
1086	}
1087	return json.Marshal(objectMap)
1088}
1089
1090// LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture an abstraction for monitoring and
1091// retrieving the results of a long-running operation.
1092type LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture struct {
1093	azure.Future
1094}
1095
1096// Result returns the result of the asynchronous operation.
1097// If the operation has not completed it will return an error.
1098func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) Result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) {
1099	var done bool
1100	done, err = future.DoneWithContext(context.Background(), client)
1101	if err != nil {
1102		err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure")
1103		return
1104	}
1105	if !done {
1106		err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture")
1107		return
1108	}
1109	ar.Response = future.Response()
1110	return
1111}
1112
1113// LongTermRetentionManagedInstanceBackupsDeleteFuture an abstraction for monitoring and retrieving the
1114// results of a long-running operation.
1115type LongTermRetentionManagedInstanceBackupsDeleteFuture struct {
1116	azure.Future
1117}
1118
1119// Result returns the result of the asynchronous operation.
1120// If the operation has not completed it will return an error.
1121func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) Result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) {
1122	var done bool
1123	done, err = future.DoneWithContext(context.Background(), client)
1124	if err != nil {
1125		err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteFuture", "Result", future.Response(), "Polling failure")
1126		return
1127	}
1128	if !done {
1129		err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteFuture")
1130		return
1131	}
1132	ar.Response = future.Response()
1133	return
1134}
1135
1136// ManagedDatabase a managed database resource.
1137type ManagedDatabase struct {
1138	autorest.Response `json:"-"`
1139	// ManagedDatabaseProperties - Resource properties.
1140	*ManagedDatabaseProperties `json:"properties,omitempty"`
1141	// Location - Resource location.
1142	Location *string `json:"location,omitempty"`
1143	// Tags - Resource tags.
1144	Tags map[string]*string `json:"tags"`
1145	// ID - READ-ONLY; Resource ID.
1146	ID *string `json:"id,omitempty"`
1147	// Name - READ-ONLY; Resource name.
1148	Name *string `json:"name,omitempty"`
1149	// Type - READ-ONLY; Resource type.
1150	Type *string `json:"type,omitempty"`
1151}
1152
1153// MarshalJSON is the custom marshaler for ManagedDatabase.
1154func (md ManagedDatabase) MarshalJSON() ([]byte, error) {
1155	objectMap := make(map[string]interface{})
1156	if md.ManagedDatabaseProperties != nil {
1157		objectMap["properties"] = md.ManagedDatabaseProperties
1158	}
1159	if md.Location != nil {
1160		objectMap["location"] = md.Location
1161	}
1162	if md.Tags != nil {
1163		objectMap["tags"] = md.Tags
1164	}
1165	return json.Marshal(objectMap)
1166}
1167
1168// UnmarshalJSON is the custom unmarshaler for ManagedDatabase struct.
1169func (md *ManagedDatabase) UnmarshalJSON(body []byte) error {
1170	var m map[string]*json.RawMessage
1171	err := json.Unmarshal(body, &m)
1172	if err != nil {
1173		return err
1174	}
1175	for k, v := range m {
1176		switch k {
1177		case "properties":
1178			if v != nil {
1179				var managedDatabaseProperties ManagedDatabaseProperties
1180				err = json.Unmarshal(*v, &managedDatabaseProperties)
1181				if err != nil {
1182					return err
1183				}
1184				md.ManagedDatabaseProperties = &managedDatabaseProperties
1185			}
1186		case "location":
1187			if v != nil {
1188				var location string
1189				err = json.Unmarshal(*v, &location)
1190				if err != nil {
1191					return err
1192				}
1193				md.Location = &location
1194			}
1195		case "tags":
1196			if v != nil {
1197				var tags map[string]*string
1198				err = json.Unmarshal(*v, &tags)
1199				if err != nil {
1200					return err
1201				}
1202				md.Tags = tags
1203			}
1204		case "id":
1205			if v != nil {
1206				var ID string
1207				err = json.Unmarshal(*v, &ID)
1208				if err != nil {
1209					return err
1210				}
1211				md.ID = &ID
1212			}
1213		case "name":
1214			if v != nil {
1215				var name string
1216				err = json.Unmarshal(*v, &name)
1217				if err != nil {
1218					return err
1219				}
1220				md.Name = &name
1221			}
1222		case "type":
1223			if v != nil {
1224				var typeVar string
1225				err = json.Unmarshal(*v, &typeVar)
1226				if err != nil {
1227					return err
1228				}
1229				md.Type = &typeVar
1230			}
1231		}
1232	}
1233
1234	return nil
1235}
1236
1237// ManagedDatabaseListResult a list of managed databases.
1238type ManagedDatabaseListResult struct {
1239	autorest.Response `json:"-"`
1240	// Value - READ-ONLY; Array of results.
1241	Value *[]ManagedDatabase `json:"value,omitempty"`
1242	// NextLink - READ-ONLY; Link to retrieve next page of results.
1243	NextLink *string `json:"nextLink,omitempty"`
1244}
1245
1246// ManagedDatabaseListResultIterator provides access to a complete listing of ManagedDatabase values.
1247type ManagedDatabaseListResultIterator struct {
1248	i    int
1249	page ManagedDatabaseListResultPage
1250}
1251
1252// NextWithContext advances to the next value.  If there was an error making
1253// the request the iterator does not advance and the error is returned.
1254func (iter *ManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) {
1255	if tracing.IsEnabled() {
1256		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultIterator.NextWithContext")
1257		defer func() {
1258			sc := -1
1259			if iter.Response().Response.Response != nil {
1260				sc = iter.Response().Response.Response.StatusCode
1261			}
1262			tracing.EndSpan(ctx, sc, err)
1263		}()
1264	}
1265	iter.i++
1266	if iter.i < len(iter.page.Values()) {
1267		return nil
1268	}
1269	err = iter.page.NextWithContext(ctx)
1270	if err != nil {
1271		iter.i--
1272		return err
1273	}
1274	iter.i = 0
1275	return nil
1276}
1277
1278// Next advances to the next value.  If there was an error making
1279// the request the iterator does not advance and the error is returned.
1280// Deprecated: Use NextWithContext() instead.
1281func (iter *ManagedDatabaseListResultIterator) Next() error {
1282	return iter.NextWithContext(context.Background())
1283}
1284
1285// NotDone returns true if the enumeration should be started or is not yet complete.
1286func (iter ManagedDatabaseListResultIterator) NotDone() bool {
1287	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1288}
1289
1290// Response returns the raw server response from the last page request.
1291func (iter ManagedDatabaseListResultIterator) Response() ManagedDatabaseListResult {
1292	return iter.page.Response()
1293}
1294
1295// Value returns the current value or a zero-initialized value if the
1296// iterator has advanced beyond the end of the collection.
1297func (iter ManagedDatabaseListResultIterator) Value() ManagedDatabase {
1298	if !iter.page.NotDone() {
1299		return ManagedDatabase{}
1300	}
1301	return iter.page.Values()[iter.i]
1302}
1303
1304// Creates a new instance of the ManagedDatabaseListResultIterator type.
1305func NewManagedDatabaseListResultIterator(page ManagedDatabaseListResultPage) ManagedDatabaseListResultIterator {
1306	return ManagedDatabaseListResultIterator{page: page}
1307}
1308
1309// IsEmpty returns true if the ListResult contains no values.
1310func (mdlr ManagedDatabaseListResult) IsEmpty() bool {
1311	return mdlr.Value == nil || len(*mdlr.Value) == 0
1312}
1313
1314// managedDatabaseListResultPreparer prepares a request to retrieve the next set of results.
1315// It returns nil if no more results exist.
1316func (mdlr ManagedDatabaseListResult) managedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) {
1317	if mdlr.NextLink == nil || len(to.String(mdlr.NextLink)) < 1 {
1318		return nil, nil
1319	}
1320	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1321		autorest.AsJSON(),
1322		autorest.AsGet(),
1323		autorest.WithBaseURL(to.String(mdlr.NextLink)))
1324}
1325
1326// ManagedDatabaseListResultPage contains a page of ManagedDatabase values.
1327type ManagedDatabaseListResultPage struct {
1328	fn   func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error)
1329	mdlr ManagedDatabaseListResult
1330}
1331
1332// NextWithContext advances to the next page of values.  If there was an error making
1333// the request the page does not advance and the error is returned.
1334func (page *ManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) {
1335	if tracing.IsEnabled() {
1336		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultPage.NextWithContext")
1337		defer func() {
1338			sc := -1
1339			if page.Response().Response.Response != nil {
1340				sc = page.Response().Response.Response.StatusCode
1341			}
1342			tracing.EndSpan(ctx, sc, err)
1343		}()
1344	}
1345	next, err := page.fn(ctx, page.mdlr)
1346	if err != nil {
1347		return err
1348	}
1349	page.mdlr = next
1350	return nil
1351}
1352
1353// Next advances to the next page of values.  If there was an error making
1354// the request the page does not advance and the error is returned.
1355// Deprecated: Use NextWithContext() instead.
1356func (page *ManagedDatabaseListResultPage) Next() error {
1357	return page.NextWithContext(context.Background())
1358}
1359
1360// NotDone returns true if the page enumeration should be started or is not yet complete.
1361func (page ManagedDatabaseListResultPage) NotDone() bool {
1362	return !page.mdlr.IsEmpty()
1363}
1364
1365// Response returns the raw server response from the last page request.
1366func (page ManagedDatabaseListResultPage) Response() ManagedDatabaseListResult {
1367	return page.mdlr
1368}
1369
1370// Values returns the slice of values for the current page or nil if there are no values.
1371func (page ManagedDatabaseListResultPage) Values() []ManagedDatabase {
1372	if page.mdlr.IsEmpty() {
1373		return nil
1374	}
1375	return *page.mdlr.Value
1376}
1377
1378// Creates a new instance of the ManagedDatabaseListResultPage type.
1379func NewManagedDatabaseListResultPage(getNextPage func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error)) ManagedDatabaseListResultPage {
1380	return ManagedDatabaseListResultPage{fn: getNextPage}
1381}
1382
1383// ManagedDatabaseProperties the managed database's properties.
1384type ManagedDatabaseProperties struct {
1385	// Collation - Collation of the managed database.
1386	Collation *string `json:"collation,omitempty"`
1387	// Status - READ-ONLY; Status of the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating'
1388	Status ManagedDatabaseStatus `json:"status,omitempty"`
1389	// CreationDate - READ-ONLY; Creation date of the database.
1390	CreationDate *date.Time `json:"creationDate,omitempty"`
1391	// EarliestRestorePoint - READ-ONLY; Earliest restore point in time for point in time restore.
1392	EarliestRestorePoint *date.Time `json:"earliestRestorePoint,omitempty"`
1393	// RestorePointInTime - Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.
1394	RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"`
1395	// DefaultSecondaryLocation - READ-ONLY; Geo paired region.
1396	DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"`
1397	// CatalogCollation - Collation of the metadata catalog. Possible values include: 'DATABASEDEFAULT', 'SQLLatin1GeneralCP1CIAS'
1398	CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"`
1399	// CreateMode - Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup'
1400	CreateMode ManagedDatabaseCreateMode `json:"createMode,omitempty"`
1401	// StorageContainerURI - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.
1402	StorageContainerURI *string `json:"storageContainerUri,omitempty"`
1403	// SourceDatabaseID - The resource identifier of the source database associated with create operation of this database.
1404	SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"`
1405	// RestorableDroppedDatabaseID - The restorable dropped database resource id to restore when creating this database.
1406	RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"`
1407	// StorageContainerSasToken - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.
1408	StorageContainerSasToken *string `json:"storageContainerSasToken,omitempty"`
1409	// FailoverGroupID - READ-ONLY; Instance Failover Group resource identifier that this managed database belongs to.
1410	FailoverGroupID *string `json:"failoverGroupId,omitempty"`
1411	// RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database.
1412	RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"`
1413	// LongTermRetentionBackupResourceID - The name of the Long Term Retention backup to be used for restore of this managed database.
1414	LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"`
1415}
1416
1417// ManagedDatabaseRestoreDetailsProperties the managed database's restore details properties.
1418type ManagedDatabaseRestoreDetailsProperties struct {
1419	// Status - READ-ONLY; Restore status.
1420	Status *string `json:"status,omitempty"`
1421	// CurrentRestoringFileName - READ-ONLY; Current restoring file name.
1422	CurrentRestoringFileName *string `json:"currentRestoringFileName,omitempty"`
1423	// LastRestoredFileName - READ-ONLY; Last restored file name.
1424	LastRestoredFileName *string `json:"lastRestoredFileName,omitempty"`
1425	// LastRestoredFileTime - READ-ONLY; Last restored file time.
1426	LastRestoredFileTime *date.Time `json:"lastRestoredFileTime,omitempty"`
1427	// PercentCompleted - READ-ONLY; Percent completed.
1428	PercentCompleted *float64 `json:"percentCompleted,omitempty"`
1429	// UnrestorableFiles - READ-ONLY; List of unrestorable files.
1430	UnrestorableFiles *[]string `json:"unrestorableFiles,omitempty"`
1431	// NumberOfFilesDetected - READ-ONLY; Number of files detected.
1432	NumberOfFilesDetected *int64 `json:"numberOfFilesDetected,omitempty"`
1433	// LastUploadedFileName - READ-ONLY; Last uploaded file name.
1434	LastUploadedFileName *string `json:"lastUploadedFileName,omitempty"`
1435	// LastUploadedFileTime - READ-ONLY; Last uploaded file time.
1436	LastUploadedFileTime *date.Time `json:"lastUploadedFileTime,omitempty"`
1437	// BlockReason - READ-ONLY; The reason why restore is in Blocked state.
1438	BlockReason *string `json:"blockReason,omitempty"`
1439}
1440
1441// ManagedDatabaseRestoreDetailsResult a managed database restore details.
1442type ManagedDatabaseRestoreDetailsResult struct {
1443	autorest.Response `json:"-"`
1444	// ManagedDatabaseRestoreDetailsProperties - Resource properties.
1445	*ManagedDatabaseRestoreDetailsProperties `json:"properties,omitempty"`
1446	// ID - READ-ONLY; Resource ID.
1447	ID *string `json:"id,omitempty"`
1448	// Name - READ-ONLY; Resource name.
1449	Name *string `json:"name,omitempty"`
1450	// Type - READ-ONLY; Resource type.
1451	Type *string `json:"type,omitempty"`
1452}
1453
1454// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsResult.
1455func (mdrdr ManagedDatabaseRestoreDetailsResult) MarshalJSON() ([]byte, error) {
1456	objectMap := make(map[string]interface{})
1457	if mdrdr.ManagedDatabaseRestoreDetailsProperties != nil {
1458		objectMap["properties"] = mdrdr.ManagedDatabaseRestoreDetailsProperties
1459	}
1460	return json.Marshal(objectMap)
1461}
1462
1463// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseRestoreDetailsResult struct.
1464func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) error {
1465	var m map[string]*json.RawMessage
1466	err := json.Unmarshal(body, &m)
1467	if err != nil {
1468		return err
1469	}
1470	for k, v := range m {
1471		switch k {
1472		case "properties":
1473			if v != nil {
1474				var managedDatabaseRestoreDetailsProperties ManagedDatabaseRestoreDetailsProperties
1475				err = json.Unmarshal(*v, &managedDatabaseRestoreDetailsProperties)
1476				if err != nil {
1477					return err
1478				}
1479				mdrdr.ManagedDatabaseRestoreDetailsProperties = &managedDatabaseRestoreDetailsProperties
1480			}
1481		case "id":
1482			if v != nil {
1483				var ID string
1484				err = json.Unmarshal(*v, &ID)
1485				if err != nil {
1486					return err
1487				}
1488				mdrdr.ID = &ID
1489			}
1490		case "name":
1491			if v != nil {
1492				var name string
1493				err = json.Unmarshal(*v, &name)
1494				if err != nil {
1495					return err
1496				}
1497				mdrdr.Name = &name
1498			}
1499		case "type":
1500			if v != nil {
1501				var typeVar string
1502				err = json.Unmarshal(*v, &typeVar)
1503				if err != nil {
1504					return err
1505				}
1506				mdrdr.Type = &typeVar
1507			}
1508		}
1509	}
1510
1511	return nil
1512}
1513
1514// ManagedDatabasesCompleteRestoreFuture an abstraction for monitoring and retrieving the results of a
1515// long-running operation.
1516type ManagedDatabasesCompleteRestoreFuture struct {
1517	azure.Future
1518}
1519
1520// Result returns the result of the asynchronous operation.
1521// If the operation has not completed it will return an error.
1522func (future *ManagedDatabasesCompleteRestoreFuture) Result(client ManagedDatabasesClient) (ar autorest.Response, err error) {
1523	var done bool
1524	done, err = future.DoneWithContext(context.Background(), client)
1525	if err != nil {
1526		err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCompleteRestoreFuture", "Result", future.Response(), "Polling failure")
1527		return
1528	}
1529	if !done {
1530		err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCompleteRestoreFuture")
1531		return
1532	}
1533	ar.Response = future.Response()
1534	return
1535}
1536
1537// ManagedDatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
1538// long-running operation.
1539type ManagedDatabasesCreateOrUpdateFuture struct {
1540	azure.Future
1541}
1542
1543// Result returns the result of the asynchronous operation.
1544// If the operation has not completed it will return an error.
1545func (future *ManagedDatabasesCreateOrUpdateFuture) Result(client ManagedDatabasesClient) (md ManagedDatabase, err error) {
1546	var done bool
1547	done, err = future.DoneWithContext(context.Background(), client)
1548	if err != nil {
1549		err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1550		return
1551	}
1552	if !done {
1553		err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCreateOrUpdateFuture")
1554		return
1555	}
1556	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1557	if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent {
1558		md, err = client.CreateOrUpdateResponder(md.Response.Response)
1559		if err != nil {
1560			err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", md.Response.Response, "Failure responding to request")
1561		}
1562	}
1563	return
1564}
1565
1566// ManagedDatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
1567// operation.
1568type ManagedDatabasesDeleteFuture struct {
1569	azure.Future
1570}
1571
1572// Result returns the result of the asynchronous operation.
1573// If the operation has not completed it will return an error.
1574func (future *ManagedDatabasesDeleteFuture) Result(client ManagedDatabasesClient) (ar autorest.Response, err error) {
1575	var done bool
1576	done, err = future.DoneWithContext(context.Background(), client)
1577	if err != nil {
1578		err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesDeleteFuture", "Result", future.Response(), "Polling failure")
1579		return
1580	}
1581	if !done {
1582		err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesDeleteFuture")
1583		return
1584	}
1585	ar.Response = future.Response()
1586	return
1587}
1588
1589// ManagedDatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1590// operation.
1591type ManagedDatabasesUpdateFuture struct {
1592	azure.Future
1593}
1594
1595// Result returns the result of the asynchronous operation.
1596// If the operation has not completed it will return an error.
1597func (future *ManagedDatabasesUpdateFuture) Result(client ManagedDatabasesClient) (md ManagedDatabase, err error) {
1598	var done bool
1599	done, err = future.DoneWithContext(context.Background(), client)
1600	if err != nil {
1601		err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", future.Response(), "Polling failure")
1602		return
1603	}
1604	if !done {
1605		err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesUpdateFuture")
1606		return
1607	}
1608	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1609	if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent {
1610		md, err = client.UpdateResponder(md.Response.Response)
1611		if err != nil {
1612			err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", md.Response.Response, "Failure responding to request")
1613		}
1614	}
1615	return
1616}
1617
1618// ManagedDatabaseUpdate an managed database update.
1619type ManagedDatabaseUpdate struct {
1620	// ManagedDatabaseProperties - Resource properties.
1621	*ManagedDatabaseProperties `json:"properties,omitempty"`
1622	// Tags - Resource tags.
1623	Tags map[string]*string `json:"tags"`
1624}
1625
1626// MarshalJSON is the custom marshaler for ManagedDatabaseUpdate.
1627func (mdu ManagedDatabaseUpdate) MarshalJSON() ([]byte, error) {
1628	objectMap := make(map[string]interface{})
1629	if mdu.ManagedDatabaseProperties != nil {
1630		objectMap["properties"] = mdu.ManagedDatabaseProperties
1631	}
1632	if mdu.Tags != nil {
1633		objectMap["tags"] = mdu.Tags
1634	}
1635	return json.Marshal(objectMap)
1636}
1637
1638// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseUpdate struct.
1639func (mdu *ManagedDatabaseUpdate) UnmarshalJSON(body []byte) error {
1640	var m map[string]*json.RawMessage
1641	err := json.Unmarshal(body, &m)
1642	if err != nil {
1643		return err
1644	}
1645	for k, v := range m {
1646		switch k {
1647		case "properties":
1648			if v != nil {
1649				var managedDatabaseProperties ManagedDatabaseProperties
1650				err = json.Unmarshal(*v, &managedDatabaseProperties)
1651				if err != nil {
1652					return err
1653				}
1654				mdu.ManagedDatabaseProperties = &managedDatabaseProperties
1655			}
1656		case "tags":
1657			if v != nil {
1658				var tags map[string]*string
1659				err = json.Unmarshal(*v, &tags)
1660				if err != nil {
1661					return err
1662				}
1663				mdu.Tags = tags
1664			}
1665		}
1666	}
1667
1668	return nil
1669}
1670
1671// ManagedInstance an Azure SQL managed instance.
1672type ManagedInstance struct {
1673	autorest.Response `json:"-"`
1674	// Identity - The Azure Active Directory identity of the managed instance.
1675	Identity *ResourceIdentity `json:"identity,omitempty"`
1676	// Sku - Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5
1677	Sku *Sku `json:"sku,omitempty"`
1678	// ManagedInstanceProperties - Resource properties.
1679	*ManagedInstanceProperties `json:"properties,omitempty"`
1680	// Location - Resource location.
1681	Location *string `json:"location,omitempty"`
1682	// Tags - Resource tags.
1683	Tags map[string]*string `json:"tags"`
1684	// ID - READ-ONLY; Resource ID.
1685	ID *string `json:"id,omitempty"`
1686	// Name - READ-ONLY; Resource name.
1687	Name *string `json:"name,omitempty"`
1688	// Type - READ-ONLY; Resource type.
1689	Type *string `json:"type,omitempty"`
1690}
1691
1692// MarshalJSON is the custom marshaler for ManagedInstance.
1693func (mi ManagedInstance) MarshalJSON() ([]byte, error) {
1694	objectMap := make(map[string]interface{})
1695	if mi.Identity != nil {
1696		objectMap["identity"] = mi.Identity
1697	}
1698	if mi.Sku != nil {
1699		objectMap["sku"] = mi.Sku
1700	}
1701	if mi.ManagedInstanceProperties != nil {
1702		objectMap["properties"] = mi.ManagedInstanceProperties
1703	}
1704	if mi.Location != nil {
1705		objectMap["location"] = mi.Location
1706	}
1707	if mi.Tags != nil {
1708		objectMap["tags"] = mi.Tags
1709	}
1710	return json.Marshal(objectMap)
1711}
1712
1713// UnmarshalJSON is the custom unmarshaler for ManagedInstance struct.
1714func (mi *ManagedInstance) UnmarshalJSON(body []byte) error {
1715	var m map[string]*json.RawMessage
1716	err := json.Unmarshal(body, &m)
1717	if err != nil {
1718		return err
1719	}
1720	for k, v := range m {
1721		switch k {
1722		case "identity":
1723			if v != nil {
1724				var identity ResourceIdentity
1725				err = json.Unmarshal(*v, &identity)
1726				if err != nil {
1727					return err
1728				}
1729				mi.Identity = &identity
1730			}
1731		case "sku":
1732			if v != nil {
1733				var sku Sku
1734				err = json.Unmarshal(*v, &sku)
1735				if err != nil {
1736					return err
1737				}
1738				mi.Sku = &sku
1739			}
1740		case "properties":
1741			if v != nil {
1742				var managedInstanceProperties ManagedInstanceProperties
1743				err = json.Unmarshal(*v, &managedInstanceProperties)
1744				if err != nil {
1745					return err
1746				}
1747				mi.ManagedInstanceProperties = &managedInstanceProperties
1748			}
1749		case "location":
1750			if v != nil {
1751				var location string
1752				err = json.Unmarshal(*v, &location)
1753				if err != nil {
1754					return err
1755				}
1756				mi.Location = &location
1757			}
1758		case "tags":
1759			if v != nil {
1760				var tags map[string]*string
1761				err = json.Unmarshal(*v, &tags)
1762				if err != nil {
1763					return err
1764				}
1765				mi.Tags = tags
1766			}
1767		case "id":
1768			if v != nil {
1769				var ID string
1770				err = json.Unmarshal(*v, &ID)
1771				if err != nil {
1772					return err
1773				}
1774				mi.ID = &ID
1775			}
1776		case "name":
1777			if v != nil {
1778				var name string
1779				err = json.Unmarshal(*v, &name)
1780				if err != nil {
1781					return err
1782				}
1783				mi.Name = &name
1784			}
1785		case "type":
1786			if v != nil {
1787				var typeVar string
1788				err = json.Unmarshal(*v, &typeVar)
1789				if err != nil {
1790					return err
1791				}
1792				mi.Type = &typeVar
1793			}
1794		}
1795	}
1796
1797	return nil
1798}
1799
1800// ManagedInstanceListResult a list of managed instances.
1801type ManagedInstanceListResult struct {
1802	autorest.Response `json:"-"`
1803	// Value - READ-ONLY; Array of results.
1804	Value *[]ManagedInstance `json:"value,omitempty"`
1805	// NextLink - READ-ONLY; Link to retrieve next page of results.
1806	NextLink *string `json:"nextLink,omitempty"`
1807}
1808
1809// ManagedInstanceListResultIterator provides access to a complete listing of ManagedInstance values.
1810type ManagedInstanceListResultIterator struct {
1811	i    int
1812	page ManagedInstanceListResultPage
1813}
1814
1815// NextWithContext advances to the next value.  If there was an error making
1816// the request the iterator does not advance and the error is returned.
1817func (iter *ManagedInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) {
1818	if tracing.IsEnabled() {
1819		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultIterator.NextWithContext")
1820		defer func() {
1821			sc := -1
1822			if iter.Response().Response.Response != nil {
1823				sc = iter.Response().Response.Response.StatusCode
1824			}
1825			tracing.EndSpan(ctx, sc, err)
1826		}()
1827	}
1828	iter.i++
1829	if iter.i < len(iter.page.Values()) {
1830		return nil
1831	}
1832	err = iter.page.NextWithContext(ctx)
1833	if err != nil {
1834		iter.i--
1835		return err
1836	}
1837	iter.i = 0
1838	return nil
1839}
1840
1841// Next advances to the next value.  If there was an error making
1842// the request the iterator does not advance and the error is returned.
1843// Deprecated: Use NextWithContext() instead.
1844func (iter *ManagedInstanceListResultIterator) Next() error {
1845	return iter.NextWithContext(context.Background())
1846}
1847
1848// NotDone returns true if the enumeration should be started or is not yet complete.
1849func (iter ManagedInstanceListResultIterator) NotDone() bool {
1850	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1851}
1852
1853// Response returns the raw server response from the last page request.
1854func (iter ManagedInstanceListResultIterator) Response() ManagedInstanceListResult {
1855	return iter.page.Response()
1856}
1857
1858// Value returns the current value or a zero-initialized value if the
1859// iterator has advanced beyond the end of the collection.
1860func (iter ManagedInstanceListResultIterator) Value() ManagedInstance {
1861	if !iter.page.NotDone() {
1862		return ManagedInstance{}
1863	}
1864	return iter.page.Values()[iter.i]
1865}
1866
1867// Creates a new instance of the ManagedInstanceListResultIterator type.
1868func NewManagedInstanceListResultIterator(page ManagedInstanceListResultPage) ManagedInstanceListResultIterator {
1869	return ManagedInstanceListResultIterator{page: page}
1870}
1871
1872// IsEmpty returns true if the ListResult contains no values.
1873func (milr ManagedInstanceListResult) IsEmpty() bool {
1874	return milr.Value == nil || len(*milr.Value) == 0
1875}
1876
1877// managedInstanceListResultPreparer prepares a request to retrieve the next set of results.
1878// It returns nil if no more results exist.
1879func (milr ManagedInstanceListResult) managedInstanceListResultPreparer(ctx context.Context) (*http.Request, error) {
1880	if milr.NextLink == nil || len(to.String(milr.NextLink)) < 1 {
1881		return nil, nil
1882	}
1883	return autorest.Prepare((&http.Request{}).WithContext(ctx),
1884		autorest.AsJSON(),
1885		autorest.AsGet(),
1886		autorest.WithBaseURL(to.String(milr.NextLink)))
1887}
1888
1889// ManagedInstanceListResultPage contains a page of ManagedInstance values.
1890type ManagedInstanceListResultPage struct {
1891	fn   func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error)
1892	milr ManagedInstanceListResult
1893}
1894
1895// NextWithContext advances to the next page of values.  If there was an error making
1896// the request the page does not advance and the error is returned.
1897func (page *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) (err error) {
1898	if tracing.IsEnabled() {
1899		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultPage.NextWithContext")
1900		defer func() {
1901			sc := -1
1902			if page.Response().Response.Response != nil {
1903				sc = page.Response().Response.Response.StatusCode
1904			}
1905			tracing.EndSpan(ctx, sc, err)
1906		}()
1907	}
1908	next, err := page.fn(ctx, page.milr)
1909	if err != nil {
1910		return err
1911	}
1912	page.milr = next
1913	return nil
1914}
1915
1916// Next advances to the next page of values.  If there was an error making
1917// the request the page does not advance and the error is returned.
1918// Deprecated: Use NextWithContext() instead.
1919func (page *ManagedInstanceListResultPage) Next() error {
1920	return page.NextWithContext(context.Background())
1921}
1922
1923// NotDone returns true if the page enumeration should be started or is not yet complete.
1924func (page ManagedInstanceListResultPage) NotDone() bool {
1925	return !page.milr.IsEmpty()
1926}
1927
1928// Response returns the raw server response from the last page request.
1929func (page ManagedInstanceListResultPage) Response() ManagedInstanceListResult {
1930	return page.milr
1931}
1932
1933// Values returns the slice of values for the current page or nil if there are no values.
1934func (page ManagedInstanceListResultPage) Values() []ManagedInstance {
1935	if page.milr.IsEmpty() {
1936		return nil
1937	}
1938	return *page.milr.Value
1939}
1940
1941// Creates a new instance of the ManagedInstanceListResultPage type.
1942func NewManagedInstanceListResultPage(getNextPage func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error)) ManagedInstanceListResultPage {
1943	return ManagedInstanceListResultPage{fn: getNextPage}
1944}
1945
1946// ManagedInstanceLongTermRetentionBackup a long term retention backup for a managed database.
1947type ManagedInstanceLongTermRetentionBackup struct {
1948	autorest.Response `json:"-"`
1949	// ManagedInstanceLongTermRetentionBackupProperties - Resource properties.
1950	*ManagedInstanceLongTermRetentionBackupProperties `json:"properties,omitempty"`
1951	// ID - READ-ONLY; Resource ID.
1952	ID *string `json:"id,omitempty"`
1953	// Name - READ-ONLY; Resource name.
1954	Name *string `json:"name,omitempty"`
1955	// Type - READ-ONLY; Resource type.
1956	Type *string `json:"type,omitempty"`
1957}
1958
1959// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackup.
1960func (miltrb ManagedInstanceLongTermRetentionBackup) MarshalJSON() ([]byte, error) {
1961	objectMap := make(map[string]interface{})
1962	if miltrb.ManagedInstanceLongTermRetentionBackupProperties != nil {
1963		objectMap["properties"] = miltrb.ManagedInstanceLongTermRetentionBackupProperties
1964	}
1965	return json.Marshal(objectMap)
1966}
1967
1968// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionBackup struct.
1969func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) error {
1970	var m map[string]*json.RawMessage
1971	err := json.Unmarshal(body, &m)
1972	if err != nil {
1973		return err
1974	}
1975	for k, v := range m {
1976		switch k {
1977		case "properties":
1978			if v != nil {
1979				var managedInstanceLongTermRetentionBackupProperties ManagedInstanceLongTermRetentionBackupProperties
1980				err = json.Unmarshal(*v, &managedInstanceLongTermRetentionBackupProperties)
1981				if err != nil {
1982					return err
1983				}
1984				miltrb.ManagedInstanceLongTermRetentionBackupProperties = &managedInstanceLongTermRetentionBackupProperties
1985			}
1986		case "id":
1987			if v != nil {
1988				var ID string
1989				err = json.Unmarshal(*v, &ID)
1990				if err != nil {
1991					return err
1992				}
1993				miltrb.ID = &ID
1994			}
1995		case "name":
1996			if v != nil {
1997				var name string
1998				err = json.Unmarshal(*v, &name)
1999				if err != nil {
2000					return err
2001				}
2002				miltrb.Name = &name
2003			}
2004		case "type":
2005			if v != nil {
2006				var typeVar string
2007				err = json.Unmarshal(*v, &typeVar)
2008				if err != nil {
2009					return err
2010				}
2011				miltrb.Type = &typeVar
2012			}
2013		}
2014	}
2015
2016	return nil
2017}
2018
2019// ManagedInstanceLongTermRetentionBackupListResult a list of long term retention backups for managed
2020// database(s).
2021type ManagedInstanceLongTermRetentionBackupListResult struct {
2022	autorest.Response `json:"-"`
2023	// Value - READ-ONLY; Array of results.
2024	Value *[]ManagedInstanceLongTermRetentionBackup `json:"value,omitempty"`
2025	// NextLink - READ-ONLY; Link to retrieve next page of results.
2026	NextLink *string `json:"nextLink,omitempty"`
2027}
2028
2029// ManagedInstanceLongTermRetentionBackupListResultIterator provides access to a complete listing of
2030// ManagedInstanceLongTermRetentionBackup values.
2031type ManagedInstanceLongTermRetentionBackupListResultIterator struct {
2032	i    int
2033	page ManagedInstanceLongTermRetentionBackupListResultPage
2034}
2035
2036// NextWithContext advances to the next value.  If there was an error making
2037// the request the iterator does not advance and the error is returned.
2038func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) {
2039	if tracing.IsEnabled() {
2040		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultIterator.NextWithContext")
2041		defer func() {
2042			sc := -1
2043			if iter.Response().Response.Response != nil {
2044				sc = iter.Response().Response.Response.StatusCode
2045			}
2046			tracing.EndSpan(ctx, sc, err)
2047		}()
2048	}
2049	iter.i++
2050	if iter.i < len(iter.page.Values()) {
2051		return nil
2052	}
2053	err = iter.page.NextWithContext(ctx)
2054	if err != nil {
2055		iter.i--
2056		return err
2057	}
2058	iter.i = 0
2059	return nil
2060}
2061
2062// Next advances to the next value.  If there was an error making
2063// the request the iterator does not advance and the error is returned.
2064// Deprecated: Use NextWithContext() instead.
2065func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) Next() error {
2066	return iter.NextWithContext(context.Background())
2067}
2068
2069// NotDone returns true if the enumeration should be started or is not yet complete.
2070func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) NotDone() bool {
2071	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2072}
2073
2074// Response returns the raw server response from the last page request.
2075func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) Response() ManagedInstanceLongTermRetentionBackupListResult {
2076	return iter.page.Response()
2077}
2078
2079// Value returns the current value or a zero-initialized value if the
2080// iterator has advanced beyond the end of the collection.
2081func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) Value() ManagedInstanceLongTermRetentionBackup {
2082	if !iter.page.NotDone() {
2083		return ManagedInstanceLongTermRetentionBackup{}
2084	}
2085	return iter.page.Values()[iter.i]
2086}
2087
2088// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultIterator type.
2089func NewManagedInstanceLongTermRetentionBackupListResultIterator(page ManagedInstanceLongTermRetentionBackupListResultPage) ManagedInstanceLongTermRetentionBackupListResultIterator {
2090	return ManagedInstanceLongTermRetentionBackupListResultIterator{page: page}
2091}
2092
2093// IsEmpty returns true if the ListResult contains no values.
2094func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) IsEmpty() bool {
2095	return miltrblr.Value == nil || len(*miltrblr.Value) == 0
2096}
2097
2098// managedInstanceLongTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results.
2099// It returns nil if no more results exist.
2100func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) managedInstanceLongTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) {
2101	if miltrblr.NextLink == nil || len(to.String(miltrblr.NextLink)) < 1 {
2102		return nil, nil
2103	}
2104	return autorest.Prepare((&http.Request{}).WithContext(ctx),
2105		autorest.AsJSON(),
2106		autorest.AsGet(),
2107		autorest.WithBaseURL(to.String(miltrblr.NextLink)))
2108}
2109
2110// ManagedInstanceLongTermRetentionBackupListResultPage contains a page of
2111// ManagedInstanceLongTermRetentionBackup values.
2112type ManagedInstanceLongTermRetentionBackupListResultPage struct {
2113	fn       func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error)
2114	miltrblr ManagedInstanceLongTermRetentionBackupListResult
2115}
2116
2117// NextWithContext advances to the next page of values.  If there was an error making
2118// the request the page does not advance and the error is returned.
2119func (page *ManagedInstanceLongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) {
2120	if tracing.IsEnabled() {
2121		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultPage.NextWithContext")
2122		defer func() {
2123			sc := -1
2124			if page.Response().Response.Response != nil {
2125				sc = page.Response().Response.Response.StatusCode
2126			}
2127			tracing.EndSpan(ctx, sc, err)
2128		}()
2129	}
2130	next, err := page.fn(ctx, page.miltrblr)
2131	if err != nil {
2132		return err
2133	}
2134	page.miltrblr = next
2135	return nil
2136}
2137
2138// Next advances to the next page of values.  If there was an error making
2139// the request the page does not advance and the error is returned.
2140// Deprecated: Use NextWithContext() instead.
2141func (page *ManagedInstanceLongTermRetentionBackupListResultPage) Next() error {
2142	return page.NextWithContext(context.Background())
2143}
2144
2145// NotDone returns true if the page enumeration should be started or is not yet complete.
2146func (page ManagedInstanceLongTermRetentionBackupListResultPage) NotDone() bool {
2147	return !page.miltrblr.IsEmpty()
2148}
2149
2150// Response returns the raw server response from the last page request.
2151func (page ManagedInstanceLongTermRetentionBackupListResultPage) Response() ManagedInstanceLongTermRetentionBackupListResult {
2152	return page.miltrblr
2153}
2154
2155// Values returns the slice of values for the current page or nil if there are no values.
2156func (page ManagedInstanceLongTermRetentionBackupListResultPage) Values() []ManagedInstanceLongTermRetentionBackup {
2157	if page.miltrblr.IsEmpty() {
2158		return nil
2159	}
2160	return *page.miltrblr.Value
2161}
2162
2163// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultPage type.
2164func NewManagedInstanceLongTermRetentionBackupListResultPage(getNextPage func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error)) ManagedInstanceLongTermRetentionBackupListResultPage {
2165	return ManagedInstanceLongTermRetentionBackupListResultPage{fn: getNextPage}
2166}
2167
2168// ManagedInstanceLongTermRetentionBackupProperties properties of a long term retention backup
2169type ManagedInstanceLongTermRetentionBackupProperties struct {
2170	// ManagedInstanceName - READ-ONLY; The managed instance that the backup database belongs to.
2171	ManagedInstanceName *string `json:"managedInstanceName,omitempty"`
2172	// ManagedInstanceCreateTime - READ-ONLY; The create time of the instance.
2173	ManagedInstanceCreateTime *date.Time `json:"managedInstanceCreateTime,omitempty"`
2174	// DatabaseName - READ-ONLY; The name of the database the backup belong to
2175	DatabaseName *string `json:"databaseName,omitempty"`
2176	// DatabaseDeletionTime - READ-ONLY; The delete time of the database
2177	DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"`
2178	// BackupTime - READ-ONLY; The time the backup was taken
2179	BackupTime *date.Time `json:"backupTime,omitempty"`
2180	// BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire.
2181	BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"`
2182}
2183
2184// ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and
2185// retrieving the results of a long-running operation.
2186type ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture struct {
2187	azure.Future
2188}
2189
2190// Result returns the result of the asynchronous operation.
2191// If the operation has not completed it will return an error.
2192func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) Result(client ManagedInstanceLongTermRetentionPoliciesClient) (miltrp ManagedInstanceLongTermRetentionPolicy, err error) {
2193	var done bool
2194	done, err = future.DoneWithContext(context.Background(), client)
2195	if err != nil {
2196		err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
2197		return
2198	}
2199	if !done {
2200		err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture")
2201		return
2202	}
2203	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2204	if miltrp.Response.Response, err = future.GetResult(sender); err == nil && miltrp.Response.Response.StatusCode != http.StatusNoContent {
2205		miltrp, err = client.CreateOrUpdateResponder(miltrp.Response.Response)
2206		if err != nil {
2207			err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", miltrp.Response.Response, "Failure responding to request")
2208		}
2209	}
2210	return
2211}
2212
2213// ManagedInstanceLongTermRetentionPolicy a long term retention policy.
2214type ManagedInstanceLongTermRetentionPolicy struct {
2215	autorest.Response `json:"-"`
2216	// BaseLongTermRetentionPolicyProperties - Resource properties.
2217	*BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"`
2218	// ID - READ-ONLY; Resource ID.
2219	ID *string `json:"id,omitempty"`
2220	// Name - READ-ONLY; Resource name.
2221	Name *string `json:"name,omitempty"`
2222	// Type - READ-ONLY; Resource type.
2223	Type *string `json:"type,omitempty"`
2224}
2225
2226// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicy.
2227func (miltrp ManagedInstanceLongTermRetentionPolicy) MarshalJSON() ([]byte, error) {
2228	objectMap := make(map[string]interface{})
2229	if miltrp.BaseLongTermRetentionPolicyProperties != nil {
2230		objectMap["properties"] = miltrp.BaseLongTermRetentionPolicyProperties
2231	}
2232	return json.Marshal(objectMap)
2233}
2234
2235// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionPolicy struct.
2236func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) error {
2237	var m map[string]*json.RawMessage
2238	err := json.Unmarshal(body, &m)
2239	if err != nil {
2240		return err
2241	}
2242	for k, v := range m {
2243		switch k {
2244		case "properties":
2245			if v != nil {
2246				var baseLongTermRetentionPolicyProperties BaseLongTermRetentionPolicyProperties
2247				err = json.Unmarshal(*v, &baseLongTermRetentionPolicyProperties)
2248				if err != nil {
2249					return err
2250				}
2251				miltrp.BaseLongTermRetentionPolicyProperties = &baseLongTermRetentionPolicyProperties
2252			}
2253		case "id":
2254			if v != nil {
2255				var ID string
2256				err = json.Unmarshal(*v, &ID)
2257				if err != nil {
2258					return err
2259				}
2260				miltrp.ID = &ID
2261			}
2262		case "name":
2263			if v != nil {
2264				var name string
2265				err = json.Unmarshal(*v, &name)
2266				if err != nil {
2267					return err
2268				}
2269				miltrp.Name = &name
2270			}
2271		case "type":
2272			if v != nil {
2273				var typeVar string
2274				err = json.Unmarshal(*v, &typeVar)
2275				if err != nil {
2276					return err
2277				}
2278				miltrp.Type = &typeVar
2279			}
2280		}
2281	}
2282
2283	return nil
2284}
2285
2286// ManagedInstanceLongTermRetentionPolicyListResult a list of long term retention policies.
2287type ManagedInstanceLongTermRetentionPolicyListResult struct {
2288	autorest.Response `json:"-"`
2289	// Value - READ-ONLY; Array of results.
2290	Value *[]ManagedInstanceLongTermRetentionPolicy `json:"value,omitempty"`
2291	// NextLink - READ-ONLY; Link to retrieve next page of results.
2292	NextLink *string `json:"nextLink,omitempty"`
2293}
2294
2295// ManagedInstanceLongTermRetentionPolicyListResultIterator provides access to a complete listing of
2296// ManagedInstanceLongTermRetentionPolicy values.
2297type ManagedInstanceLongTermRetentionPolicyListResultIterator struct {
2298	i    int
2299	page ManagedInstanceLongTermRetentionPolicyListResultPage
2300}
2301
2302// NextWithContext advances to the next value.  If there was an error making
2303// the request the iterator does not advance and the error is returned.
2304func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) {
2305	if tracing.IsEnabled() {
2306		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultIterator.NextWithContext")
2307		defer func() {
2308			sc := -1
2309			if iter.Response().Response.Response != nil {
2310				sc = iter.Response().Response.Response.StatusCode
2311			}
2312			tracing.EndSpan(ctx, sc, err)
2313		}()
2314	}
2315	iter.i++
2316	if iter.i < len(iter.page.Values()) {
2317		return nil
2318	}
2319	err = iter.page.NextWithContext(ctx)
2320	if err != nil {
2321		iter.i--
2322		return err
2323	}
2324	iter.i = 0
2325	return nil
2326}
2327
2328// Next advances to the next value.  If there was an error making
2329// the request the iterator does not advance and the error is returned.
2330// Deprecated: Use NextWithContext() instead.
2331func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) Next() error {
2332	return iter.NextWithContext(context.Background())
2333}
2334
2335// NotDone returns true if the enumeration should be started or is not yet complete.
2336func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) NotDone() bool {
2337	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2338}
2339
2340// Response returns the raw server response from the last page request.
2341func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) Response() ManagedInstanceLongTermRetentionPolicyListResult {
2342	return iter.page.Response()
2343}
2344
2345// Value returns the current value or a zero-initialized value if the
2346// iterator has advanced beyond the end of the collection.
2347func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) Value() ManagedInstanceLongTermRetentionPolicy {
2348	if !iter.page.NotDone() {
2349		return ManagedInstanceLongTermRetentionPolicy{}
2350	}
2351	return iter.page.Values()[iter.i]
2352}
2353
2354// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultIterator type.
2355func NewManagedInstanceLongTermRetentionPolicyListResultIterator(page ManagedInstanceLongTermRetentionPolicyListResultPage) ManagedInstanceLongTermRetentionPolicyListResultIterator {
2356	return ManagedInstanceLongTermRetentionPolicyListResultIterator{page: page}
2357}
2358
2359// IsEmpty returns true if the ListResult contains no values.
2360func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) IsEmpty() bool {
2361	return miltrplr.Value == nil || len(*miltrplr.Value) == 0
2362}
2363
2364// managedInstanceLongTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results.
2365// It returns nil if no more results exist.
2366func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) managedInstanceLongTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) {
2367	if miltrplr.NextLink == nil || len(to.String(miltrplr.NextLink)) < 1 {
2368		return nil, nil
2369	}
2370	return autorest.Prepare((&http.Request{}).WithContext(ctx),
2371		autorest.AsJSON(),
2372		autorest.AsGet(),
2373		autorest.WithBaseURL(to.String(miltrplr.NextLink)))
2374}
2375
2376// ManagedInstanceLongTermRetentionPolicyListResultPage contains a page of
2377// ManagedInstanceLongTermRetentionPolicy values.
2378type ManagedInstanceLongTermRetentionPolicyListResultPage struct {
2379	fn       func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error)
2380	miltrplr ManagedInstanceLongTermRetentionPolicyListResult
2381}
2382
2383// NextWithContext advances to the next page of values.  If there was an error making
2384// the request the page does not advance and the error is returned.
2385func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) {
2386	if tracing.IsEnabled() {
2387		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultPage.NextWithContext")
2388		defer func() {
2389			sc := -1
2390			if page.Response().Response.Response != nil {
2391				sc = page.Response().Response.Response.StatusCode
2392			}
2393			tracing.EndSpan(ctx, sc, err)
2394		}()
2395	}
2396	next, err := page.fn(ctx, page.miltrplr)
2397	if err != nil {
2398		return err
2399	}
2400	page.miltrplr = next
2401	return nil
2402}
2403
2404// Next advances to the next page of values.  If there was an error making
2405// the request the page does not advance and the error is returned.
2406// Deprecated: Use NextWithContext() instead.
2407func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) Next() error {
2408	return page.NextWithContext(context.Background())
2409}
2410
2411// NotDone returns true if the page enumeration should be started or is not yet complete.
2412func (page ManagedInstanceLongTermRetentionPolicyListResultPage) NotDone() bool {
2413	return !page.miltrplr.IsEmpty()
2414}
2415
2416// Response returns the raw server response from the last page request.
2417func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Response() ManagedInstanceLongTermRetentionPolicyListResult {
2418	return page.miltrplr
2419}
2420
2421// Values returns the slice of values for the current page or nil if there are no values.
2422func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Values() []ManagedInstanceLongTermRetentionPolicy {
2423	if page.miltrplr.IsEmpty() {
2424		return nil
2425	}
2426	return *page.miltrplr.Value
2427}
2428
2429// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultPage type.
2430func NewManagedInstanceLongTermRetentionPolicyListResultPage(getNextPage func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error)) ManagedInstanceLongTermRetentionPolicyListResultPage {
2431	return ManagedInstanceLongTermRetentionPolicyListResultPage{fn: getNextPage}
2432}
2433
2434// ManagedInstanceOperation a managed instance operation.
2435type ManagedInstanceOperation struct {
2436	autorest.Response `json:"-"`
2437	// ManagedInstanceOperationProperties - Resource properties.
2438	*ManagedInstanceOperationProperties `json:"properties,omitempty"`
2439	// ID - READ-ONLY; Resource ID.
2440	ID *string `json:"id,omitempty"`
2441	// Name - READ-ONLY; Resource name.
2442	Name *string `json:"name,omitempty"`
2443	// Type - READ-ONLY; Resource type.
2444	Type *string `json:"type,omitempty"`
2445}
2446
2447// MarshalJSON is the custom marshaler for ManagedInstanceOperation.
2448func (mio ManagedInstanceOperation) MarshalJSON() ([]byte, error) {
2449	objectMap := make(map[string]interface{})
2450	if mio.ManagedInstanceOperationProperties != nil {
2451		objectMap["properties"] = mio.ManagedInstanceOperationProperties
2452	}
2453	return json.Marshal(objectMap)
2454}
2455
2456// UnmarshalJSON is the custom unmarshaler for ManagedInstanceOperation struct.
2457func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error {
2458	var m map[string]*json.RawMessage
2459	err := json.Unmarshal(body, &m)
2460	if err != nil {
2461		return err
2462	}
2463	for k, v := range m {
2464		switch k {
2465		case "properties":
2466			if v != nil {
2467				var managedInstanceOperationProperties ManagedInstanceOperationProperties
2468				err = json.Unmarshal(*v, &managedInstanceOperationProperties)
2469				if err != nil {
2470					return err
2471				}
2472				mio.ManagedInstanceOperationProperties = &managedInstanceOperationProperties
2473			}
2474		case "id":
2475			if v != nil {
2476				var ID string
2477				err = json.Unmarshal(*v, &ID)
2478				if err != nil {
2479					return err
2480				}
2481				mio.ID = &ID
2482			}
2483		case "name":
2484			if v != nil {
2485				var name string
2486				err = json.Unmarshal(*v, &name)
2487				if err != nil {
2488					return err
2489				}
2490				mio.Name = &name
2491			}
2492		case "type":
2493			if v != nil {
2494				var typeVar string
2495				err = json.Unmarshal(*v, &typeVar)
2496				if err != nil {
2497					return err
2498				}
2499				mio.Type = &typeVar
2500			}
2501		}
2502	}
2503
2504	return nil
2505}
2506
2507// ManagedInstanceOperationListResult the response to a list managed instance operations request
2508type ManagedInstanceOperationListResult struct {
2509	autorest.Response `json:"-"`
2510	// Value - READ-ONLY; Array of results.
2511	Value *[]ManagedInstanceOperation `json:"value,omitempty"`
2512	// NextLink - READ-ONLY; Link to retrieve next page of results.
2513	NextLink *string `json:"nextLink,omitempty"`
2514}
2515
2516// ManagedInstanceOperationListResultIterator provides access to a complete listing of
2517// ManagedInstanceOperation values.
2518type ManagedInstanceOperationListResultIterator struct {
2519	i    int
2520	page ManagedInstanceOperationListResultPage
2521}
2522
2523// NextWithContext advances to the next value.  If there was an error making
2524// the request the iterator does not advance and the error is returned.
2525func (iter *ManagedInstanceOperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
2526	if tracing.IsEnabled() {
2527		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultIterator.NextWithContext")
2528		defer func() {
2529			sc := -1
2530			if iter.Response().Response.Response != nil {
2531				sc = iter.Response().Response.Response.StatusCode
2532			}
2533			tracing.EndSpan(ctx, sc, err)
2534		}()
2535	}
2536	iter.i++
2537	if iter.i < len(iter.page.Values()) {
2538		return nil
2539	}
2540	err = iter.page.NextWithContext(ctx)
2541	if err != nil {
2542		iter.i--
2543		return err
2544	}
2545	iter.i = 0
2546	return nil
2547}
2548
2549// Next advances to the next value.  If there was an error making
2550// the request the iterator does not advance and the error is returned.
2551// Deprecated: Use NextWithContext() instead.
2552func (iter *ManagedInstanceOperationListResultIterator) Next() error {
2553	return iter.NextWithContext(context.Background())
2554}
2555
2556// NotDone returns true if the enumeration should be started or is not yet complete.
2557func (iter ManagedInstanceOperationListResultIterator) NotDone() bool {
2558	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2559}
2560
2561// Response returns the raw server response from the last page request.
2562func (iter ManagedInstanceOperationListResultIterator) Response() ManagedInstanceOperationListResult {
2563	return iter.page.Response()
2564}
2565
2566// Value returns the current value or a zero-initialized value if the
2567// iterator has advanced beyond the end of the collection.
2568func (iter ManagedInstanceOperationListResultIterator) Value() ManagedInstanceOperation {
2569	if !iter.page.NotDone() {
2570		return ManagedInstanceOperation{}
2571	}
2572	return iter.page.Values()[iter.i]
2573}
2574
2575// Creates a new instance of the ManagedInstanceOperationListResultIterator type.
2576func NewManagedInstanceOperationListResultIterator(page ManagedInstanceOperationListResultPage) ManagedInstanceOperationListResultIterator {
2577	return ManagedInstanceOperationListResultIterator{page: page}
2578}
2579
2580// IsEmpty returns true if the ListResult contains no values.
2581func (miolr ManagedInstanceOperationListResult) IsEmpty() bool {
2582	return miolr.Value == nil || len(*miolr.Value) == 0
2583}
2584
2585// managedInstanceOperationListResultPreparer prepares a request to retrieve the next set of results.
2586// It returns nil if no more results exist.
2587func (miolr ManagedInstanceOperationListResult) managedInstanceOperationListResultPreparer(ctx context.Context) (*http.Request, error) {
2588	if miolr.NextLink == nil || len(to.String(miolr.NextLink)) < 1 {
2589		return nil, nil
2590	}
2591	return autorest.Prepare((&http.Request{}).WithContext(ctx),
2592		autorest.AsJSON(),
2593		autorest.AsGet(),
2594		autorest.WithBaseURL(to.String(miolr.NextLink)))
2595}
2596
2597// ManagedInstanceOperationListResultPage contains a page of ManagedInstanceOperation values.
2598type ManagedInstanceOperationListResultPage struct {
2599	fn    func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error)
2600	miolr ManagedInstanceOperationListResult
2601}
2602
2603// NextWithContext advances to the next page of values.  If there was an error making
2604// the request the page does not advance and the error is returned.
2605func (page *ManagedInstanceOperationListResultPage) NextWithContext(ctx context.Context) (err error) {
2606	if tracing.IsEnabled() {
2607		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultPage.NextWithContext")
2608		defer func() {
2609			sc := -1
2610			if page.Response().Response.Response != nil {
2611				sc = page.Response().Response.Response.StatusCode
2612			}
2613			tracing.EndSpan(ctx, sc, err)
2614		}()
2615	}
2616	next, err := page.fn(ctx, page.miolr)
2617	if err != nil {
2618		return err
2619	}
2620	page.miolr = next
2621	return nil
2622}
2623
2624// Next advances to the next page of values.  If there was an error making
2625// the request the page does not advance and the error is returned.
2626// Deprecated: Use NextWithContext() instead.
2627func (page *ManagedInstanceOperationListResultPage) Next() error {
2628	return page.NextWithContext(context.Background())
2629}
2630
2631// NotDone returns true if the page enumeration should be started or is not yet complete.
2632func (page ManagedInstanceOperationListResultPage) NotDone() bool {
2633	return !page.miolr.IsEmpty()
2634}
2635
2636// Response returns the raw server response from the last page request.
2637func (page ManagedInstanceOperationListResultPage) Response() ManagedInstanceOperationListResult {
2638	return page.miolr
2639}
2640
2641// Values returns the slice of values for the current page or nil if there are no values.
2642func (page ManagedInstanceOperationListResultPage) Values() []ManagedInstanceOperation {
2643	if page.miolr.IsEmpty() {
2644		return nil
2645	}
2646	return *page.miolr.Value
2647}
2648
2649// Creates a new instance of the ManagedInstanceOperationListResultPage type.
2650func NewManagedInstanceOperationListResultPage(getNextPage func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error)) ManagedInstanceOperationListResultPage {
2651	return ManagedInstanceOperationListResultPage{fn: getNextPage}
2652}
2653
2654// ManagedInstanceOperationProperties the properties of a managed instance operation.
2655type ManagedInstanceOperationProperties struct {
2656	// ManagedInstanceName - READ-ONLY; The name of the managed instance the operation is being performed on.
2657	ManagedInstanceName *string `json:"managedInstanceName,omitempty"`
2658	// Operation - READ-ONLY; The name of operation.
2659	Operation *string `json:"operation,omitempty"`
2660	// OperationFriendlyName - READ-ONLY; The friendly name of operation.
2661	OperationFriendlyName *string `json:"operationFriendlyName,omitempty"`
2662	// PercentComplete - READ-ONLY; The percentage of the operation completed.
2663	PercentComplete *int32 `json:"percentComplete,omitempty"`
2664	// StartTime - READ-ONLY; The operation start time.
2665	StartTime *date.Time `json:"startTime,omitempty"`
2666	// State - READ-ONLY; The operation state. Possible values include: 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled'
2667	State ManagementOperationState `json:"state,omitempty"`
2668	// ErrorCode - READ-ONLY; The operation error code.
2669	ErrorCode *int32 `json:"errorCode,omitempty"`
2670	// ErrorDescription - READ-ONLY; The operation error description.
2671	ErrorDescription *string `json:"errorDescription,omitempty"`
2672	// ErrorSeverity - READ-ONLY; The operation error severity.
2673	ErrorSeverity *int32 `json:"errorSeverity,omitempty"`
2674	// IsUserError - READ-ONLY; Whether or not the error is a user error.
2675	IsUserError *bool `json:"isUserError,omitempty"`
2676	// EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation.
2677	EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"`
2678	// Description - READ-ONLY; The operation description.
2679	Description *string `json:"description,omitempty"`
2680	// IsCancellable - READ-ONLY; Whether the operation can be cancelled.
2681	IsCancellable *bool `json:"isCancellable,omitempty"`
2682}
2683
2684// ManagedInstanceProperties the properties of a managed instance.
2685type ManagedInstanceProperties struct {
2686	// ManagedInstanceCreateMode - Specifies the mode of database creation.
2687	//
2688	// Default: Regular instance creation.
2689	//
2690	// Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'ManagedServerCreateModeDefault', 'ManagedServerCreateModePointInTimeRestore'
2691	ManagedInstanceCreateMode ManagedServerCreateMode `json:"managedInstanceCreateMode,omitempty"`
2692	// FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the managed instance.
2693	FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
2694	// AdministratorLogin - Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation).
2695	AdministratorLogin *string `json:"administratorLogin,omitempty"`
2696	// AdministratorLoginPassword - The administrator login password (required for managed instance creation).
2697	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`
2698	// SubnetID - Subnet resource ID for the managed instance.
2699	SubnetID *string `json:"subnetId,omitempty"`
2700	// State - READ-ONLY; The state of the managed instance.
2701	State *string `json:"state,omitempty"`
2702	// LicenseType - The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'ManagedInstanceLicenseTypeLicenseIncluded', 'ManagedInstanceLicenseTypeBasePrice'
2703	LicenseType ManagedInstanceLicenseType `json:"licenseType,omitempty"`
2704	// VCores - The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.
2705	VCores *int32 `json:"vCores,omitempty"`
2706	// StorageSizeInGB - Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only.
2707	StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"`
2708	// Collation - Collation of the managed instance.
2709	Collation *string `json:"collation,omitempty"`
2710	// DNSZone - READ-ONLY; The Dns Zone that the managed instance is in.
2711	DNSZone *string `json:"dnsZone,omitempty"`
2712	// DNSZonePartner - The resource id of another managed instance whose DNS zone this managed instance will share after creation.
2713	DNSZonePartner *string `json:"dnsZonePartner,omitempty"`
2714	// PublicDataEndpointEnabled - Whether or not the public data endpoint is enabled.
2715	PublicDataEndpointEnabled *bool `json:"publicDataEndpointEnabled,omitempty"`
2716	// SourceManagedInstanceID - The resource identifier of the source managed instance associated with create operation of this instance.
2717	SourceManagedInstanceID *string `json:"sourceManagedInstanceId,omitempty"`
2718	// RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.
2719	RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"`
2720	// ProxyOverride - Connection type used for connecting to the instance. Possible values include: 'ManagedInstanceProxyOverrideProxy', 'ManagedInstanceProxyOverrideRedirect', 'ManagedInstanceProxyOverrideDefault'
2721	ProxyOverride ManagedInstanceProxyOverride `json:"proxyOverride,omitempty"`
2722	// TimezoneID - Id of the timezone. Allowed values are timezones supported by Windows.
2723	// Windows keeps details on supported timezones, including the id, in registry under
2724	// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
2725	// You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info.
2726	// List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell.
2727	// An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time".
2728	TimezoneID *string `json:"timezoneId,omitempty"`
2729	// InstancePoolID - The Id of the instance pool this managed server belongs to.
2730	InstancePoolID *string `json:"instancePoolId,omitempty"`
2731	// MaintenanceConfigurationID - Specifies maintenance configuration id to apply to this managed instance.
2732	MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"`
2733	// MinimalTLSVersion - Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'
2734	MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"`
2735}
2736
2737// ManagedInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
2738// long-running operation.
2739type ManagedInstancesCreateOrUpdateFuture struct {
2740	azure.Future
2741}
2742
2743// Result returns the result of the asynchronous operation.
2744// If the operation has not completed it will return an error.
2745func (future *ManagedInstancesCreateOrUpdateFuture) Result(client ManagedInstancesClient) (mi ManagedInstance, err error) {
2746	var done bool
2747	done, err = future.DoneWithContext(context.Background(), client)
2748	if err != nil {
2749		err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
2750		return
2751	}
2752	if !done {
2753		err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesCreateOrUpdateFuture")
2754		return
2755	}
2756	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2757	if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent {
2758		mi, err = client.CreateOrUpdateResponder(mi.Response.Response)
2759		if err != nil {
2760			err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", mi.Response.Response, "Failure responding to request")
2761		}
2762	}
2763	return
2764}
2765
2766// ManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
2767// operation.
2768type ManagedInstancesDeleteFuture struct {
2769	azure.Future
2770}
2771
2772// Result returns the result of the asynchronous operation.
2773// If the operation has not completed it will return an error.
2774func (future *ManagedInstancesDeleteFuture) Result(client ManagedInstancesClient) (ar autorest.Response, err error) {
2775	var done bool
2776	done, err = future.DoneWithContext(context.Background(), client)
2777	if err != nil {
2778		err = autorest.NewErrorWithError(err, "sql.ManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure")
2779		return
2780	}
2781	if !done {
2782		err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesDeleteFuture")
2783		return
2784	}
2785	ar.Response = future.Response()
2786	return
2787}
2788
2789// ManagedInstancesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
2790// operation.
2791type ManagedInstancesUpdateFuture struct {
2792	azure.Future
2793}
2794
2795// Result returns the result of the asynchronous operation.
2796// If the operation has not completed it will return an error.
2797func (future *ManagedInstancesUpdateFuture) Result(client ManagedInstancesClient) (mi ManagedInstance, err error) {
2798	var done bool
2799	done, err = future.DoneWithContext(context.Background(), client)
2800	if err != nil {
2801		err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", future.Response(), "Polling failure")
2802		return
2803	}
2804	if !done {
2805		err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesUpdateFuture")
2806		return
2807	}
2808	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2809	if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent {
2810		mi, err = client.UpdateResponder(mi.Response.Response)
2811		if err != nil {
2812			err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", mi.Response.Response, "Failure responding to request")
2813		}
2814	}
2815	return
2816}
2817
2818// ManagedInstanceUpdate an update request for an Azure SQL Database managed instance.
2819type ManagedInstanceUpdate struct {
2820	// Sku - Managed instance sku
2821	Sku *Sku `json:"sku,omitempty"`
2822	// ManagedInstanceProperties - Resource properties.
2823	*ManagedInstanceProperties `json:"properties,omitempty"`
2824	// Tags - Resource tags.
2825	Tags map[string]*string `json:"tags"`
2826}
2827
2828// MarshalJSON is the custom marshaler for ManagedInstanceUpdate.
2829func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) {
2830	objectMap := make(map[string]interface{})
2831	if miu.Sku != nil {
2832		objectMap["sku"] = miu.Sku
2833	}
2834	if miu.ManagedInstanceProperties != nil {
2835		objectMap["properties"] = miu.ManagedInstanceProperties
2836	}
2837	if miu.Tags != nil {
2838		objectMap["tags"] = miu.Tags
2839	}
2840	return json.Marshal(objectMap)
2841}
2842
2843// UnmarshalJSON is the custom unmarshaler for ManagedInstanceUpdate struct.
2844func (miu *ManagedInstanceUpdate) UnmarshalJSON(body []byte) error {
2845	var m map[string]*json.RawMessage
2846	err := json.Unmarshal(body, &m)
2847	if err != nil {
2848		return err
2849	}
2850	for k, v := range m {
2851		switch k {
2852		case "sku":
2853			if v != nil {
2854				var sku Sku
2855				err = json.Unmarshal(*v, &sku)
2856				if err != nil {
2857					return err
2858				}
2859				miu.Sku = &sku
2860			}
2861		case "properties":
2862			if v != nil {
2863				var managedInstanceProperties ManagedInstanceProperties
2864				err = json.Unmarshal(*v, &managedInstanceProperties)
2865				if err != nil {
2866					return err
2867				}
2868				miu.ManagedInstanceProperties = &managedInstanceProperties
2869			}
2870		case "tags":
2871			if v != nil {
2872				var tags map[string]*string
2873				err = json.Unmarshal(*v, &tags)
2874				if err != nil {
2875					return err
2876				}
2877				miu.Tags = tags
2878			}
2879		}
2880	}
2881
2882	return nil
2883}
2884
2885// ManagedInstanceVulnerabilityAssessment a managed instance vulnerability assessment.
2886type ManagedInstanceVulnerabilityAssessment struct {
2887	autorest.Response `json:"-"`
2888	// ManagedInstanceVulnerabilityAssessmentProperties - Resource properties.
2889	*ManagedInstanceVulnerabilityAssessmentProperties `json:"properties,omitempty"`
2890	// ID - READ-ONLY; Resource ID.
2891	ID *string `json:"id,omitempty"`
2892	// Name - READ-ONLY; Resource name.
2893	Name *string `json:"name,omitempty"`
2894	// Type - READ-ONLY; Resource type.
2895	Type *string `json:"type,omitempty"`
2896}
2897
2898// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessment.
2899func (miva ManagedInstanceVulnerabilityAssessment) MarshalJSON() ([]byte, error) {
2900	objectMap := make(map[string]interface{})
2901	if miva.ManagedInstanceVulnerabilityAssessmentProperties != nil {
2902		objectMap["properties"] = miva.ManagedInstanceVulnerabilityAssessmentProperties
2903	}
2904	return json.Marshal(objectMap)
2905}
2906
2907// UnmarshalJSON is the custom unmarshaler for ManagedInstanceVulnerabilityAssessment struct.
2908func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) error {
2909	var m map[string]*json.RawMessage
2910	err := json.Unmarshal(body, &m)
2911	if err != nil {
2912		return err
2913	}
2914	for k, v := range m {
2915		switch k {
2916		case "properties":
2917			if v != nil {
2918				var managedInstanceVulnerabilityAssessmentProperties ManagedInstanceVulnerabilityAssessmentProperties
2919				err = json.Unmarshal(*v, &managedInstanceVulnerabilityAssessmentProperties)
2920				if err != nil {
2921					return err
2922				}
2923				miva.ManagedInstanceVulnerabilityAssessmentProperties = &managedInstanceVulnerabilityAssessmentProperties
2924			}
2925		case "id":
2926			if v != nil {
2927				var ID string
2928				err = json.Unmarshal(*v, &ID)
2929				if err != nil {
2930					return err
2931				}
2932				miva.ID = &ID
2933			}
2934		case "name":
2935			if v != nil {
2936				var name string
2937				err = json.Unmarshal(*v, &name)
2938				if err != nil {
2939					return err
2940				}
2941				miva.Name = &name
2942			}
2943		case "type":
2944			if v != nil {
2945				var typeVar string
2946				err = json.Unmarshal(*v, &typeVar)
2947				if err != nil {
2948					return err
2949				}
2950				miva.Type = &typeVar
2951			}
2952		}
2953	}
2954
2955	return nil
2956}
2957
2958// ManagedInstanceVulnerabilityAssessmentListResult a list of the ManagedInstance's vulnerability
2959// assessments.
2960type ManagedInstanceVulnerabilityAssessmentListResult struct {
2961	autorest.Response `json:"-"`
2962	// Value - READ-ONLY; Array of results.
2963	Value *[]ManagedInstanceVulnerabilityAssessment `json:"value,omitempty"`
2964	// NextLink - READ-ONLY; Link to retrieve next page of results.
2965	NextLink *string `json:"nextLink,omitempty"`
2966}
2967
2968// ManagedInstanceVulnerabilityAssessmentListResultIterator provides access to a complete listing of
2969// ManagedInstanceVulnerabilityAssessment values.
2970type ManagedInstanceVulnerabilityAssessmentListResultIterator struct {
2971	i    int
2972	page ManagedInstanceVulnerabilityAssessmentListResultPage
2973}
2974
2975// NextWithContext advances to the next value.  If there was an error making
2976// the request the iterator does not advance and the error is returned.
2977func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) {
2978	if tracing.IsEnabled() {
2979		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultIterator.NextWithContext")
2980		defer func() {
2981			sc := -1
2982			if iter.Response().Response.Response != nil {
2983				sc = iter.Response().Response.Response.StatusCode
2984			}
2985			tracing.EndSpan(ctx, sc, err)
2986		}()
2987	}
2988	iter.i++
2989	if iter.i < len(iter.page.Values()) {
2990		return nil
2991	}
2992	err = iter.page.NextWithContext(ctx)
2993	if err != nil {
2994		iter.i--
2995		return err
2996	}
2997	iter.i = 0
2998	return nil
2999}
3000
3001// Next advances to the next value.  If there was an error making
3002// the request the iterator does not advance and the error is returned.
3003// Deprecated: Use NextWithContext() instead.
3004func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) Next() error {
3005	return iter.NextWithContext(context.Background())
3006}
3007
3008// NotDone returns true if the enumeration should be started or is not yet complete.
3009func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) NotDone() bool {
3010	return iter.page.NotDone() && iter.i < len(iter.page.Values())
3011}
3012
3013// Response returns the raw server response from the last page request.
3014func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) Response() ManagedInstanceVulnerabilityAssessmentListResult {
3015	return iter.page.Response()
3016}
3017
3018// Value returns the current value or a zero-initialized value if the
3019// iterator has advanced beyond the end of the collection.
3020func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) Value() ManagedInstanceVulnerabilityAssessment {
3021	if !iter.page.NotDone() {
3022		return ManagedInstanceVulnerabilityAssessment{}
3023	}
3024	return iter.page.Values()[iter.i]
3025}
3026
3027// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultIterator type.
3028func NewManagedInstanceVulnerabilityAssessmentListResultIterator(page ManagedInstanceVulnerabilityAssessmentListResultPage) ManagedInstanceVulnerabilityAssessmentListResultIterator {
3029	return ManagedInstanceVulnerabilityAssessmentListResultIterator{page: page}
3030}
3031
3032// IsEmpty returns true if the ListResult contains no values.
3033func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) IsEmpty() bool {
3034	return mivalr.Value == nil || len(*mivalr.Value) == 0
3035}
3036
3037// managedInstanceVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results.
3038// It returns nil if no more results exist.
3039func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) managedInstanceVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) {
3040	if mivalr.NextLink == nil || len(to.String(mivalr.NextLink)) < 1 {
3041		return nil, nil
3042	}
3043	return autorest.Prepare((&http.Request{}).WithContext(ctx),
3044		autorest.AsJSON(),
3045		autorest.AsGet(),
3046		autorest.WithBaseURL(to.String(mivalr.NextLink)))
3047}
3048
3049// ManagedInstanceVulnerabilityAssessmentListResultPage contains a page of
3050// ManagedInstanceVulnerabilityAssessment values.
3051type ManagedInstanceVulnerabilityAssessmentListResultPage struct {
3052	fn     func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error)
3053	mivalr ManagedInstanceVulnerabilityAssessmentListResult
3054}
3055
3056// NextWithContext advances to the next page of values.  If there was an error making
3057// the request the page does not advance and the error is returned.
3058func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) {
3059	if tracing.IsEnabled() {
3060		ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultPage.NextWithContext")
3061		defer func() {
3062			sc := -1
3063			if page.Response().Response.Response != nil {
3064				sc = page.Response().Response.Response.StatusCode
3065			}
3066			tracing.EndSpan(ctx, sc, err)
3067		}()
3068	}
3069	next, err := page.fn(ctx, page.mivalr)
3070	if err != nil {
3071		return err
3072	}
3073	page.mivalr = next
3074	return nil
3075}
3076
3077// Next advances to the next page of values.  If there was an error making
3078// the request the page does not advance and the error is returned.
3079// Deprecated: Use NextWithContext() instead.
3080func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) Next() error {
3081	return page.NextWithContext(context.Background())
3082}
3083
3084// NotDone returns true if the page enumeration should be started or is not yet complete.
3085func (page ManagedInstanceVulnerabilityAssessmentListResultPage) NotDone() bool {
3086	return !page.mivalr.IsEmpty()
3087}
3088
3089// Response returns the raw server response from the last page request.
3090func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Response() ManagedInstanceVulnerabilityAssessmentListResult {
3091	return page.mivalr
3092}
3093
3094// Values returns the slice of values for the current page or nil if there are no values.
3095func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Values() []ManagedInstanceVulnerabilityAssessment {
3096	if page.mivalr.IsEmpty() {
3097		return nil
3098	}
3099	return *page.mivalr.Value
3100}
3101
3102// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultPage type.
3103func NewManagedInstanceVulnerabilityAssessmentListResultPage(getNextPage func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error)) ManagedInstanceVulnerabilityAssessmentListResultPage {
3104	return ManagedInstanceVulnerabilityAssessmentListResultPage{fn: getNextPage}
3105}
3106
3107// ManagedInstanceVulnerabilityAssessmentProperties properties of a managed instance vulnerability
3108// assessment.
3109type ManagedInstanceVulnerabilityAssessmentProperties struct {
3110	// StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/).
3111	StorageContainerPath *string `json:"storageContainerPath,omitempty"`
3112	// StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.
3113	StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"`
3114	// StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required.
3115	StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"`
3116	// RecurringScans - The recurring scans settings
3117	RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"`
3118}
3119
3120// Name ARM Usage Name
3121type Name struct {
3122	// Value - Usage name value
3123	Value *string `json:"value,omitempty"`
3124	// LocalizedValue - Usage name localized value.
3125	LocalizedValue *string `json:"localizedValue,omitempty"`
3126}
3127
3128// PrivateEndpointConnection a private endpoint connection
3129type PrivateEndpointConnection struct {
3130	autorest.Response `json:"-"`
3131	// PrivateEndpointConnectionProperties - Resource properties.
3132	*PrivateEndpointConnectionProperties `json:"properties,omitempty"`
3133	// ID - READ-ONLY; Resource ID.
3134	ID *string `json:"id,omitempty"`
3135	// Name - READ-ONLY; Resource name.
3136	Name *string `json:"name,omitempty"`
3137	// Type - READ-ONLY; Resource type.
3138	Type *string `json:"type,omitempty"`
3139}
3140
3141// MarshalJSON is the custom marshaler for PrivateEndpointConnection.
3142func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
3143	objectMap := make(map[string]interface{})
3144	if pec.PrivateEndpointConnectionProperties != nil {
3145		objectMap["properties"] = pec.PrivateEndpointConnectionProperties
3146	}
3147	return json.Marshal(objectMap)
3148}
3149
3150// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct.
3151func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error {
3152	var m map[string]*json.RawMessage
3153	err := json.Unmarshal(body, &m)
3154	if err != nil {
3155		return err
3156	}
3157	for k, v := range m {
3158		switch k {
3159		case "properties":
3160			if v != nil {
3161				var privateEndpointConnectionProperties PrivateEndpointConnectionProperties
3162				err = json.Unmarshal(*v, &privateEndpointConnectionProperties)
3163				if err != nil {
3164					return err
3165				}
3166				pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties
3167			}
3168		case "id":
3169			if v != nil {
3170				var ID string
3171				err = json.Unmarshal(*v, &ID)
3172				if err != nil {
3173					return err
3174				}
3175				pec.ID = &ID
3176			}
3177		case "name":
3178			if v != nil {
3179				var name string
3180				err = json.Unmarshal(*v, &name)
3181				if err != nil {
3182					return err
3183				}
3184				pec.Name = &name
3185			}
3186		case "type":
3187			if v != nil {
3188				var typeVar string
3189				err = json.Unmarshal(*v, &typeVar)
3190				if err != nil {
3191					return err
3192				}
3193				pec.Type = &typeVar
3194			}
3195		}
3196	}
3197
3198	return nil
3199}
3200
3201// PrivateEndpointConnectionListResult a list of private endpoint connections.
3202type PrivateEndpointConnectionListResult struct {
3203	autorest.Response `json:"-"`
3204	// Value - READ-ONLY; Array of results.
3205	Value *[]PrivateEndpointConnection `json:"value,omitempty"`
3206	// NextLink - READ-ONLY; Link to retrieve next page of results.
3207	NextLink *string `json:"nextLink,omitempty"`
3208}
3209
3210// PrivateEndpointConnectionListResultIterator provides access to a complete listing of
3211// PrivateEndpointConnection values.
3212type PrivateEndpointConnectionListResultIterator struct {
3213	i    int
3214	page PrivateEndpointConnectionListResultPage
3215}
3216
3217// NextWithContext advances to the next value.  If there was an error making
3218// the request the iterator does not advance and the error is returned.
3219func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) {
3220	if tracing.IsEnabled() {
3221		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext")
3222		defer func() {
3223			sc := -1
3224			if iter.Response().Response.Response != nil {
3225				sc = iter.Response().Response.Response.StatusCode
3226			}
3227			tracing.EndSpan(ctx, sc, err)
3228		}()
3229	}
3230	iter.i++
3231	if iter.i < len(iter.page.Values()) {
3232		return nil
3233	}
3234	err = iter.page.NextWithContext(ctx)
3235	if err != nil {
3236		iter.i--
3237		return err
3238	}
3239	iter.i = 0
3240	return nil
3241}
3242
3243// Next advances to the next value.  If there was an error making
3244// the request the iterator does not advance and the error is returned.
3245// Deprecated: Use NextWithContext() instead.
3246func (iter *PrivateEndpointConnectionListResultIterator) Next() error {
3247	return iter.NextWithContext(context.Background())
3248}
3249
3250// NotDone returns true if the enumeration should be started or is not yet complete.
3251func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool {
3252	return iter.page.NotDone() && iter.i < len(iter.page.Values())
3253}
3254
3255// Response returns the raw server response from the last page request.
3256func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult {
3257	return iter.page.Response()
3258}
3259
3260// Value returns the current value or a zero-initialized value if the
3261// iterator has advanced beyond the end of the collection.
3262func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection {
3263	if !iter.page.NotDone() {
3264		return PrivateEndpointConnection{}
3265	}
3266	return iter.page.Values()[iter.i]
3267}
3268
3269// Creates a new instance of the PrivateEndpointConnectionListResultIterator type.
3270func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator {
3271	return PrivateEndpointConnectionListResultIterator{page: page}
3272}
3273
3274// IsEmpty returns true if the ListResult contains no values.
3275func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool {
3276	return peclr.Value == nil || len(*peclr.Value) == 0
3277}
3278
3279// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results.
3280// It returns nil if no more results exist.
3281func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) {
3282	if peclr.NextLink == nil || len(to.String(peclr.NextLink)) < 1 {
3283		return nil, nil
3284	}
3285	return autorest.Prepare((&http.Request{}).WithContext(ctx),
3286		autorest.AsJSON(),
3287		autorest.AsGet(),
3288		autorest.WithBaseURL(to.String(peclr.NextLink)))
3289}
3290
3291// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values.
3292type PrivateEndpointConnectionListResultPage struct {
3293	fn    func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)
3294	peclr PrivateEndpointConnectionListResult
3295}
3296
3297// NextWithContext advances to the next page of values.  If there was an error making
3298// the request the page does not advance and the error is returned.
3299func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) {
3300	if tracing.IsEnabled() {
3301		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext")
3302		defer func() {
3303			sc := -1
3304			if page.Response().Response.Response != nil {
3305				sc = page.Response().Response.Response.StatusCode
3306			}
3307			tracing.EndSpan(ctx, sc, err)
3308		}()
3309	}
3310	next, err := page.fn(ctx, page.peclr)
3311	if err != nil {
3312		return err
3313	}
3314	page.peclr = next
3315	return nil
3316}
3317
3318// Next advances to the next page of values.  If there was an error making
3319// the request the page does not advance and the error is returned.
3320// Deprecated: Use NextWithContext() instead.
3321func (page *PrivateEndpointConnectionListResultPage) Next() error {
3322	return page.NextWithContext(context.Background())
3323}
3324
3325// NotDone returns true if the page enumeration should be started or is not yet complete.
3326func (page PrivateEndpointConnectionListResultPage) NotDone() bool {
3327	return !page.peclr.IsEmpty()
3328}
3329
3330// Response returns the raw server response from the last page request.
3331func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult {
3332	return page.peclr
3333}
3334
3335// Values returns the slice of values for the current page or nil if there are no values.
3336func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection {
3337	if page.peclr.IsEmpty() {
3338		return nil
3339	}
3340	return *page.peclr.Value
3341}
3342
3343// Creates a new instance of the PrivateEndpointConnectionListResultPage type.
3344func NewPrivateEndpointConnectionListResultPage(getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage {
3345	return PrivateEndpointConnectionListResultPage{fn: getNextPage}
3346}
3347
3348// PrivateEndpointConnectionProperties properties of a private endpoint connection.
3349type PrivateEndpointConnectionProperties struct {
3350	// PrivateEndpoint - Private endpoint which the connection belongs to.
3351	PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"`
3352	// PrivateLinkServiceConnectionState - Connection state of the private endpoint connection.
3353	PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"`
3354	// ProvisioningState - READ-ONLY; State of the private endpoint connection.
3355	ProvisioningState *string `json:"provisioningState,omitempty"`
3356}
3357
3358// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results
3359// of a long-running operation.
3360type PrivateEndpointConnectionsCreateOrUpdateFuture struct {
3361	azure.Future
3362}
3363
3364// Result returns the result of the asynchronous operation.
3365// If the operation has not completed it will return an error.
3366func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) Result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) {
3367	var done bool
3368	done, err = future.DoneWithContext(context.Background(), client)
3369	if err != nil {
3370		err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
3371		return
3372	}
3373	if !done {
3374		err = azure.NewAsyncOpIncompleteError("sql.PrivateEndpointConnectionsCreateOrUpdateFuture")
3375		return
3376	}
3377	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3378	if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {
3379		pec, err = client.CreateOrUpdateResponder(pec.Response.Response)
3380		if err != nil {
3381			err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request")
3382		}
3383	}
3384	return
3385}
3386
3387// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a
3388// long-running operation.
3389type PrivateEndpointConnectionsDeleteFuture struct {
3390	azure.Future
3391}
3392
3393// Result returns the result of the asynchronous operation.
3394// If the operation has not completed it will return an error.
3395func (future *PrivateEndpointConnectionsDeleteFuture) Result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) {
3396	var done bool
3397	done, err = future.DoneWithContext(context.Background(), client)
3398	if err != nil {
3399		err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure")
3400		return
3401	}
3402	if !done {
3403		err = azure.NewAsyncOpIncompleteError("sql.PrivateEndpointConnectionsDeleteFuture")
3404		return
3405	}
3406	ar.Response = future.Response()
3407	return
3408}
3409
3410// PrivateEndpointProperty ...
3411type PrivateEndpointProperty struct {
3412	// ID - Resource id of the private endpoint.
3413	ID *string `json:"id,omitempty"`
3414}
3415
3416// PrivateLinkServiceConnectionStateProperty ...
3417type PrivateLinkServiceConnectionStateProperty struct {
3418	// Status - The private link service connection status.
3419	Status *string `json:"status,omitempty"`
3420	// Description - The private link service connection description.
3421	Description *string `json:"description,omitempty"`
3422	// ActionsRequired - READ-ONLY; The actions required for private link service connection.
3423	ActionsRequired *string `json:"actionsRequired,omitempty"`
3424}
3425
3426// ProxyResource ARM proxy resource.
3427type ProxyResource struct {
3428	// ID - READ-ONLY; Resource ID.
3429	ID *string `json:"id,omitempty"`
3430	// Name - READ-ONLY; Resource name.
3431	Name *string `json:"name,omitempty"`
3432	// Type - READ-ONLY; Resource type.
3433	Type *string `json:"type,omitempty"`
3434}
3435
3436// Resource ARM resource.
3437type Resource struct {
3438	// ID - READ-ONLY; Resource ID.
3439	ID *string `json:"id,omitempty"`
3440	// Name - READ-ONLY; Resource name.
3441	Name *string `json:"name,omitempty"`
3442	// Type - READ-ONLY; Resource type.
3443	Type *string `json:"type,omitempty"`
3444}
3445
3446// ResourceIdentity azure Active Directory identity configuration for a resource.
3447type ResourceIdentity struct {
3448	// PrincipalID - READ-ONLY; The Azure Active Directory principal id.
3449	PrincipalID *uuid.UUID `json:"principalId,omitempty"`
3450	// Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned'
3451	Type IdentityType `json:"type,omitempty"`
3452	// TenantID - READ-ONLY; The Azure Active Directory tenant id.
3453	TenantID *uuid.UUID `json:"tenantId,omitempty"`
3454}
3455
3456// SecurityAlertPolicyProperties properties of a security alert policy.
3457type SecurityAlertPolicyProperties struct {
3458	// State - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled'
3459	State SecurityAlertPolicyState `json:"state,omitempty"`
3460	// DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action
3461	DisabledAlerts *[]string `json:"disabledAlerts,omitempty"`
3462	// EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent.
3463	EmailAddresses *[]string `json:"emailAddresses,omitempty"`
3464	// EmailAccountAdmins - Specifies that the alert is sent to the account administrators.
3465	EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"`
3466	// StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
3467	StorageEndpoint *string `json:"storageEndpoint,omitempty"`
3468	// StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account.
3469	StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"`
3470	// RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs.
3471	RetentionDays *int32 `json:"retentionDays,omitempty"`
3472	// CreationTime - READ-ONLY; Specifies the UTC creation time of the policy.
3473	CreationTime *date.Time `json:"creationTime,omitempty"`
3474}
3475
3476// SensitivityLabel a sensitivity label.
3477type SensitivityLabel struct {
3478	autorest.Response `json:"-"`
3479	// SensitivityLabelProperties - Resource properties.
3480	*SensitivityLabelProperties `json:"properties,omitempty"`
3481	// ID - READ-ONLY; Resource ID.
3482	ID *string `json:"id,omitempty"`
3483	// Name - READ-ONLY; Resource name.
3484	Name *string `json:"name,omitempty"`
3485	// Type - READ-ONLY; Resource type.
3486	Type *string `json:"type,omitempty"`
3487}
3488
3489// MarshalJSON is the custom marshaler for SensitivityLabel.
3490func (sl SensitivityLabel) MarshalJSON() ([]byte, error) {
3491	objectMap := make(map[string]interface{})
3492	if sl.SensitivityLabelProperties != nil {
3493		objectMap["properties"] = sl.SensitivityLabelProperties
3494	}
3495	return json.Marshal(objectMap)
3496}
3497
3498// UnmarshalJSON is the custom unmarshaler for SensitivityLabel struct.
3499func (sl *SensitivityLabel) UnmarshalJSON(body []byte) error {
3500	var m map[string]*json.RawMessage
3501	err := json.Unmarshal(body, &m)
3502	if err != nil {
3503		return err
3504	}
3505	for k, v := range m {
3506		switch k {
3507		case "properties":
3508			if v != nil {
3509				var sensitivityLabelProperties SensitivityLabelProperties
3510				err = json.Unmarshal(*v, &sensitivityLabelProperties)
3511				if err != nil {
3512					return err
3513				}
3514				sl.SensitivityLabelProperties = &sensitivityLabelProperties
3515			}
3516		case "id":
3517			if v != nil {
3518				var ID string
3519				err = json.Unmarshal(*v, &ID)
3520				if err != nil {
3521					return err
3522				}
3523				sl.ID = &ID
3524			}
3525		case "name":
3526			if v != nil {
3527				var name string
3528				err = json.Unmarshal(*v, &name)
3529				if err != nil {
3530					return err
3531				}
3532				sl.Name = &name
3533			}
3534		case "type":
3535			if v != nil {
3536				var typeVar string
3537				err = json.Unmarshal(*v, &typeVar)
3538				if err != nil {
3539					return err
3540				}
3541				sl.Type = &typeVar
3542			}
3543		}
3544	}
3545
3546	return nil
3547}
3548
3549// SensitivityLabelListResult a list of sensitivity labels.
3550type SensitivityLabelListResult struct {
3551	autorest.Response `json:"-"`
3552	// Value - READ-ONLY; Array of results.
3553	Value *[]SensitivityLabel `json:"value,omitempty"`
3554	// NextLink - READ-ONLY; Link to retrieve next page of results.
3555	NextLink *string `json:"nextLink,omitempty"`
3556}
3557
3558// SensitivityLabelListResultIterator provides access to a complete listing of SensitivityLabel values.
3559type SensitivityLabelListResultIterator struct {
3560	i    int
3561	page SensitivityLabelListResultPage
3562}
3563
3564// NextWithContext advances to the next value.  If there was an error making
3565// the request the iterator does not advance and the error is returned.
3566func (iter *SensitivityLabelListResultIterator) NextWithContext(ctx context.Context) (err error) {
3567	if tracing.IsEnabled() {
3568		ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultIterator.NextWithContext")
3569		defer func() {
3570			sc := -1
3571			if iter.Response().Response.Response != nil {
3572				sc = iter.Response().Response.Response.StatusCode
3573			}
3574			tracing.EndSpan(ctx, sc, err)
3575		}()
3576	}
3577	iter.i++
3578	if iter.i < len(iter.page.Values()) {
3579		return nil
3580	}
3581	err = iter.page.NextWithContext(ctx)
3582	if err != nil {
3583		iter.i--
3584		return err
3585	}
3586	iter.i = 0
3587	return nil
3588}
3589
3590// Next advances to the next value.  If there was an error making
3591// the request the iterator does not advance and the error is returned.
3592// Deprecated: Use NextWithContext() instead.
3593func (iter *SensitivityLabelListResultIterator) Next() error {
3594	return iter.NextWithContext(context.Background())
3595}
3596
3597// NotDone returns true if the enumeration should be started or is not yet complete.
3598func (iter SensitivityLabelListResultIterator) NotDone() bool {
3599	return iter.page.NotDone() && iter.i < len(iter.page.Values())
3600}
3601
3602// Response returns the raw server response from the last page request.
3603func (iter SensitivityLabelListResultIterator) Response() SensitivityLabelListResult {
3604	return iter.page.Response()
3605}
3606
3607// Value returns the current value or a zero-initialized value if the
3608// iterator has advanced beyond the end of the collection.
3609func (iter SensitivityLabelListResultIterator) Value() SensitivityLabel {
3610	if !iter.page.NotDone() {
3611		return SensitivityLabel{}
3612	}
3613	return iter.page.Values()[iter.i]
3614}
3615
3616// Creates a new instance of the SensitivityLabelListResultIterator type.
3617func NewSensitivityLabelListResultIterator(page SensitivityLabelListResultPage) SensitivityLabelListResultIterator {
3618	return SensitivityLabelListResultIterator{page: page}
3619}
3620
3621// IsEmpty returns true if the ListResult contains no values.
3622func (sllr SensitivityLabelListResult) IsEmpty() bool {
3623	return sllr.Value == nil || len(*sllr.Value) == 0
3624}
3625
3626// sensitivityLabelListResultPreparer prepares a request to retrieve the next set of results.
3627// It returns nil if no more results exist.
3628func (sllr SensitivityLabelListResult) sensitivityLabelListResultPreparer(ctx context.Context) (*http.Request, error) {
3629	if sllr.NextLink == nil || len(to.String(sllr.NextLink)) < 1 {
3630		return nil, nil
3631	}
3632	return autorest.Prepare((&http.Request{}).WithContext(ctx),
3633		autorest.AsJSON(),
3634		autorest.AsGet(),
3635		autorest.WithBaseURL(to.String(sllr.NextLink)))
3636}
3637
3638// SensitivityLabelListResultPage contains a page of SensitivityLabel values.
3639type SensitivityLabelListResultPage struct {
3640	fn   func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error)
3641	sllr SensitivityLabelListResult
3642}
3643
3644// NextWithContext advances to the next page of values.  If there was an error making
3645// the request the page does not advance and the error is returned.
3646func (page *SensitivityLabelListResultPage) NextWithContext(ctx context.Context) (err error) {
3647	if tracing.IsEnabled() {
3648		ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultPage.NextWithContext")
3649		defer func() {
3650			sc := -1
3651			if page.Response().Response.Response != nil {
3652				sc = page.Response().Response.Response.StatusCode
3653			}
3654			tracing.EndSpan(ctx, sc, err)
3655		}()
3656	}
3657	next, err := page.fn(ctx, page.sllr)
3658	if err != nil {
3659		return err
3660	}
3661	page.sllr = next
3662	return nil
3663}
3664
3665// Next advances to the next page of values.  If there was an error making
3666// the request the page does not advance and the error is returned.
3667// Deprecated: Use NextWithContext() instead.
3668func (page *SensitivityLabelListResultPage) Next() error {
3669	return page.NextWithContext(context.Background())
3670}
3671
3672// NotDone returns true if the page enumeration should be started or is not yet complete.
3673func (page SensitivityLabelListResultPage) NotDone() bool {
3674	return !page.sllr.IsEmpty()
3675}
3676
3677// Response returns the raw server response from the last page request.
3678func (page SensitivityLabelListResultPage) Response() SensitivityLabelListResult {
3679	return page.sllr
3680}
3681
3682// Values returns the slice of values for the current page or nil if there are no values.
3683func (page SensitivityLabelListResultPage) Values() []SensitivityLabel {
3684	if page.sllr.IsEmpty() {
3685		return nil
3686	}
3687	return *page.sllr.Value
3688}
3689
3690// Creates a new instance of the SensitivityLabelListResultPage type.
3691func NewSensitivityLabelListResultPage(getNextPage func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error)) SensitivityLabelListResultPage {
3692	return SensitivityLabelListResultPage{fn: getNextPage}
3693}
3694
3695// SensitivityLabelProperties properties of a sensitivity label.
3696type SensitivityLabelProperties struct {
3697	// LabelName - The label name.
3698	LabelName *string `json:"labelName,omitempty"`
3699	// LabelID - The label ID.
3700	LabelID *string `json:"labelId,omitempty"`
3701	// InformationType - The information type.
3702	InformationType *string `json:"informationType,omitempty"`
3703	// InformationTypeID - The information type ID.
3704	InformationTypeID *string `json:"informationTypeId,omitempty"`
3705	// IsDisabled - READ-ONLY; Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not.
3706	IsDisabled *bool `json:"isDisabled,omitempty"`
3707	// Rank - Possible values include: 'None', 'Low', 'Medium', 'High', 'Critical'
3708	Rank SensitivityLabelRank `json:"rank,omitempty"`
3709}
3710
3711// ServerAzureADAdministrator azure Active Directory administrator.
3712type ServerAzureADAdministrator struct {
3713	autorest.Response `json:"-"`
3714	// AdministratorProperties - Resource properties.
3715	*AdministratorProperties `json:"properties,omitempty"`
3716	// ID - READ-ONLY; Resource ID.
3717	ID *string `json:"id,omitempty"`
3718	// Name - READ-ONLY; Resource name.
3719	Name *string `json:"name,omitempty"`
3720	// Type - READ-ONLY; Resource type.
3721	Type *string `json:"type,omitempty"`
3722}
3723
3724// MarshalJSON is the custom marshaler for ServerAzureADAdministrator.
3725func (saaa ServerAzureADAdministrator) MarshalJSON() ([]byte, error) {
3726	objectMap := make(map[string]interface{})
3727	if saaa.AdministratorProperties != nil {
3728		objectMap["properties"] = saaa.AdministratorProperties
3729	}
3730	return json.Marshal(objectMap)
3731}
3732
3733// UnmarshalJSON is the custom unmarshaler for ServerAzureADAdministrator struct.
3734func (saaa *ServerAzureADAdministrator) UnmarshalJSON(body []byte) error {
3735	var m map[string]*json.RawMessage
3736	err := json.Unmarshal(body, &m)
3737	if err != nil {
3738		return err
3739	}
3740	for k, v := range m {
3741		switch k {
3742		case "properties":
3743			if v != nil {
3744				var administratorProperties AdministratorProperties
3745				err = json.Unmarshal(*v, &administratorProperties)
3746				if err != nil {
3747					return err
3748				}
3749				saaa.AdministratorProperties = &administratorProperties
3750			}
3751		case "id":
3752			if v != nil {
3753				var ID string
3754				err = json.Unmarshal(*v, &ID)
3755				if err != nil {
3756					return err
3757				}
3758				saaa.ID = &ID
3759			}
3760		case "name":
3761			if v != nil {
3762				var name string
3763				err = json.Unmarshal(*v, &name)
3764				if err != nil {
3765					return err
3766				}
3767				saaa.Name = &name
3768			}
3769		case "type":
3770			if v != nil {
3771				var typeVar string
3772				err = json.Unmarshal(*v, &typeVar)
3773				if err != nil {
3774					return err
3775				}
3776				saaa.Type = &typeVar
3777			}
3778		}
3779	}
3780
3781	return nil
3782}
3783
3784// ServerAzureADAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results
3785// of a long-running operation.
3786type ServerAzureADAdministratorsCreateOrUpdateFuture struct {
3787	azure.Future
3788}
3789
3790// Result returns the result of the asynchronous operation.
3791// If the operation has not completed it will return an error.
3792func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) Result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) {
3793	var done bool
3794	done, err = future.DoneWithContext(context.Background(), client)
3795	if err != nil {
3796		err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
3797		return
3798	}
3799	if !done {
3800		err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsCreateOrUpdateFuture")
3801		return
3802	}
3803	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3804	if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent {
3805		saaa, err = client.CreateOrUpdateResponder(saaa.Response.Response)
3806		if err != nil {
3807			err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", saaa.Response.Response, "Failure responding to request")
3808		}
3809	}
3810	return
3811}
3812
3813// ServerAzureADAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a
3814// long-running operation.
3815type ServerAzureADAdministratorsDeleteFuture struct {
3816	azure.Future
3817}
3818
3819// Result returns the result of the asynchronous operation.
3820// If the operation has not completed it will return an error.
3821func (future *ServerAzureADAdministratorsDeleteFuture) Result(client ServerAzureADAdministratorsClient) (ar autorest.Response, err error) {
3822	var done bool
3823	done, err = future.DoneWithContext(context.Background(), client)
3824	if err != nil {
3825		err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure")
3826		return
3827	}
3828	if !done {
3829		err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsDeleteFuture")
3830		return
3831	}
3832	ar.Response = future.Response()
3833	return
3834}
3835
3836// ServerVulnerabilityAssessment a server vulnerability assessment.
3837type ServerVulnerabilityAssessment struct {
3838	autorest.Response `json:"-"`
3839	// ServerVulnerabilityAssessmentProperties - Resource properties.
3840	*ServerVulnerabilityAssessmentProperties `json:"properties,omitempty"`
3841	// ID - READ-ONLY; Resource ID.
3842	ID *string `json:"id,omitempty"`
3843	// Name - READ-ONLY; Resource name.
3844	Name *string `json:"name,omitempty"`
3845	// Type - READ-ONLY; Resource type.
3846	Type *string `json:"type,omitempty"`
3847}
3848
3849// MarshalJSON is the custom marshaler for ServerVulnerabilityAssessment.
3850func (sva ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) {
3851	objectMap := make(map[string]interface{})
3852	if sva.ServerVulnerabilityAssessmentProperties != nil {
3853		objectMap["properties"] = sva.ServerVulnerabilityAssessmentProperties
3854	}
3855	return json.Marshal(objectMap)
3856}
3857
3858// UnmarshalJSON is the custom unmarshaler for ServerVulnerabilityAssessment struct.
3859func (sva *ServerVulnerabilityAssessment) UnmarshalJSON(body []byte) error {
3860	var m map[string]*json.RawMessage
3861	err := json.Unmarshal(body, &m)
3862	if err != nil {
3863		return err
3864	}
3865	for k, v := range m {
3866		switch k {
3867		case "properties":
3868			if v != nil {
3869				var serverVulnerabilityAssessmentProperties ServerVulnerabilityAssessmentProperties
3870				err = json.Unmarshal(*v, &serverVulnerabilityAssessmentProperties)
3871				if err != nil {
3872					return err
3873				}
3874				sva.ServerVulnerabilityAssessmentProperties = &serverVulnerabilityAssessmentProperties
3875			}
3876		case "id":
3877			if v != nil {
3878				var ID string
3879				err = json.Unmarshal(*v, &ID)
3880				if err != nil {
3881					return err
3882				}
3883				sva.ID = &ID
3884			}
3885		case "name":
3886			if v != nil {
3887				var name string
3888				err = json.Unmarshal(*v, &name)
3889				if err != nil {
3890					return err
3891				}
3892				sva.Name = &name
3893			}
3894		case "type":
3895			if v != nil {
3896				var typeVar string
3897				err = json.Unmarshal(*v, &typeVar)
3898				if err != nil {
3899					return err
3900				}
3901				sva.Type = &typeVar
3902			}
3903		}
3904	}
3905
3906	return nil
3907}
3908
3909// ServerVulnerabilityAssessmentListResult a list of the server's vulnerability assessments.
3910type ServerVulnerabilityAssessmentListResult struct {
3911	autorest.Response `json:"-"`
3912	// Value - READ-ONLY; Array of results.
3913	Value *[]ServerVulnerabilityAssessment `json:"value,omitempty"`
3914	// NextLink - READ-ONLY; Link to retrieve next page of results.
3915	NextLink *string `json:"nextLink,omitempty"`
3916}
3917
3918// ServerVulnerabilityAssessmentListResultIterator provides access to a complete listing of
3919// ServerVulnerabilityAssessment values.
3920type ServerVulnerabilityAssessmentListResultIterator struct {
3921	i    int
3922	page ServerVulnerabilityAssessmentListResultPage
3923}
3924
3925// NextWithContext advances to the next value.  If there was an error making
3926// the request the iterator does not advance and the error is returned.
3927func (iter *ServerVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) {
3928	if tracing.IsEnabled() {
3929		ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultIterator.NextWithContext")
3930		defer func() {
3931			sc := -1
3932			if iter.Response().Response.Response != nil {
3933				sc = iter.Response().Response.Response.StatusCode
3934			}
3935			tracing.EndSpan(ctx, sc, err)
3936		}()
3937	}
3938	iter.i++
3939	if iter.i < len(iter.page.Values()) {
3940		return nil
3941	}
3942	err = iter.page.NextWithContext(ctx)
3943	if err != nil {
3944		iter.i--
3945		return err
3946	}
3947	iter.i = 0
3948	return nil
3949}
3950
3951// Next advances to the next value.  If there was an error making
3952// the request the iterator does not advance and the error is returned.
3953// Deprecated: Use NextWithContext() instead.
3954func (iter *ServerVulnerabilityAssessmentListResultIterator) Next() error {
3955	return iter.NextWithContext(context.Background())
3956}
3957
3958// NotDone returns true if the enumeration should be started or is not yet complete.
3959func (iter ServerVulnerabilityAssessmentListResultIterator) NotDone() bool {
3960	return iter.page.NotDone() && iter.i < len(iter.page.Values())
3961}
3962
3963// Response returns the raw server response from the last page request.
3964func (iter ServerVulnerabilityAssessmentListResultIterator) Response() ServerVulnerabilityAssessmentListResult {
3965	return iter.page.Response()
3966}
3967
3968// Value returns the current value or a zero-initialized value if the
3969// iterator has advanced beyond the end of the collection.
3970func (iter ServerVulnerabilityAssessmentListResultIterator) Value() ServerVulnerabilityAssessment {
3971	if !iter.page.NotDone() {
3972		return ServerVulnerabilityAssessment{}
3973	}
3974	return iter.page.Values()[iter.i]
3975}
3976
3977// Creates a new instance of the ServerVulnerabilityAssessmentListResultIterator type.
3978func NewServerVulnerabilityAssessmentListResultIterator(page ServerVulnerabilityAssessmentListResultPage) ServerVulnerabilityAssessmentListResultIterator {
3979	return ServerVulnerabilityAssessmentListResultIterator{page: page}
3980}
3981
3982// IsEmpty returns true if the ListResult contains no values.
3983func (svalr ServerVulnerabilityAssessmentListResult) IsEmpty() bool {
3984	return svalr.Value == nil || len(*svalr.Value) == 0
3985}
3986
3987// serverVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results.
3988// It returns nil if no more results exist.
3989func (svalr ServerVulnerabilityAssessmentListResult) serverVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) {
3990	if svalr.NextLink == nil || len(to.String(svalr.NextLink)) < 1 {
3991		return nil, nil
3992	}
3993	return autorest.Prepare((&http.Request{}).WithContext(ctx),
3994		autorest.AsJSON(),
3995		autorest.AsGet(),
3996		autorest.WithBaseURL(to.String(svalr.NextLink)))
3997}
3998
3999// ServerVulnerabilityAssessmentListResultPage contains a page of ServerVulnerabilityAssessment values.
4000type ServerVulnerabilityAssessmentListResultPage struct {
4001	fn    func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error)
4002	svalr ServerVulnerabilityAssessmentListResult
4003}
4004
4005// NextWithContext advances to the next page of values.  If there was an error making
4006// the request the page does not advance and the error is returned.
4007func (page *ServerVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) {
4008	if tracing.IsEnabled() {
4009		ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultPage.NextWithContext")
4010		defer func() {
4011			sc := -1
4012			if page.Response().Response.Response != nil {
4013				sc = page.Response().Response.Response.StatusCode
4014			}
4015			tracing.EndSpan(ctx, sc, err)
4016		}()
4017	}
4018	next, err := page.fn(ctx, page.svalr)
4019	if err != nil {
4020		return err
4021	}
4022	page.svalr = next
4023	return nil
4024}
4025
4026// Next advances to the next page of values.  If there was an error making
4027// the request the page does not advance and the error is returned.
4028// Deprecated: Use NextWithContext() instead.
4029func (page *ServerVulnerabilityAssessmentListResultPage) Next() error {
4030	return page.NextWithContext(context.Background())
4031}
4032
4033// NotDone returns true if the page enumeration should be started or is not yet complete.
4034func (page ServerVulnerabilityAssessmentListResultPage) NotDone() bool {
4035	return !page.svalr.IsEmpty()
4036}
4037
4038// Response returns the raw server response from the last page request.
4039func (page ServerVulnerabilityAssessmentListResultPage) Response() ServerVulnerabilityAssessmentListResult {
4040	return page.svalr
4041}
4042
4043// Values returns the slice of values for the current page or nil if there are no values.
4044func (page ServerVulnerabilityAssessmentListResultPage) Values() []ServerVulnerabilityAssessment {
4045	if page.svalr.IsEmpty() {
4046		return nil
4047	}
4048	return *page.svalr.Value
4049}
4050
4051// Creates a new instance of the ServerVulnerabilityAssessmentListResultPage type.
4052func NewServerVulnerabilityAssessmentListResultPage(getNextPage func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error)) ServerVulnerabilityAssessmentListResultPage {
4053	return ServerVulnerabilityAssessmentListResultPage{fn: getNextPage}
4054}
4055
4056// ServerVulnerabilityAssessmentProperties properties of a server Vulnerability Assessment.
4057type ServerVulnerabilityAssessmentProperties struct {
4058	// StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/).
4059	StorageContainerPath *string `json:"storageContainerPath,omitempty"`
4060	// StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.
4061	StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"`
4062	// StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required.
4063	StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"`
4064	// RecurringScans - The recurring scans settings
4065	RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"`
4066}
4067
4068// Sku an ARM Resource SKU.
4069type Sku struct {
4070	// Name - The name of the SKU, typically, a letter + Number code, e.g. P3.
4071	Name *string `json:"name,omitempty"`
4072	// Tier - The tier or edition of the particular SKU, e.g. Basic, Premium.
4073	Tier *string `json:"tier,omitempty"`
4074	// Size - Size of the particular SKU
4075	Size *string `json:"size,omitempty"`
4076	// Family - If the service has different generations of hardware, for the same SKU, then that can be captured here.
4077	Family *string `json:"family,omitempty"`
4078	// Capacity - Capacity of the particular SKU.
4079	Capacity *int32 `json:"capacity,omitempty"`
4080}
4081
4082// TrackedResource ARM tracked top level resource.
4083type TrackedResource struct {
4084	// Location - Resource location.
4085	Location *string `json:"location,omitempty"`
4086	// Tags - Resource tags.
4087	Tags map[string]*string `json:"tags"`
4088	// ID - READ-ONLY; Resource ID.
4089	ID *string `json:"id,omitempty"`
4090	// Name - READ-ONLY; Resource name.
4091	Name *string `json:"name,omitempty"`
4092	// Type - READ-ONLY; Resource type.
4093	Type *string `json:"type,omitempty"`
4094}
4095
4096// MarshalJSON is the custom marshaler for TrackedResource.
4097func (tr TrackedResource) MarshalJSON() ([]byte, error) {
4098	objectMap := make(map[string]interface{})
4099	if tr.Location != nil {
4100		objectMap["location"] = tr.Location
4101	}
4102	if tr.Tags != nil {
4103		objectMap["tags"] = tr.Tags
4104	}
4105	return json.Marshal(objectMap)
4106}
4107
4108// Usage ARM usage.
4109type Usage struct {
4110	// ID - READ-ONLY; Resource ID.
4111	ID *string `json:"id,omitempty"`
4112	// Name - READ-ONLY; Resource name.
4113	Name *Name `json:"name,omitempty"`
4114	// Type - READ-ONLY; Resource type.
4115	Type *string `json:"type,omitempty"`
4116	// Unit - READ-ONLY; Usage unit.
4117	Unit *string `json:"unit,omitempty"`
4118	// CurrentValue - READ-ONLY; Usage current value.
4119	CurrentValue *int32 `json:"currentValue,omitempty"`
4120	// Limit - READ-ONLY; Usage limit.
4121	Limit *int32 `json:"limit,omitempty"`
4122	// RequestedLimit - READ-ONLY; Usage requested limit.
4123	RequestedLimit *int32 `json:"requestedLimit,omitempty"`
4124}
4125
4126// UsageListResult a list of usages.
4127type UsageListResult struct {
4128	autorest.Response `json:"-"`
4129	// Value - READ-ONLY; Array of results.
4130	Value *[]Usage `json:"value,omitempty"`
4131	// NextLink - READ-ONLY; Link to retrieve next page of results.
4132	NextLink *string `json:"nextLink,omitempty"`
4133}
4134
4135// UsageListResultIterator provides access to a complete listing of Usage values.
4136type UsageListResultIterator struct {
4137	i    int
4138	page UsageListResultPage
4139}
4140
4141// NextWithContext advances to the next value.  If there was an error making
4142// the request the iterator does not advance and the error is returned.
4143func (iter *UsageListResultIterator) NextWithContext(ctx context.Context) (err error) {
4144	if tracing.IsEnabled() {
4145		ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResultIterator.NextWithContext")
4146		defer func() {
4147			sc := -1
4148			if iter.Response().Response.Response != nil {
4149				sc = iter.Response().Response.Response.StatusCode
4150			}
4151			tracing.EndSpan(ctx, sc, err)
4152		}()
4153	}
4154	iter.i++
4155	if iter.i < len(iter.page.Values()) {
4156		return nil
4157	}
4158	err = iter.page.NextWithContext(ctx)
4159	if err != nil {
4160		iter.i--
4161		return err
4162	}
4163	iter.i = 0
4164	return nil
4165}
4166
4167// Next advances to the next value.  If there was an error making
4168// the request the iterator does not advance and the error is returned.
4169// Deprecated: Use NextWithContext() instead.
4170func (iter *UsageListResultIterator) Next() error {
4171	return iter.NextWithContext(context.Background())
4172}
4173
4174// NotDone returns true if the enumeration should be started or is not yet complete.
4175func (iter UsageListResultIterator) NotDone() bool {
4176	return iter.page.NotDone() && iter.i < len(iter.page.Values())
4177}
4178
4179// Response returns the raw server response from the last page request.
4180func (iter UsageListResultIterator) Response() UsageListResult {
4181	return iter.page.Response()
4182}
4183
4184// Value returns the current value or a zero-initialized value if the
4185// iterator has advanced beyond the end of the collection.
4186func (iter UsageListResultIterator) Value() Usage {
4187	if !iter.page.NotDone() {
4188		return Usage{}
4189	}
4190	return iter.page.Values()[iter.i]
4191}
4192
4193// Creates a new instance of the UsageListResultIterator type.
4194func NewUsageListResultIterator(page UsageListResultPage) UsageListResultIterator {
4195	return UsageListResultIterator{page: page}
4196}
4197
4198// IsEmpty returns true if the ListResult contains no values.
4199func (ulr UsageListResult) IsEmpty() bool {
4200	return ulr.Value == nil || len(*ulr.Value) == 0
4201}
4202
4203// usageListResultPreparer prepares a request to retrieve the next set of results.
4204// It returns nil if no more results exist.
4205func (ulr UsageListResult) usageListResultPreparer(ctx context.Context) (*http.Request, error) {
4206	if ulr.NextLink == nil || len(to.String(ulr.NextLink)) < 1 {
4207		return nil, nil
4208	}
4209	return autorest.Prepare((&http.Request{}).WithContext(ctx),
4210		autorest.AsJSON(),
4211		autorest.AsGet(),
4212		autorest.WithBaseURL(to.String(ulr.NextLink)))
4213}
4214
4215// UsageListResultPage contains a page of Usage values.
4216type UsageListResultPage struct {
4217	fn  func(context.Context, UsageListResult) (UsageListResult, error)
4218	ulr UsageListResult
4219}
4220
4221// NextWithContext advances to the next page of values.  If there was an error making
4222// the request the page does not advance and the error is returned.
4223func (page *UsageListResultPage) NextWithContext(ctx context.Context) (err error) {
4224	if tracing.IsEnabled() {
4225		ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResultPage.NextWithContext")
4226		defer func() {
4227			sc := -1
4228			if page.Response().Response.Response != nil {
4229				sc = page.Response().Response.Response.StatusCode
4230			}
4231			tracing.EndSpan(ctx, sc, err)
4232		}()
4233	}
4234	next, err := page.fn(ctx, page.ulr)
4235	if err != nil {
4236		return err
4237	}
4238	page.ulr = next
4239	return nil
4240}
4241
4242// Next advances to the next page of values.  If there was an error making
4243// the request the page does not advance and the error is returned.
4244// Deprecated: Use NextWithContext() instead.
4245func (page *UsageListResultPage) Next() error {
4246	return page.NextWithContext(context.Background())
4247}
4248
4249// NotDone returns true if the page enumeration should be started or is not yet complete.
4250func (page UsageListResultPage) NotDone() bool {
4251	return !page.ulr.IsEmpty()
4252}
4253
4254// Response returns the raw server response from the last page request.
4255func (page UsageListResultPage) Response() UsageListResult {
4256	return page.ulr
4257}
4258
4259// Values returns the slice of values for the current page or nil if there are no values.
4260func (page UsageListResultPage) Values() []Usage {
4261	if page.ulr.IsEmpty() {
4262		return nil
4263	}
4264	return *page.ulr.Value
4265}
4266
4267// Creates a new instance of the UsageListResultPage type.
4268func NewUsageListResultPage(getNextPage func(context.Context, UsageListResult) (UsageListResult, error)) UsageListResultPage {
4269	return UsageListResultPage{fn: getNextPage}
4270}
4271
4272// VulnerabilityAssessmentRecurringScansProperties properties of a Vulnerability Assessment recurring
4273// scans.
4274type VulnerabilityAssessmentRecurringScansProperties struct {
4275	// IsEnabled - Recurring scans state.
4276	IsEnabled *bool `json:"isEnabled,omitempty"`
4277	// EmailSubscriptionAdmins - Specifies that the schedule scan notification will be is sent to the subscription administrators.
4278	EmailSubscriptionAdmins *bool `json:"emailSubscriptionAdmins,omitempty"`
4279	// Emails - Specifies an array of e-mail addresses to which the scan notification is sent.
4280	Emails *[]string `json:"emails,omitempty"`
4281}
4282