From 931c56d7b56fb7f9ba24b9e7d1cd5209efea18b7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 20 May 2022 15:32:58 +0000 Subject: [PATCH] CodeGen from PR 18770 in Azure/azure-rest-api-specs Merge 7fbd99d9c9e5ee0c5e02cab866366cfd0c6e2596 into 94198ce8fa5271ec6ac290561905ec6f5c9db18c --- .../mgmt/2015-05-01-preview/sql/CHANGELOG.md | 41 +- .../mgmt/2015-05-01-preview/sql/_meta.json | 2 +- .../sql/mgmt/2015-05-01-preview/sql/enums.go | 60 +- .../sql/mgmt/2015-05-01-preview/sql/models.go | 6 +- .../mgmt/2017-03-01-preview/sql/CHANGELOG.md | 41 +- .../mgmt/2017-03-01-preview/sql/_meta.json | 2 +- .../sql/mgmt/2017-03-01-preview/sql/enums.go | 60 +- .../sql/mgmt/2017-03-01-preview/sql/models.go | 18 +- .../mgmt/2017-10-01-preview/sql/CHANGELOG.md | 2 +- .../mgmt/2017-10-01-preview/sql/_meta.json | 2 +- .../mgmt/2018-06-01-preview/sql/CHANGELOG.md | 28 +- .../mgmt/2018-06-01-preview/sql/_meta.json | 2 +- .../sql/mgmt/2018-06-01-preview/sql/enums.go | 30 +- .../sql/mgmt/2018-06-01-preview/sql/models.go | 4 +- .../preview/sql/mgmt/v3.0/sql/CHANGELOG.md | 126 +- services/preview/sql/mgmt/v3.0/sql/_meta.json | 2 +- services/preview/sql/mgmt/v3.0/sql/enums.go | 110 +- .../v3.0/sql/manageddatabaserestoredetails.go | 122 - .../sql/mgmt/v3.0/sql/manageddatabases.go | 73 +- .../sql/mgmt/v3.0/sql/managedinstances.go | 163 +- services/preview/sql/mgmt/v3.0/sql/models.go | 629 +- .../v3.0/sql/privateendpointconnections.go | 8 +- .../sql/mgmt/v3.0/sql/sqlapi/interfaces.go | 67 +- .../preview/sql/mgmt/v4.0/sql/CHANGELOG.md | 336 +- services/preview/sql/mgmt/v4.0/sql/_meta.json | 2 +- .../preview/sql/mgmt/v4.0/sql/databases.go | 24 +- services/preview/sql/mgmt/v4.0/sql/enums.go | 200 +- .../mgmt/v4.0/sql/longtermretentionbackups.go | 406 +- ...longtermretentionmanagedinstancebackups.go | 36 +- ...licies.go => longtermretentionpolicies.go} | 126 +- services/preview/sql/mgmt/v4.0/sql/models.go | 1263 +- .../v4.0/sql/privateendpointconnections.go | 8 +- .../sql/mgmt/v4.0/sql/sqlapi/interfaces.go | 113 +- .../preview/sql/mgmt/v5.0/sql/CHANGELOG.md | 591 +- services/preview/sql/mgmt/v5.0/sql/_meta.json | 2 +- .../preview/sql/mgmt/v5.0/sql/databases.go | 28 +- .../v5.0/sql/databasesecurityalertpolicies.go | 4 +- .../v5.0/sql/distributedavailabilitygroups.go | 483 + .../preview/sql/mgmt/v5.0/sql/elasticpools.go | 18 +- .../sql/mgmt/v5.0/sql/endpointcertificates.go | 232 + services/preview/sql/mgmt/v5.0/sql/enums.go | 204 +- .../sql/mgmt/v5.0/sql/ipv6firewallrules.go | 392 + .../sql/mgmt/v5.0/sql/ledgerdigestuploads.go | 62 +- .../mgmt/v5.0/sql/longtermretentionbackups.go | 28 +- ...longtermretentionmanagedinstancebackups.go | 20 +- ...geddatabaserecommendedsensitivitylabels.go | 2 +- .../manageddatabasesecurityalertpolicies.go | 4 +- .../sql/manageddatabasesensitivitylabels.go | 141 +- .../sql/mgmt/v5.0/sql/managedinstancedtcs.go | 315 + .../sql/mgmt/v5.0/sql/managedinstances.go | 18 +- .../mgmt/v5.0/sql/managedserverdnsaliases.go | 484 + services/preview/sql/mgmt/v5.0/sql/models.go | 18476 +++++++++------- .../sql/mgmt/v5.0/sql/operationshealth.go | 150 - .../v5.0/sql/recommendedsensitivitylabels.go | 2 +- .../sql/mgmt/v5.0/sql/replicationlinks.go | 132 +- .../v5.0/sql/restorabledroppeddatabases.go | 4 +- .../sql/restorabledroppedmanageddatabases.go | 4 +- .../sql/mgmt/v5.0/sql/sensitivitylabels.go | 141 +- .../mgmt/v5.0/sql/serverconnectionpolicies.go | 164 +- .../mgmt/v5.0/sql/servertrustcertificates.go | 399 + .../sql/mgmt/v5.0/sql/sqlapi/interfaces.go | 423 +- .../preview/sql/mgmt/v5.0/sql/syncgroups.go | 6 +- .../transparentdataencryptionactivities.go | 115 - .../v5.0/sql/transparentdataencryptions.go | 172 +- services/sql/mgmt/2014-04-01/sql/CHANGELOG.md | 2 +- services/sql/mgmt/2014-04-01/sql/_meta.json | 2 +- 66 files changed, 17324 insertions(+), 10008 deletions(-) delete mode 100644 services/preview/sql/mgmt/v3.0/sql/manageddatabaserestoredetails.go rename services/preview/sql/mgmt/v4.0/sql/{backuplongtermretentionpolicies.go => longtermretentionpolicies.go} (53%) create mode 100644 services/preview/sql/mgmt/v5.0/sql/distributedavailabilitygroups.go create mode 100644 services/preview/sql/mgmt/v5.0/sql/endpointcertificates.go create mode 100644 services/preview/sql/mgmt/v5.0/sql/ipv6firewallrules.go create mode 100644 services/preview/sql/mgmt/v5.0/sql/managedinstancedtcs.go create mode 100644 services/preview/sql/mgmt/v5.0/sql/managedserverdnsaliases.go delete mode 100644 services/preview/sql/mgmt/v5.0/sql/operationshealth.go create mode 100644 services/preview/sql/mgmt/v5.0/sql/servertrustcertificates.go delete mode 100644 services/preview/sql/mgmt/v5.0/sql/transparentdataencryptionactivities.go diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/CHANGELOG.md b/services/preview/sql/mgmt/2015-05-01-preview/sql/CHANGELOG.md index 52911e4cc5e4..f24416d8a595 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/CHANGELOG.md +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/CHANGELOG.md @@ -1,2 +1,41 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. PrimaryAggregationType.Average +1. PrimaryAggregationType.Maximum +1. PrimaryAggregationType.Minimum +1. PrimaryAggregationType.Total +1. UnitDefinitionType.UnitDefinitionTypeBytes +1. UnitDefinitionType.UnitDefinitionTypeBytesPerSecond +1. UnitDefinitionType.UnitDefinitionTypeCount +1. UnitDefinitionType.UnitDefinitionTypeCountPerSecond +1. UnitDefinitionType.UnitDefinitionTypePercent +1. UnitDefinitionType.UnitDefinitionTypeSeconds + +### Signature Changes + +#### Const Types + +1. Count changed type from PrimaryAggregationType to UnitDefinitionType +1. None changed type from PrimaryAggregationType to IdentityType + +## Additive Changes + +### New Constants + +1. IdentityType.SystemAssignedUserAssigned +1. IdentityType.UserAssigned +1. PrimaryAggregationType.PrimaryAggregationTypeAverage +1. PrimaryAggregationType.PrimaryAggregationTypeCount +1. PrimaryAggregationType.PrimaryAggregationTypeMaximum +1. PrimaryAggregationType.PrimaryAggregationTypeMinimum +1. PrimaryAggregationType.PrimaryAggregationTypeNone +1. PrimaryAggregationType.PrimaryAggregationTypeTotal +1. UnitDefinitionType.Bytes +1. UnitDefinitionType.BytesPerSecond +1. UnitDefinitionType.CountPerSecond +1. UnitDefinitionType.Percent +1. UnitDefinitionType.Seconds diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/_meta.json b/services/preview/sql/mgmt/2015-05-01-preview/sql/_meta.json index e8c2180420cf..562d5a9da16d 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/_meta.json +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "02a2528dc0ceeb13d8042069a07b450fe5353da2", "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", "tag": "package-2015-05-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/enums.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/enums.go index 29373105fbe6..3f357397e296 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/enums.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/enums.go @@ -261,13 +261,19 @@ func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { type IdentityType string const ( + // None ... + None IdentityType = "None" // SystemAssigned ... SystemAssigned IdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" + // UserAssigned ... + UserAssigned IdentityType = "UserAssigned" ) // PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} + return []IdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} } // ManagedInstanceLicenseType enumerates the values for managed instance license type. @@ -368,23 +374,23 @@ func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { type PrimaryAggregationType string const ( - // Average ... - Average PrimaryAggregationType = "Average" - // Count ... - Count PrimaryAggregationType = "Count" - // Maximum ... - Maximum PrimaryAggregationType = "Maximum" - // Minimum ... - Minimum PrimaryAggregationType = "Minimum" - // None ... - None PrimaryAggregationType = "None" - // Total ... - Total PrimaryAggregationType = "Total" + // PrimaryAggregationTypeAverage ... + PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" + // PrimaryAggregationTypeCount ... + PrimaryAggregationTypeCount PrimaryAggregationType = "Count" + // PrimaryAggregationTypeMaximum ... + PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" + // PrimaryAggregationTypeMinimum ... + PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" + // PrimaryAggregationTypeNone ... + PrimaryAggregationTypeNone PrimaryAggregationType = "None" + // PrimaryAggregationTypeTotal ... + PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" ) // PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{Average, Count, Maximum, Minimum, None, Total} + return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeCount, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} } // ReadOnlyEndpointFailoverPolicy enumerates the values for read only endpoint failover policy. @@ -990,23 +996,23 @@ func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryption type UnitDefinitionType string const ( - // UnitDefinitionTypeBytes ... - UnitDefinitionTypeBytes UnitDefinitionType = "Bytes" - // UnitDefinitionTypeBytesPerSecond ... - UnitDefinitionTypeBytesPerSecond UnitDefinitionType = "BytesPerSecond" - // UnitDefinitionTypeCount ... - UnitDefinitionTypeCount UnitDefinitionType = "Count" - // UnitDefinitionTypeCountPerSecond ... - UnitDefinitionTypeCountPerSecond UnitDefinitionType = "CountPerSecond" - // UnitDefinitionTypePercent ... - UnitDefinitionTypePercent UnitDefinitionType = "Percent" - // UnitDefinitionTypeSeconds ... - UnitDefinitionTypeSeconds UnitDefinitionType = "Seconds" + // Bytes ... + Bytes UnitDefinitionType = "Bytes" + // BytesPerSecond ... + BytesPerSecond UnitDefinitionType = "BytesPerSecond" + // Count ... + Count UnitDefinitionType = "Count" + // CountPerSecond ... + CountPerSecond UnitDefinitionType = "CountPerSecond" + // Percent ... + Percent UnitDefinitionType = "Percent" + // Seconds ... + Seconds UnitDefinitionType = "Seconds" ) // PossibleUnitDefinitionTypeValues returns an array of possible values for the UnitDefinitionType const type. func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { - return []UnitDefinitionType{UnitDefinitionTypeBytes, UnitDefinitionTypeBytesPerSecond, UnitDefinitionTypeCount, UnitDefinitionTypeCountPerSecond, UnitDefinitionTypePercent, UnitDefinitionTypeSeconds} + return []UnitDefinitionType{Bytes, BytesPerSecond, Count, CountPerSecond, Percent, Seconds} } // UnitType enumerates the values for unit type. diff --git a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go index ea49f3695935..581f17ac7fdc 100644 --- a/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2015-05-01-preview/sql/models.go @@ -4276,11 +4276,11 @@ func (ma MetricAvailability) MarshalJSON() ([]byte, error) { type MetricDefinition struct { // Name - READ-ONLY; The name information for the metric. Name *MetricName `json:"name,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeCount', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeTotal' PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` // ResourceURI - READ-ONLY; The resource uri of the database. ResourceURI *string `json:"resourceUri,omitempty"` - // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitDefinitionTypeCount', 'UnitDefinitionTypeBytes', 'UnitDefinitionTypeSeconds', 'UnitDefinitionTypePercent', 'UnitDefinitionTypeCountPerSecond', 'UnitDefinitionTypeBytesPerSecond' + // Unit - READ-ONLY; The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond' Unit UnitDefinitionType `json:"unit,omitempty"` // MetricAvailabilities - READ-ONLY; The list of database metric availabilities for the metric. MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` @@ -5063,7 +5063,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { type ResourceIdentity struct { // PrincipalID - READ-ONLY; The Azure Active Directory principal id. PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // 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' + // 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: 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned' Type IdentityType `json:"type,omitempty"` // TenantID - READ-ONLY; The Azure Active Directory tenant id. TenantID *uuid.UUID `json:"tenantId,omitempty"` diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/CHANGELOG.md b/services/preview/sql/mgmt/2017-03-01-preview/sql/CHANGELOG.md index 52911e4cc5e4..f24416d8a595 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/CHANGELOG.md +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/CHANGELOG.md @@ -1,2 +1,41 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. PrimaryAggregationType.Average +1. PrimaryAggregationType.Maximum +1. PrimaryAggregationType.Minimum +1. PrimaryAggregationType.Total +1. UnitDefinitionType.UnitDefinitionTypeBytes +1. UnitDefinitionType.UnitDefinitionTypeBytesPerSecond +1. UnitDefinitionType.UnitDefinitionTypeCount +1. UnitDefinitionType.UnitDefinitionTypeCountPerSecond +1. UnitDefinitionType.UnitDefinitionTypePercent +1. UnitDefinitionType.UnitDefinitionTypeSeconds + +### Signature Changes + +#### Const Types + +1. Count changed type from PrimaryAggregationType to UnitDefinitionType +1. None changed type from PrimaryAggregationType to IdentityType + +## Additive Changes + +### New Constants + +1. IdentityType.SystemAssignedUserAssigned +1. IdentityType.UserAssigned +1. PrimaryAggregationType.PrimaryAggregationTypeAverage +1. PrimaryAggregationType.PrimaryAggregationTypeCount +1. PrimaryAggregationType.PrimaryAggregationTypeMaximum +1. PrimaryAggregationType.PrimaryAggregationTypeMinimum +1. PrimaryAggregationType.PrimaryAggregationTypeNone +1. PrimaryAggregationType.PrimaryAggregationTypeTotal +1. UnitDefinitionType.Bytes +1. UnitDefinitionType.BytesPerSecond +1. UnitDefinitionType.CountPerSecond +1. UnitDefinitionType.Percent +1. UnitDefinitionType.Seconds diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/_meta.json b/services/preview/sql/mgmt/2017-03-01-preview/sql/_meta.json index 355088c31f38..167565fe811c 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/_meta.json +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "02a2528dc0ceeb13d8042069a07b450fe5353da2", "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", "tag": "package-2017-03-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/enums.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/enums.go index 1336aa4ac58f..bc6c7e6d804c 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/enums.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/enums.go @@ -386,13 +386,19 @@ func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { type IdentityType string const ( + // None ... + None IdentityType = "None" // SystemAssigned ... SystemAssigned IdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" + // UserAssigned ... + UserAssigned IdentityType = "UserAssigned" ) // PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} + return []IdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} } // JobAgentState enumerates the values for job agent state. @@ -704,23 +710,23 @@ func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { type PrimaryAggregationType string const ( - // Average ... - Average PrimaryAggregationType = "Average" - // Count ... - Count PrimaryAggregationType = "Count" - // Maximum ... - Maximum PrimaryAggregationType = "Maximum" - // Minimum ... - Minimum PrimaryAggregationType = "Minimum" - // None ... - None PrimaryAggregationType = "None" - // Total ... - Total PrimaryAggregationType = "Total" + // PrimaryAggregationTypeAverage ... + PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" + // PrimaryAggregationTypeCount ... + PrimaryAggregationTypeCount PrimaryAggregationType = "Count" + // PrimaryAggregationTypeMaximum ... + PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" + // PrimaryAggregationTypeMinimum ... + PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" + // PrimaryAggregationTypeNone ... + PrimaryAggregationTypeNone PrimaryAggregationType = "None" + // PrimaryAggregationTypeTotal ... + PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" ) // PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{Average, Count, Maximum, Minimum, None, Total} + return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeCount, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} } // ProvisioningState enumerates the values for provisioning state. @@ -1383,23 +1389,23 @@ func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryption type UnitDefinitionType string const ( - // UnitDefinitionTypeBytes ... - UnitDefinitionTypeBytes UnitDefinitionType = "Bytes" - // UnitDefinitionTypeBytesPerSecond ... - UnitDefinitionTypeBytesPerSecond UnitDefinitionType = "BytesPerSecond" - // UnitDefinitionTypeCount ... - UnitDefinitionTypeCount UnitDefinitionType = "Count" - // UnitDefinitionTypeCountPerSecond ... - UnitDefinitionTypeCountPerSecond UnitDefinitionType = "CountPerSecond" - // UnitDefinitionTypePercent ... - UnitDefinitionTypePercent UnitDefinitionType = "Percent" - // UnitDefinitionTypeSeconds ... - UnitDefinitionTypeSeconds UnitDefinitionType = "Seconds" + // Bytes ... + Bytes UnitDefinitionType = "Bytes" + // BytesPerSecond ... + BytesPerSecond UnitDefinitionType = "BytesPerSecond" + // Count ... + Count UnitDefinitionType = "Count" + // CountPerSecond ... + CountPerSecond UnitDefinitionType = "CountPerSecond" + // Percent ... + Percent UnitDefinitionType = "Percent" + // Seconds ... + Seconds UnitDefinitionType = "Seconds" ) // PossibleUnitDefinitionTypeValues returns an array of possible values for the UnitDefinitionType const type. func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { - return []UnitDefinitionType{UnitDefinitionTypeBytes, UnitDefinitionTypeBytesPerSecond, UnitDefinitionTypeCount, UnitDefinitionTypeCountPerSecond, UnitDefinitionTypePercent, UnitDefinitionTypeSeconds} + return []UnitDefinitionType{Bytes, BytesPerSecond, Count, CountPerSecond, Percent, Seconds} } // UnitType enumerates the values for unit type. diff --git a/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go b/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go index 4ff6cc74ad75..2d119e58fe0a 100644 --- a/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2017-03-01-preview/sql/models.go @@ -631,6 +631,9 @@ type DatabaseBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -3707,6 +3710,9 @@ type ExtendedDatabaseBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -4086,6 +4092,9 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -9288,11 +9297,11 @@ func (ma MetricAvailability) MarshalJSON() ([]byte, error) { type MetricDefinition struct { // Name - READ-ONLY; The name information for the metric. Name *MetricName `json:"name,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeCount', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeTotal' PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` // ResourceURI - READ-ONLY; The resource uri of the database. ResourceURI *string `json:"resourceUri,omitempty"` - // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitDefinitionTypeCount', 'UnitDefinitionTypeBytes', 'UnitDefinitionTypeSeconds', 'UnitDefinitionTypePercent', 'UnitDefinitionTypeCountPerSecond', 'UnitDefinitionTypeBytesPerSecond' + // Unit - READ-ONLY; The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond' Unit UnitDefinitionType `json:"unit,omitempty"` // MetricAvailabilities - READ-ONLY; The list of database metric availabilities for the metric. MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` @@ -10075,7 +10084,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { type ResourceIdentity struct { // PrincipalID - READ-ONLY; The Azure Active Directory principal id. PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // 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' + // 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: 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned' Type IdentityType `json:"type,omitempty"` // TenantID - READ-ONLY; The Azure Active Directory tenant id. TenantID *uuid.UUID `json:"tenantId,omitempty"` @@ -11687,6 +11696,9 @@ type ServerBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/CHANGELOG.md b/services/preview/sql/mgmt/2017-10-01-preview/sql/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/CHANGELOG.md +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/sql/mgmt/2017-10-01-preview/sql/_meta.json b/services/preview/sql/mgmt/2017-10-01-preview/sql/_meta.json index 4df1e8fcb670..6ea0e6ca18e1 100644 --- a/services/preview/sql/mgmt/2017-10-01-preview/sql/_meta.json +++ b/services/preview/sql/mgmt/2017-10-01-preview/sql/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "02a2528dc0ceeb13d8042069a07b450fe5353da2", "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", "tag": "package-pure-2017-10-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/sql/mgmt/2018-06-01-preview/sql/CHANGELOG.md b/services/preview/sql/mgmt/2018-06-01-preview/sql/CHANGELOG.md index 52911e4cc5e4..71c26d62a517 100644 --- a/services/preview/sql/mgmt/2018-06-01-preview/sql/CHANGELOG.md +++ b/services/preview/sql/mgmt/2018-06-01-preview/sql/CHANGELOG.md @@ -1,2 +1,28 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. SensitivityLabelRank.Critical +1. SensitivityLabelRank.High +1. SensitivityLabelRank.Low +1. SensitivityLabelRank.Medium + +### Signature Changes + +#### Const Types + +1. None changed type from SensitivityLabelRank to IdentityType + +## Additive Changes + +### New Constants + +1. IdentityType.SystemAssignedUserAssigned +1. IdentityType.UserAssigned +1. SensitivityLabelRank.SensitivityLabelRankCritical +1. SensitivityLabelRank.SensitivityLabelRankHigh +1. SensitivityLabelRank.SensitivityLabelRankLow +1. SensitivityLabelRank.SensitivityLabelRankMedium +1. SensitivityLabelRank.SensitivityLabelRankNone diff --git a/services/preview/sql/mgmt/2018-06-01-preview/sql/_meta.json b/services/preview/sql/mgmt/2018-06-01-preview/sql/_meta.json index 66cbec1fe487..a668119823fa 100644 --- a/services/preview/sql/mgmt/2018-06-01-preview/sql/_meta.json +++ b/services/preview/sql/mgmt/2018-06-01-preview/sql/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "02a2528dc0ceeb13d8042069a07b450fe5353da2", "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", "tag": "package-pure-2018-06-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/sql/mgmt/2018-06-01-preview/sql/enums.go b/services/preview/sql/mgmt/2018-06-01-preview/sql/enums.go index 1202e51a3fa1..612a61848f06 100644 --- a/services/preview/sql/mgmt/2018-06-01-preview/sql/enums.go +++ b/services/preview/sql/mgmt/2018-06-01-preview/sql/enums.go @@ -42,13 +42,19 @@ func PossibleDatabaseStateValues() []DatabaseState { type IdentityType string const ( + // None ... + None IdentityType = "None" // SystemAssigned ... SystemAssigned IdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" + // UserAssigned ... + UserAssigned IdentityType = "UserAssigned" ) // PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} + return []IdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} } // InstancePoolLicenseType enumerates the values for instance pool license type. @@ -218,21 +224,21 @@ func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { type SensitivityLabelRank string const ( - // Critical ... - Critical SensitivityLabelRank = "Critical" - // High ... - High SensitivityLabelRank = "High" - // Low ... - Low SensitivityLabelRank = "Low" - // Medium ... - Medium SensitivityLabelRank = "Medium" - // None ... - None SensitivityLabelRank = "None" + // SensitivityLabelRankCritical ... + SensitivityLabelRankCritical SensitivityLabelRank = "Critical" + // SensitivityLabelRankHigh ... + SensitivityLabelRankHigh SensitivityLabelRank = "High" + // SensitivityLabelRankLow ... + SensitivityLabelRankLow SensitivityLabelRank = "Low" + // SensitivityLabelRankMedium ... + SensitivityLabelRankMedium SensitivityLabelRank = "Medium" + // SensitivityLabelRankNone ... + SensitivityLabelRankNone SensitivityLabelRank = "None" ) // PossibleSensitivityLabelRankValues returns an array of possible values for the SensitivityLabelRank const type. func PossibleSensitivityLabelRankValues() []SensitivityLabelRank { - return []SensitivityLabelRank{Critical, High, Low, Medium, None} + return []SensitivityLabelRank{SensitivityLabelRankCritical, SensitivityLabelRankHigh, SensitivityLabelRankLow, SensitivityLabelRankMedium, SensitivityLabelRankNone} } // SensitivityLabelSource enumerates the values for sensitivity label source. diff --git a/services/preview/sql/mgmt/2018-06-01-preview/sql/models.go b/services/preview/sql/mgmt/2018-06-01-preview/sql/models.go index 78b6b544489e..83d18bb325c2 100644 --- a/services/preview/sql/mgmt/2018-06-01-preview/sql/models.go +++ b/services/preview/sql/mgmt/2018-06-01-preview/sql/models.go @@ -3801,7 +3801,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { type ResourceIdentity struct { // PrincipalID - READ-ONLY; The Azure Active Directory principal id. PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // 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' + // 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: 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned' Type IdentityType `json:"type,omitempty"` // TenantID - READ-ONLY; The Azure Active Directory tenant id. TenantID *uuid.UUID `json:"tenantId,omitempty"` @@ -4113,7 +4113,7 @@ type SensitivityLabelProperties struct { InformationTypeID *string `json:"informationTypeId,omitempty"` // 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. IsDisabled *bool `json:"isDisabled,omitempty"` - // Rank - Possible values include: 'None', 'Low', 'Medium', 'High', 'Critical' + // Rank - Possible values include: 'SensitivityLabelRankNone', 'SensitivityLabelRankLow', 'SensitivityLabelRankMedium', 'SensitivityLabelRankHigh', 'SensitivityLabelRankCritical' Rank SensitivityLabelRank `json:"rank,omitempty"` } diff --git a/services/preview/sql/mgmt/v3.0/sql/CHANGELOG.md b/services/preview/sql/mgmt/v3.0/sql/CHANGELOG.md index 52911e4cc5e4..7738e1339d5d 100644 --- a/services/preview/sql/mgmt/v3.0/sql/CHANGELOG.md +++ b/services/preview/sql/mgmt/v3.0/sql/CHANGELOG.md @@ -1,2 +1,126 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. PrimaryAggregationType.Average +1. PrimaryAggregationType.Maximum +1. PrimaryAggregationType.Minimum +1. PrimaryAggregationType.Total + +### Removed Funcs + +1. *ManagedDatabaseRestoreDetailsResult.UnmarshalJSON([]byte) error +1. ManagedDatabaseRestoreDetailsClient.Get(context.Context, string, string, string) (ManagedDatabaseRestoreDetailsResult, error) +1. ManagedDatabaseRestoreDetailsClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. ManagedDatabaseRestoreDetailsClient.GetResponder(*http.Response) (ManagedDatabaseRestoreDetailsResult, error) +1. ManagedDatabaseRestoreDetailsClient.GetSender(*http.Request) (*http.Response, error) +1. ManagedDatabaseRestoreDetailsProperties.MarshalJSON() ([]byte, error) +1. ManagedDatabaseRestoreDetailsResult.MarshalJSON() ([]byte, error) +1. NewManagedDatabaseRestoreDetailsClient(string) ManagedDatabaseRestoreDetailsClient +1. NewManagedDatabaseRestoreDetailsClientWithBaseURI(string, string) ManagedDatabaseRestoreDetailsClient + +### Struct Changes + +#### Removed Structs + +1. ManagedDatabaseRestoreDetailsClient +1. ManagedDatabaseRestoreDetailsProperties +1. ManagedDatabaseRestoreDetailsResult + +#### Removed Struct Fields + +1. DatabaseUpdate.*DatabaseProperties + +### Signature Changes + +#### Const Types + +1. Count changed type from PrimaryAggregationType to QueryMetricUnitType +1. None changed type from PrimaryAggregationType to IdentityType + +## Additive Changes + +### New Constants + +1. AggregationFunctionType.Avg +1. AggregationFunctionType.Max +1. AggregationFunctionType.Min +1. AggregationFunctionType.Stdev +1. AggregationFunctionType.Sum +1. IdentityType.SystemAssignedUserAssigned +1. IdentityType.UserAssigned +1. MetricType.CPU +1. MetricType.Dtu +1. MetricType.Duration +1. MetricType.Io +1. MetricType.LogIo +1. PrimaryAggregationType.PrimaryAggregationTypeAverage +1. PrimaryAggregationType.PrimaryAggregationTypeCount +1. PrimaryAggregationType.PrimaryAggregationTypeMaximum +1. PrimaryAggregationType.PrimaryAggregationTypeMinimum +1. PrimaryAggregationType.PrimaryAggregationTypeNone +1. PrimaryAggregationType.PrimaryAggregationTypeTotal +1. QueryMetricUnitType.KB +1. QueryMetricUnitType.Microseconds +1. QueryMetricUnitType.Percentage +1. QueryTimeGrainType.P1D +1. QueryTimeGrainType.PT1H + +### New Funcs + +1. *TopQueriesListResultIterator.Next() error +1. *TopQueriesListResultIterator.NextWithContext(context.Context) error +1. *TopQueriesListResultPage.Next() error +1. *TopQueriesListResultPage.NextWithContext(context.Context) error +1. DatabaseUpdateProperties.MarshalJSON() ([]byte, error) +1. ManagedInstancePecProperty.MarshalJSON() ([]byte, error) +1. ManagedInstancePrivateEndpointConnectionProperties.MarshalJSON() ([]byte, error) +1. ManagedInstancesClient.ListByManagedInstance(context.Context, string, string, *int32, string, string, string, QueryTimeGrainType, AggregationFunctionType, MetricType) (TopQueriesListResultPage, error) +1. ManagedInstancesClient.ListByManagedInstanceComplete(context.Context, string, string, *int32, string, string, string, QueryTimeGrainType, AggregationFunctionType, MetricType) (TopQueriesListResultIterator, error) +1. ManagedInstancesClient.ListByManagedInstancePreparer(context.Context, string, string, *int32, string, string, string, QueryTimeGrainType, AggregationFunctionType, MetricType) (*http.Request, error) +1. ManagedInstancesClient.ListByManagedInstanceResponder(*http.Response) (TopQueriesListResult, error) +1. ManagedInstancesClient.ListByManagedInstanceSender(*http.Request) (*http.Response, error) +1. NewTopQueriesListResultIterator(TopQueriesListResultPage) TopQueriesListResultIterator +1. NewTopQueriesListResultPage(TopQueriesListResult, func(context.Context, TopQueriesListResult) (TopQueriesListResult, error)) TopQueriesListResultPage +1. PossibleAggregationFunctionTypeValues() []AggregationFunctionType +1. PossibleMetricTypeValues() []MetricType +1. PossibleQueryMetricUnitTypeValues() []QueryMetricUnitType +1. PossibleQueryTimeGrainTypeValues() []QueryTimeGrainType +1. QueryMetricInterval.MarshalJSON() ([]byte, error) +1. QueryMetricProperties.MarshalJSON() ([]byte, error) +1. QueryStatisticsProperties.MarshalJSON() ([]byte, error) +1. TopQueries.MarshalJSON() ([]byte, error) +1. TopQueriesListResult.IsEmpty() bool +1. TopQueriesListResult.MarshalJSON() ([]byte, error) +1. TopQueriesListResultIterator.NotDone() bool +1. TopQueriesListResultIterator.Response() TopQueriesListResult +1. TopQueriesListResultIterator.Value() TopQueries +1. TopQueriesListResultPage.NotDone() bool +1. TopQueriesListResultPage.Response() TopQueriesListResult +1. TopQueriesListResultPage.Values() []TopQueries + +### Struct Changes + +#### New Structs + +1. DatabaseUpdateProperties +1. ManagedInstancePecProperty +1. ManagedInstancePrivateEndpointConnectionProperties +1. ManagedInstancePrivateEndpointProperty +1. QueryMetricInterval +1. QueryMetricProperties +1. QueryStatisticsProperties +1. TopQueries +1. TopQueriesListResult +1. TopQueriesListResultIterator +1. TopQueriesListResultPage + +#### New Struct Fields + +1. DatabaseProperties.SourceResourceID +1. DatabaseUpdate.*DatabaseUpdateProperties +1. ManagedInstanceProperties.PrivateEndpointConnections +1. ManagedInstanceProperties.ZoneRedundant +1. ManagedInstanceUpdate.Identity diff --git a/services/preview/sql/mgmt/v3.0/sql/_meta.json b/services/preview/sql/mgmt/v3.0/sql/_meta.json index 9a952e027cb6..ce63ac68fd99 100644 --- a/services/preview/sql/mgmt/v3.0/sql/_meta.json +++ b/services/preview/sql/mgmt/v3.0/sql/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "02a2528dc0ceeb13d8042069a07b450fe5353da2", "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", "tag": "package-composite-v3", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/sql/mgmt/v3.0/sql/enums.go b/services/preview/sql/mgmt/v3.0/sql/enums.go index fce7ec38a37f..ad274f8a6696 100644 --- a/services/preview/sql/mgmt/v3.0/sql/enums.go +++ b/services/preview/sql/mgmt/v3.0/sql/enums.go @@ -6,6 +6,27 @@ package sql // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// AggregationFunctionType enumerates the values for aggregation function type. +type AggregationFunctionType string + +const ( + // Avg ... + Avg AggregationFunctionType = "avg" + // Max ... + Max AggregationFunctionType = "max" + // Min ... + Min AggregationFunctionType = "min" + // Stdev ... + Stdev AggregationFunctionType = "stdev" + // Sum ... + Sum AggregationFunctionType = "sum" +) + +// PossibleAggregationFunctionTypeValues returns an array of possible values for the AggregationFunctionType const type. +func PossibleAggregationFunctionTypeValues() []AggregationFunctionType { + return []AggregationFunctionType{Avg, Max, Min, Stdev, Sum} +} + // AutomaticTuningDisabledReason enumerates the values for automatic tuning disabled reason. type AutomaticTuningDisabledReason string @@ -557,13 +578,19 @@ func PossibleGeoBackupPolicyStateValues() []GeoBackupPolicyState { type IdentityType string const ( + // None ... + None IdentityType = "None" // SystemAssigned ... SystemAssigned IdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" + // UserAssigned ... + UserAssigned IdentityType = "UserAssigned" ) // PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} + return []IdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} } // InstanceFailoverGroupReplicationRole enumerates the values for instance failover group replication role. @@ -911,6 +938,27 @@ func PossibleMaxSizeUnitValues() []MaxSizeUnit { return []MaxSizeUnit{MaxSizeUnitGigabytes, MaxSizeUnitMegabytes, MaxSizeUnitPetabytes, MaxSizeUnitTerabytes} } +// MetricType enumerates the values for metric type. +type MetricType string + +const ( + // CPU ... + CPU MetricType = "cpu" + // Dtu ... + Dtu MetricType = "dtu" + // Duration ... + Duration MetricType = "duration" + // Io ... + Io MetricType = "io" + // LogIo ... + LogIo MetricType = "logIo" +) + +// PossibleMetricTypeValues returns an array of possible values for the MetricType const type. +func PossibleMetricTypeValues() []MetricType { + return []MetricType{CPU, Dtu, Duration, Io, LogIo} +} + // OperationOrigin enumerates the values for operation origin. type OperationOrigin string @@ -958,23 +1006,23 @@ func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { type PrimaryAggregationType string const ( - // Average ... - Average PrimaryAggregationType = "Average" - // Count ... - Count PrimaryAggregationType = "Count" - // Maximum ... - Maximum PrimaryAggregationType = "Maximum" - // Minimum ... - Minimum PrimaryAggregationType = "Minimum" - // None ... - None PrimaryAggregationType = "None" - // Total ... - Total PrimaryAggregationType = "Total" + // PrimaryAggregationTypeAverage ... + PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" + // PrimaryAggregationTypeCount ... + PrimaryAggregationTypeCount PrimaryAggregationType = "Count" + // PrimaryAggregationTypeMaximum ... + PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" + // PrimaryAggregationTypeMinimum ... + PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" + // PrimaryAggregationTypeNone ... + PrimaryAggregationTypeNone PrimaryAggregationType = "None" + // PrimaryAggregationTypeTotal ... + PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" ) // PossiblePrimaryAggregationTypeValues returns an array of possible values for the PrimaryAggregationType const type. func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{Average, Count, Maximum, Minimum, None, Total} + return []PrimaryAggregationType{PrimaryAggregationTypeAverage, PrimaryAggregationTypeCount, PrimaryAggregationTypeMaximum, PrimaryAggregationTypeMinimum, PrimaryAggregationTypeNone, PrimaryAggregationTypeTotal} } // PrivateEndpointProvisioningState enumerates the values for private endpoint provisioning state. @@ -1076,6 +1124,40 @@ func PossibleProvisioningState1Values() []ProvisioningState1 { return []ProvisioningState1{ProvisioningState1Creating, ProvisioningState1Deleting, ProvisioningState1Failed, ProvisioningState1Succeeded, ProvisioningState1Unknown, ProvisioningState1Updating} } +// QueryMetricUnitType enumerates the values for query metric unit type. +type QueryMetricUnitType string + +const ( + // Count ... + Count QueryMetricUnitType = "count" + // KB ... + KB QueryMetricUnitType = "KB" + // Microseconds ... + Microseconds QueryMetricUnitType = "microseconds" + // Percentage ... + Percentage QueryMetricUnitType = "percentage" +) + +// PossibleQueryMetricUnitTypeValues returns an array of possible values for the QueryMetricUnitType const type. +func PossibleQueryMetricUnitTypeValues() []QueryMetricUnitType { + return []QueryMetricUnitType{Count, KB, Microseconds, Percentage} +} + +// QueryTimeGrainType enumerates the values for query time grain type. +type QueryTimeGrainType string + +const ( + // P1D ... + P1D QueryTimeGrainType = "P1D" + // PT1H ... + PT1H QueryTimeGrainType = "PT1H" +) + +// PossibleQueryTimeGrainTypeValues returns an array of possible values for the QueryTimeGrainType const type. +func PossibleQueryTimeGrainTypeValues() []QueryTimeGrainType { + return []QueryTimeGrainType{P1D, PT1H} +} + // ReadOnlyEndpointFailoverPolicy enumerates the values for read only endpoint failover policy. type ReadOnlyEndpointFailoverPolicy string diff --git a/services/preview/sql/mgmt/v3.0/sql/manageddatabaserestoredetails.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabaserestoredetails.go deleted file mode 100644 index 5c4455e7451c..000000000000 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabaserestoredetails.go +++ /dev/null @@ -1,122 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ManagedDatabaseRestoreDetailsClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type ManagedDatabaseRestoreDetailsClient struct { - BaseClient -} - -// NewManagedDatabaseRestoreDetailsClient creates an instance of the ManagedDatabaseRestoreDetailsClient client. -func NewManagedDatabaseRestoreDetailsClient(subscriptionID string) ManagedDatabaseRestoreDetailsClient { - return NewManagedDatabaseRestoreDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedDatabaseRestoreDetailsClientWithBaseURI creates an instance of the ManagedDatabaseRestoreDetailsClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewManagedDatabaseRestoreDetailsClientWithBaseURI(baseURI string, subscriptionID string) ManagedDatabaseRestoreDetailsClient { - return ManagedDatabaseRestoreDetailsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets managed database restore details. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. -// databaseName - the name of the database. -func (client ManagedDatabaseRestoreDetailsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabaseRestoreDetailsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseRestoreDetailsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabaseRestoreDetailsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseRestoreDetailsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseRestoreDetailsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseRestoreDetailsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedDatabaseRestoreDetailsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "managedInstanceName": autorest.Encode("path", managedInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "restoreDetailsName": autorest.Encode("path", "Default"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails/{restoreDetailsName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedDatabaseRestoreDetailsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ManagedDatabaseRestoreDetailsClient) GetResponder(resp *http.Response) (result ManagedDatabaseRestoreDetailsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/sql/mgmt/v3.0/sql/manageddatabases.go b/services/preview/sql/mgmt/v3.0/sql/manageddatabases.go index c9a950271bb9..cdb52af38d8a 100644 --- a/services/preview/sql/mgmt/v3.0/sql/manageddatabases.go +++ b/services/preview/sql/mgmt/v3.0/sql/manageddatabases.go @@ -36,7 +36,8 @@ func NewManagedDatabasesClientWithBaseURI(baseURI string, subscriptionID string) // CompleteRestore completes the restore operation on a managed database. // Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. // managedInstanceName - the name of the managed instance. // databaseName - the name of the database. // parameters - the definition for completing the restore of this managed database. @@ -52,10 +53,6 @@ func (client ManagedDatabasesClient) CompleteRestore(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LastBackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("sql.ManagedDatabasesClient", "CompleteRestore", err.Error()) @@ -129,7 +126,8 @@ func (client ManagedDatabasesClient) CompleteRestoreResponder(resp *http.Respons // CreateOrUpdate creates a new database or updates an existing database. // Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. // managedInstanceName - the name of the managed instance. // databaseName - the name of the database. // parameters - the requested database resource state. @@ -144,14 +142,6 @@ func (client ManagedDatabasesClient) CreateOrUpdate(ctx context.Context, resourc tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabasesClient", "CreateOrUpdate", err.Error()) - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") @@ -221,7 +211,8 @@ func (client ManagedDatabasesClient) CreateOrUpdateResponder(resp *http.Response // Delete deletes a managed database. // Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. // managedInstanceName - the name of the managed instance. // databaseName - the name of the database. func (client ManagedDatabasesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabasesDeleteFuture, err error) { @@ -235,14 +226,6 @@ func (client ManagedDatabasesClient) Delete(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabasesClient", "Delete", err.Error()) - } - req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, databaseName) if err != nil { err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Delete", nil, "Failure preparing request") @@ -309,7 +292,8 @@ func (client ManagedDatabasesClient) DeleteResponder(resp *http.Response) (resul // Get gets a managed database. // Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. // managedInstanceName - the name of the managed instance. // databaseName - the name of the database. func (client ManagedDatabasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result ManagedDatabase, err error) { @@ -323,14 +307,6 @@ func (client ManagedDatabasesClient) Get(ctx context.Context, resourceGroupName tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabasesClient", "Get", err.Error()) - } - req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName, databaseName) if err != nil { err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Get", nil, "Failure preparing request") @@ -395,7 +371,8 @@ func (client ManagedDatabasesClient) GetResponder(resp *http.Response) (result M // ListByInstance gets a list of managed databases. // Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. // managedInstanceName - the name of the managed instance. func (client ManagedDatabasesClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedDatabaseListResultPage, err error) { if tracing.IsEnabled() { @@ -408,14 +385,6 @@ func (client ManagedDatabasesClient) ListByInstance(ctx context.Context, resourc tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabasesClient", "ListByInstance", err.Error()) - } - result.fn = client.listByInstanceNextResults req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) if err != nil { @@ -521,7 +490,8 @@ func (client ManagedDatabasesClient) ListByInstanceComplete(ctx context.Context, // ListInaccessibleByInstance gets a list of inaccessible managed databases in a managed instance // Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. // managedInstanceName - the name of the managed instance. func (client ManagedDatabasesClient) ListInaccessibleByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedDatabaseListResultPage, err error) { if tracing.IsEnabled() { @@ -534,14 +504,6 @@ func (client ManagedDatabasesClient) ListInaccessibleByInstance(ctx context.Cont tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabasesClient", "ListInaccessibleByInstance", err.Error()) - } - result.fn = client.listInaccessibleByInstanceNextResults req, err := client.ListInaccessibleByInstancePreparer(ctx, resourceGroupName, managedInstanceName) if err != nil { @@ -647,7 +609,8 @@ func (client ManagedDatabasesClient) ListInaccessibleByInstanceComplete(ctx cont // Update updates an existing database. // Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. // managedInstanceName - the name of the managed instance. // databaseName - the name of the database. // parameters - the requested database resource state. @@ -662,14 +625,6 @@ func (client ManagedDatabasesClient) Update(ctx context.Context, resourceGroupNa tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedDatabasesClient", "Update", err.Error()) - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesClient", "Update", nil, "Failure preparing request") diff --git a/services/preview/sql/mgmt/v3.0/sql/managedinstances.go b/services/preview/sql/mgmt/v3.0/sql/managedinstances.go index 652a8d675c0e..3116dec56424 100644 --- a/services/preview/sql/mgmt/v3.0/sql/managedinstances.go +++ b/services/preview/sql/mgmt/v3.0/sql/managedinstances.go @@ -205,8 +205,9 @@ func (client ManagedInstancesClient) DeleteResponder(resp *http.Response) (resul // Failover failovers a managed instance. // Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// managedInstanceName - the name of the managed instance. +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance to failover. // replicaType - the type of replica to be failed over. func (client ManagedInstancesClient) Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType ReplicaType) (result ManagedInstancesFailoverFuture, err error) { if tracing.IsEnabled() { @@ -219,14 +220,6 @@ func (client ManagedInstancesClient) Failover(ctx context.Context, resourceGroup tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("sql.ManagedInstancesClient", "Failover", err.Error()) - } - req, err := client.FailoverPreparer(ctx, resourceGroupName, managedInstanceName, replicaType) if err != nil { err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "Failover", nil, "Failure preparing request") @@ -250,7 +243,7 @@ func (client ManagedInstancesClient) FailoverPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-06-01-preview" + const APIVersion = "2020-02-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -602,6 +595,154 @@ func (client ManagedInstancesClient) ListByInstancePoolComplete(ctx context.Cont return } +// ListByManagedInstance get top resource consuming queries of a managed instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// numberOfQueries - how many 'top queries' to return. Default is 5. +// databases - comma separated list of databases to be included into search. All DB's are included if this +// parameter is not specified. +// startTime - start time for observed period. +// endTime - end time for observed period. +// interval - the time step to be used to summarize the metric values. Default value is PT1H +// aggregationFunction - aggregation function to be used, default value is 'sum' +// observationMetric - metric to be used for ranking top queries. Default is 'cpu' +func (client ManagedInstancesClient) ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval QueryTimeGrainType, aggregationFunction AggregationFunctionType, observationMetric MetricType) (result TopQueriesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByManagedInstance") + defer func() { + sc := -1 + if result.tqlr.Response.Response != nil { + sc = result.tqlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByManagedInstanceNextResults + req, err := client.ListByManagedInstancePreparer(ctx, resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByManagedInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagedInstanceSender(req) + if err != nil { + result.tqlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByManagedInstance", resp, "Failure sending request") + return + } + + result.tqlr, err = client.ListByManagedInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "ListByManagedInstance", resp, "Failure responding to request") + return + } + if result.tqlr.hasNextLink() && result.tqlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByManagedInstancePreparer prepares the ListByManagedInstance request. +func (client ManagedInstancesClient) ListByManagedInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval QueryTimeGrainType, aggregationFunction AggregationFunctionType, observationMetric MetricType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if numberOfQueries != nil { + queryParameters["numberOfQueries"] = autorest.Encode("query", *numberOfQueries) + } + if len(databases) > 0 { + queryParameters["databases"] = autorest.Encode("query", databases) + } + if len(startTime) > 0 { + queryParameters["startTime"] = autorest.Encode("query", startTime) + } + if len(endTime) > 0 { + queryParameters["endTime"] = autorest.Encode("query", endTime) + } + if len(string(interval)) > 0 { + queryParameters["interval"] = autorest.Encode("query", interval) + } + if len(string(aggregationFunction)) > 0 { + queryParameters["aggregationFunction"] = autorest.Encode("query", aggregationFunction) + } + if len(string(observationMetric)) > 0 { + queryParameters["observationMetric"] = autorest.Encode("query", observationMetric) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByManagedInstanceSender sends the ListByManagedInstance request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstancesClient) ListByManagedInstanceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByManagedInstanceResponder handles the response to the ListByManagedInstance request. The method always +// closes the http.Response Body. +func (client ManagedInstancesClient) ListByManagedInstanceResponder(resp *http.Response) (result TopQueriesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByManagedInstanceNextResults retrieves the next set of results, if any. +func (client ManagedInstancesClient) listByManagedInstanceNextResults(ctx context.Context, lastResults TopQueriesListResult) (result TopQueriesListResult, err error) { + req, err := lastResults.topQueriesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByManagedInstanceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByManagedInstanceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByManagedInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByManagedInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesClient", "listByManagedInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByManagedInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedInstancesClient) ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval QueryTimeGrainType, aggregationFunction AggregationFunctionType, observationMetric MetricType) (result TopQueriesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancesClient.ListByManagedInstance") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByManagedInstance(ctx, resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric) + return +} + // ListByResourceGroup gets a list of managed instances in a resource group. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value diff --git a/services/preview/sql/mgmt/v3.0/sql/models.go b/services/preview/sql/mgmt/v3.0/sql/models.go index d1fabad574b4..b67382fd024d 100644 --- a/services/preview/sql/mgmt/v3.0/sql/models.go +++ b/services/preview/sql/mgmt/v3.0/sql/models.go @@ -1514,6 +1514,9 @@ type DatabaseBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -2083,6 +2086,20 @@ type DatabaseProperties struct { PausedDate *date.Time `json:"pausedDate,omitempty"` // ResumedDate - READ-ONLY; The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. ResumedDate *date.Time `json:"resumedDate,omitempty"` + // SourceResourceID - The resource identifier of the source associated with the create operation of this database. + // + // When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + // + // When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or existing sql pool, and restorePointInTime must be specified. + // + // When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. + // + // When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. + // + // This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + // + // When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + SourceResourceID *string `json:"sourceResourceId,omitempty"` } // MarshalJSON is the custom marshaler for DatabaseProperties. @@ -2148,6 +2165,9 @@ func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { if dp.MinCapacity != nil { objectMap["minCapacity"] = dp.MinCapacity } + if dp.SourceResourceID != nil { + objectMap["sourceResourceId"] = dp.SourceResourceID + } return json.Marshal(objectMap) } @@ -2595,12 +2615,12 @@ func (future *DatabasesUpgradeDataWarehouseFuture) result(client DatabasesClient return } -// DatabaseUpdate a database resource. +// DatabaseUpdate a database update resource. type DatabaseUpdate struct { // Sku - The name and tier of the SKU. Sku *Sku `json:"sku,omitempty"` - // DatabaseProperties - Resource properties. - *DatabaseProperties `json:"properties,omitempty"` + // DatabaseUpdateProperties - Resource properties. + *DatabaseUpdateProperties `json:"properties,omitempty"` // Tags - Resource tags. Tags map[string]*string `json:"tags"` } @@ -2611,8 +2631,8 @@ func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { if du.Sku != nil { objectMap["sku"] = du.Sku } - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties + if du.DatabaseUpdateProperties != nil { + objectMap["properties"] = du.DatabaseUpdateProperties } if du.Tags != nil { objectMap["tags"] = du.Tags @@ -2640,12 +2660,12 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { } case "properties": if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) + var databaseUpdateProperties DatabaseUpdateProperties + err = json.Unmarshal(*v, &databaseUpdateProperties) if err != nil { return err } - du.DatabaseProperties = &databaseProperties + du.DatabaseUpdateProperties = &databaseUpdateProperties } case "tags": if v != nil { @@ -2662,6 +2682,156 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { return nil } +// DatabaseUpdateProperties a database update properties. +type DatabaseUpdateProperties struct { + // CreateMode - Specifies the mode of database creation. + // + // Default: regular database creation. + // + // Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + // + // Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + // + // PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + // + // Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + // + // Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + // + // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + // + // Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'CreateModeDefault', 'CreateModeCopy', 'CreateModeSecondary', 'CreateModePointInTimeRestore', 'CreateModeRestore', 'CreateModeRecovery', 'CreateModeRestoreExternalBackup', 'CreateModeRestoreExternalBackupSecondary', 'CreateModeRestoreLongTermRetentionBackup', 'CreateModeOnlineSecondary' + CreateMode CreateMode `json:"createMode,omitempty"` + // Collation - The collation of the database. + Collation *string `json:"collation,omitempty"` + // MaxSizeBytes - The max size of the database expressed in bytes. + MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` + // SampleName - The name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + SampleName SampleName `json:"sampleName,omitempty"` + // ElasticPoolID - The resource identifier of the elastic pool containing this database. + ElasticPoolID *string `json:"elasticPoolId,omitempty"` + // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. + SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + // Status - READ-ONLY; The status of the database. Possible values include: 'DatabaseStatusOnline', 'DatabaseStatusRestoring', 'DatabaseStatusRecoveryPending', 'DatabaseStatusRecovering', 'DatabaseStatusSuspect', 'DatabaseStatusOffline', 'DatabaseStatusStandby', 'DatabaseStatusShutdown', 'DatabaseStatusEmergencyMode', 'DatabaseStatusAutoClosed', 'DatabaseStatusCopying', 'DatabaseStatusCreating', 'DatabaseStatusInaccessible', 'DatabaseStatusOfflineSecondary', 'DatabaseStatusPausing', 'DatabaseStatusPaused', 'DatabaseStatusResuming', 'DatabaseStatusScaling', 'DatabaseStatusOfflineChangingDwPerformanceTiers', 'DatabaseStatusOnlineChangingDwPerformanceTiers', 'DatabaseStatusDisabled' + Status DatabaseStatus `json:"status,omitempty"` + // DatabaseID - READ-ONLY; The ID of the database. + DatabaseID *uuid.UUID `json:"databaseId,omitempty"` + // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). + CreationDate *date.Time `json:"creationDate,omitempty"` + // CurrentServiceObjectiveName - READ-ONLY; The current service level objective name of the database. + CurrentServiceObjectiveName *string `json:"currentServiceObjectiveName,omitempty"` + // RequestedServiceObjectiveName - READ-ONLY; The requested service level objective name of the database. + RequestedServiceObjectiveName *string `json:"requestedServiceObjectiveName,omitempty"` + // DefaultSecondaryLocation - READ-ONLY; The default secondary region for this database. + DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` + // FailoverGroupID - READ-ONLY; Failover Group resource identifier that this database belongs to. + FailoverGroupID *string `json:"failoverGroupId,omitempty"` + // RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` + // SourceDatabaseDeletionDate - Specifies the time that the database was deleted. + SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` + // RecoveryServicesRecoveryPointID - The resource identifier of the recovery point associated with create operation of this database. + RecoveryServicesRecoveryPointID *string `json:"recoveryServicesRecoveryPointId,omitempty"` + // LongTermRetentionBackupResourceID - The resource identifier of the long term retention backup associated with create operation of this database. + LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` + // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. + RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` + // RestorableDroppedDatabaseID - The resource identifier of the restorable dropped database associated with create operation of this database. + RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` + // CatalogCollation - Collation of the metadata catalog. Possible values include: 'DATABASEDEFAULT', 'SQLLatin1GeneralCP1CIAS' + CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` + // ZoneRedundant - Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // LicenseType - The license type to apply for this database. `LicenseIncluded` if you need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. Possible values include: 'LicenseIncluded', 'BasePrice' + LicenseType DatabaseLicenseType `json:"licenseType,omitempty"` + // MaxLogSizeBytes - READ-ONLY; The max log size for this database. + MaxLogSizeBytes *int64 `json:"maxLogSizeBytes,omitempty"` + // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` + // ReadScale - The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'DatabaseReadScaleEnabled', 'DatabaseReadScaleDisabled' + ReadScale DatabaseReadScale `json:"readScale,omitempty"` + // ReadReplicaCount - The number of readonly secondary replicas associated with the database. + ReadReplicaCount *int32 `json:"readReplicaCount,omitempty"` + // CurrentSku - READ-ONLY; The name and tier of the SKU. + CurrentSku *Sku `json:"currentSku,omitempty"` + // AutoPauseDelay - Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled + AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` + // StorageAccountType - The storage account type used to store backups for this database. Possible values include: 'GRS', 'LRS', 'ZRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` + // MinCapacity - Minimal capacity that database will always have allocated, if not paused + MinCapacity *float64 `json:"minCapacity,omitempty"` + // PausedDate - READ-ONLY; The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. + PausedDate *date.Time `json:"pausedDate,omitempty"` + // ResumedDate - READ-ONLY; The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. + ResumedDate *date.Time `json:"resumedDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabaseUpdateProperties. +func (dup DatabaseUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dup.CreateMode != "" { + objectMap["createMode"] = dup.CreateMode + } + if dup.Collation != nil { + objectMap["collation"] = dup.Collation + } + if dup.MaxSizeBytes != nil { + objectMap["maxSizeBytes"] = dup.MaxSizeBytes + } + if dup.SampleName != "" { + objectMap["sampleName"] = dup.SampleName + } + if dup.ElasticPoolID != nil { + objectMap["elasticPoolId"] = dup.ElasticPoolID + } + if dup.SourceDatabaseID != nil { + objectMap["sourceDatabaseId"] = dup.SourceDatabaseID + } + if dup.RestorePointInTime != nil { + objectMap["restorePointInTime"] = dup.RestorePointInTime + } + if dup.SourceDatabaseDeletionDate != nil { + objectMap["sourceDatabaseDeletionDate"] = dup.SourceDatabaseDeletionDate + } + if dup.RecoveryServicesRecoveryPointID != nil { + objectMap["recoveryServicesRecoveryPointId"] = dup.RecoveryServicesRecoveryPointID + } + if dup.LongTermRetentionBackupResourceID != nil { + objectMap["longTermRetentionBackupResourceId"] = dup.LongTermRetentionBackupResourceID + } + if dup.RecoverableDatabaseID != nil { + objectMap["recoverableDatabaseId"] = dup.RecoverableDatabaseID + } + if dup.RestorableDroppedDatabaseID != nil { + objectMap["restorableDroppedDatabaseId"] = dup.RestorableDroppedDatabaseID + } + if dup.CatalogCollation != "" { + objectMap["catalogCollation"] = dup.CatalogCollation + } + if dup.ZoneRedundant != nil { + objectMap["zoneRedundant"] = dup.ZoneRedundant + } + if dup.LicenseType != "" { + objectMap["licenseType"] = dup.LicenseType + } + if dup.ReadScale != "" { + objectMap["readScale"] = dup.ReadScale + } + if dup.ReadReplicaCount != nil { + objectMap["readReplicaCount"] = dup.ReadReplicaCount + } + if dup.AutoPauseDelay != nil { + objectMap["autoPauseDelay"] = dup.AutoPauseDelay + } + if dup.StorageAccountType != "" { + objectMap["storageAccountType"] = dup.StorageAccountType + } + if dup.MinCapacity != nil { + objectMap["minCapacity"] = dup.MinCapacity + } + return json.Marshal(objectMap) +} + // DatabaseUsage the database usages. type DatabaseUsage struct { // Name - READ-ONLY; The name of the usage metric. @@ -5375,6 +5545,9 @@ type ExtendedDatabaseBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -5754,6 +5927,9 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -11153,109 +11329,6 @@ func (mdp ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ManagedDatabaseRestoreDetailsProperties the managed database's restore details properties. -type ManagedDatabaseRestoreDetailsProperties struct { - // Status - READ-ONLY; Restore status. - Status *string `json:"status,omitempty"` - // CurrentRestoringFileName - READ-ONLY; Current restoring file name. - CurrentRestoringFileName *string `json:"currentRestoringFileName,omitempty"` - // LastRestoredFileName - READ-ONLY; Last restored file name. - LastRestoredFileName *string `json:"lastRestoredFileName,omitempty"` - // LastRestoredFileTime - READ-ONLY; Last restored file time. - LastRestoredFileTime *date.Time `json:"lastRestoredFileTime,omitempty"` - // PercentCompleted - READ-ONLY; Percent completed. - PercentCompleted *float64 `json:"percentCompleted,omitempty"` - // UnrestorableFiles - READ-ONLY; List of unrestorable files. - UnrestorableFiles *[]string `json:"unrestorableFiles,omitempty"` - // NumberOfFilesDetected - READ-ONLY; Number of files detected. - NumberOfFilesDetected *int64 `json:"numberOfFilesDetected,omitempty"` - // LastUploadedFileName - READ-ONLY; Last uploaded file name. - LastUploadedFileName *string `json:"lastUploadedFileName,omitempty"` - // LastUploadedFileTime - READ-ONLY; Last uploaded file time. - LastUploadedFileTime *date.Time `json:"lastUploadedFileTime,omitempty"` - // BlockReason - READ-ONLY; The reason why restore is in Blocked state. - BlockReason *string `json:"blockReason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsProperties. -func (mdrdp ManagedDatabaseRestoreDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedDatabaseRestoreDetailsResult a managed database restore details. -type ManagedDatabaseRestoreDetailsResult struct { - autorest.Response `json:"-"` - // ManagedDatabaseRestoreDetailsProperties - Resource properties. - *ManagedDatabaseRestoreDetailsProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsResult. -func (mdrdr ManagedDatabaseRestoreDetailsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdrdr.ManagedDatabaseRestoreDetailsProperties != nil { - objectMap["properties"] = mdrdr.ManagedDatabaseRestoreDetailsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseRestoreDetailsResult struct. -func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedDatabaseRestoreDetailsProperties ManagedDatabaseRestoreDetailsProperties - err = json.Unmarshal(*v, &managedDatabaseRestoreDetailsProperties) - if err != nil { - return err - } - mdrdr.ManagedDatabaseRestoreDetailsProperties = &managedDatabaseRestoreDetailsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mdrdr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mdrdr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mdrdr.Type = &typeVar - } - } - } - - return nil -} - // ManagedDatabasesCompleteRestoreFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type ManagedDatabasesCompleteRestoreFuture struct { @@ -14315,6 +14388,48 @@ type ManagedInstancePairInfo struct { PartnerManagedInstanceID *string `json:"partnerManagedInstanceId,omitempty"` } +// ManagedInstancePecProperty a private endpoint connection under a managed instance +type ManagedInstancePecProperty struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Properties - READ-ONLY; Private endpoint connection properties + Properties *ManagedInstancePrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePecProperty. +func (mipp ManagedInstancePecProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstancePrivateEndpointConnectionProperties properties of a private endpoint connection. +type ManagedInstancePrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint which the connection belongs to. + PrivateEndpoint *ManagedInstancePrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. + PrivateLinkServiceConnectionState *ManagedInstancePrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; State of the Private Endpoint Connection. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateEndpointConnectionProperties. +func (mipecp ManagedInstancePrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mipecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = mipecp.PrivateEndpoint + } + if mipecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = mipecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// ManagedInstancePrivateEndpointProperty ... +type ManagedInstancePrivateEndpointProperty struct { + // ID - Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + // ManagedInstancePrivateLinkServiceConnectionStateProperty ... type ManagedInstancePrivateLinkServiceConnectionStateProperty struct { // Status - The private link service connection status. @@ -14388,10 +14503,14 @@ type ManagedInstanceProperties struct { InstancePoolID *string `json:"instancePoolId,omitempty"` // MaintenanceConfigurationID - Specifies maintenance configuration id to apply to this managed instance. MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections on a managed instance. + PrivateEndpointConnections *[]ManagedInstancePecProperty `json:"privateEndpointConnections,omitempty"` // MinimalTLSVersion - Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` // StorageAccountType - The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). Possible values include: 'GRS', 'LRS', 'ZRS' StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` + // ZoneRedundant - Whether or not the multi-az is enabled. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` } // MarshalJSON is the custom marshaler for ManagedInstanceProperties. @@ -14451,6 +14570,9 @@ func (mip ManagedInstanceProperties) MarshalJSON() ([]byte, error) { if mip.StorageAccountType != "" { objectMap["storageAccountType"] = mip.StorageAccountType } + if mip.ZoneRedundant != nil { + objectMap["zoneRedundant"] = mip.ZoneRedundant + } return json.Marshal(objectMap) } @@ -14655,6 +14777,8 @@ func (future *ManagedInstanceTdeCertificatesCreateFuture) result(client ManagedI type ManagedInstanceUpdate struct { // Sku - Managed instance sku Sku *Sku `json:"sku,omitempty"` + // Identity - Managed instance identity + Identity *ResourceIdentity `json:"identity,omitempty"` // ManagedInstanceProperties - Resource properties. *ManagedInstanceProperties `json:"properties,omitempty"` // Tags - Resource tags. @@ -14667,6 +14791,9 @@ func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) { if miu.Sku != nil { objectMap["sku"] = miu.Sku } + if miu.Identity != nil { + objectMap["identity"] = miu.Identity + } if miu.ManagedInstanceProperties != nil { objectMap["properties"] = miu.ManagedInstanceProperties } @@ -14694,6 +14821,15 @@ func (miu *ManagedInstanceUpdate) UnmarshalJSON(body []byte) error { } miu.Sku = &sku } + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + miu.Identity = &identity + } case "properties": if v != nil { var managedInstanceProperties ManagedInstanceProperties @@ -15472,7 +15608,7 @@ func (ma MetricAvailability) MarshalJSON() ([]byte, error) { type MetricDefinition struct { // Name - READ-ONLY; The name information for the metric. Name *MetricName `json:"name,omitempty"` - // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'PrimaryAggregationTypeNone', 'PrimaryAggregationTypeAverage', 'PrimaryAggregationTypeCount', 'PrimaryAggregationTypeMinimum', 'PrimaryAggregationTypeMaximum', 'PrimaryAggregationTypeTotal' PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` // ResourceURI - READ-ONLY; The resource uri of the database. ResourceURI *string `json:"resourceUri,omitempty"` @@ -16442,6 +16578,78 @@ func (pr ProxyResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// QueryMetricInterval properties of a query metrics interval. +type QueryMetricInterval struct { + // IntervalStartTime - READ-ONLY; The start time for the metric interval (ISO-8601 format). + IntervalStartTime *string `json:"intervalStartTime,omitempty"` + // IntervalType - READ-ONLY; Interval type (length). Possible values include: 'PT1H', 'P1D' + IntervalType QueryTimeGrainType `json:"intervalType,omitempty"` + // ExecutionCount - READ-ONLY; Execution count of a query in this interval. + ExecutionCount *int64 `json:"executionCount,omitempty"` + // Metrics - List of metric objects for this interval + Metrics *[]QueryMetricProperties `json:"metrics,omitempty"` +} + +// MarshalJSON is the custom marshaler for QueryMetricInterval. +func (qmi QueryMetricInterval) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qmi.Metrics != nil { + objectMap["metrics"] = qmi.Metrics + } + return json.Marshal(objectMap) +} + +// QueryMetricProperties properties of a topquery metric in one interval. +type QueryMetricProperties struct { + // Name - READ-ONLY; The name information for the metric. + Name *string `json:"name,omitempty"` + // DisplayName - READ-ONLY; The UI appropriate name for the metric. + DisplayName *string `json:"displayName,omitempty"` + // Unit - READ-ONLY; The unit of the metric. Possible values include: 'Percentage', 'KB', 'Microseconds', 'Count' + Unit QueryMetricUnitType `json:"unit,omitempty"` + // Value - READ-ONLY; The value of the metric. + Value *float64 `json:"value,omitempty"` + // Min - READ-ONLY; Metric value when min() aggregate function is used over the interval. + Min *float64 `json:"min,omitempty"` + // Max - READ-ONLY; Metric value when max() aggregate function is used over the interval. + Max *float64 `json:"max,omitempty"` + // Avg - READ-ONLY; Metric value when avg() aggregate function is used over the interval. + Avg *float64 `json:"avg,omitempty"` + // Sum - READ-ONLY; Metric value when sum() aggregate function is used over the interval. + Sum *float64 `json:"sum,omitempty"` + // Stdev - READ-ONLY; Metric value when stdev aggregate function is used over the interval. + Stdev *float64 `json:"stdev,omitempty"` +} + +// MarshalJSON is the custom marshaler for QueryMetricProperties. +func (qmp QueryMetricProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// QueryStatisticsProperties properties of a query execution statistics. +type QueryStatisticsProperties struct { + // DatabaseName - READ-ONLY; Database name of the database in which this query was executed. + DatabaseName *string `json:"databaseName,omitempty"` + // QueryID - READ-ONLY; Unique query id (unique within one database). + QueryID *string `json:"queryId,omitempty"` + // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). + StartTime *string `json:"startTime,omitempty"` + // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). + EndTime *string `json:"endTime,omitempty"` + // Intervals - List of intervals with appropriate metric data + Intervals *[]QueryMetricInterval `json:"intervals,omitempty"` +} + +// MarshalJSON is the custom marshaler for QueryStatisticsProperties. +func (qsp QueryStatisticsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qsp.Intervals != nil { + objectMap["intervals"] = qsp.Intervals + } + return json.Marshal(objectMap) +} + // ReadScaleCapability the read scale capability. type ReadScaleCapability struct { // MaxNumberOfReplicas - READ-ONLY; The maximum number of read scale replicas. @@ -17307,7 +17515,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { type ResourceIdentity struct { // PrincipalID - READ-ONLY; The Azure Active Directory principal id. PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // 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' + // 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: 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned' Type IdentityType `json:"type,omitempty"` // TenantID - READ-ONLY; The Azure Active Directory tenant id. TenantID *uuid.UUID `json:"tenantId,omitempty"` @@ -19047,6 +19255,9 @@ type ServerBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -24127,6 +24338,198 @@ func (future *TdeCertificatesCreateFuture) result(client TdeCertificatesClient) return } +// TopQueries ... +type TopQueries struct { + // NumberOfQueries - READ-ONLY; Requested number of top queries. + NumberOfQueries *int32 `json:"numberOfQueries,omitempty"` + // AggregationFunction - READ-ONLY; Aggregation function used to calculate query metrics. + AggregationFunction *string `json:"aggregationFunction,omitempty"` + // ObservationMetric - READ-ONLY; Metric used to rank queries. + ObservationMetric *string `json:"observationMetric,omitempty"` + // IntervalType - READ-ONLY; Interval type (length). Possible values include: 'PT1H', 'P1D' + IntervalType QueryTimeGrainType `json:"intervalType,omitempty"` + // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). + StartTime *string `json:"startTime,omitempty"` + // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). + EndTime *string `json:"endTime,omitempty"` + // Queries - List of top resource consuming queries with appropriate metric data + Queries *[]QueryStatisticsProperties `json:"queries,omitempty"` +} + +// MarshalJSON is the custom marshaler for TopQueries. +func (tq TopQueries) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tq.Queries != nil { + objectMap["queries"] = tq.Queries + } + return json.Marshal(objectMap) +} + +// TopQueriesListResult a list of top resource consuming queries on managed instance +type TopQueriesListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]TopQueries `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for TopQueriesListResult. +func (tqlr TopQueriesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// TopQueriesListResultIterator provides access to a complete listing of TopQueries values. +type TopQueriesListResultIterator struct { + i int + page TopQueriesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TopQueriesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopQueriesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TopQueriesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TopQueriesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TopQueriesListResultIterator) Response() TopQueriesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TopQueriesListResultIterator) Value() TopQueries { + if !iter.page.NotDone() { + return TopQueries{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TopQueriesListResultIterator type. +func NewTopQueriesListResultIterator(page TopQueriesListResultPage) TopQueriesListResultIterator { + return TopQueriesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tqlr TopQueriesListResult) IsEmpty() bool { + return tqlr.Value == nil || len(*tqlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tqlr TopQueriesListResult) hasNextLink() bool { + return tqlr.NextLink != nil && len(*tqlr.NextLink) != 0 +} + +// topQueriesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tqlr TopQueriesListResult) topQueriesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !tqlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tqlr.NextLink))) +} + +// TopQueriesListResultPage contains a page of TopQueries values. +type TopQueriesListResultPage struct { + fn func(context.Context, TopQueriesListResult) (TopQueriesListResult, error) + tqlr TopQueriesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TopQueriesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopQueriesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.tqlr) + if err != nil { + return err + } + page.tqlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TopQueriesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TopQueriesListResultPage) NotDone() bool { + return !page.tqlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TopQueriesListResultPage) Response() TopQueriesListResult { + return page.tqlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TopQueriesListResultPage) Values() []TopQueries { + if page.tqlr.IsEmpty() { + return nil + } + return *page.tqlr.Value +} + +// Creates a new instance of the TopQueriesListResultPage type. +func NewTopQueriesListResultPage(cur TopQueriesListResult, getNextPage func(context.Context, TopQueriesListResult) (TopQueriesListResult, error)) TopQueriesListResultPage { + return TopQueriesListResultPage{ + fn: getNextPage, + tqlr: cur, + } +} + // TrackedResource ARM tracked top level resource. type TrackedResource struct { // Location - Resource location. diff --git a/services/preview/sql/mgmt/v3.0/sql/privateendpointconnections.go b/services/preview/sql/mgmt/v3.0/sql/privateendpointconnections.go index d66b3e5f3f61..9fcd87b43a29 100644 --- a/services/preview/sql/mgmt/v3.0/sql/privateendpointconnections.go +++ b/services/preview/sql/mgmt/v3.0/sql/privateendpointconnections.go @@ -83,7 +83,7 @@ func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -166,7 +166,7 @@ func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -254,7 +254,7 @@ func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -336,7 +336,7 @@ func (client PrivateEndpointConnectionsClient) ListByServerPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go index 4fb675257b85..3aea59e1830e 100644 --- a/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/v3.0/sql/sqlapi/interfaces.go @@ -807,17 +807,6 @@ type UsagesClientAPI interface { var _ UsagesClientAPI = (*sql.UsagesClient)(nil) -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters sql.PrivateEndpointConnection) (result sql.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnection, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*sql.PrivateEndpointConnectionsClient)(nil) - // PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. type PrivateLinkResourcesClientAPI interface { Get(ctx context.Context, resourceGroupName string, serverName string, groupName string) (result sql.PrivateLinkResource, err error) @@ -961,29 +950,12 @@ type SyncMembersClientAPI interface { var _ SyncMembersClientAPI = (*sql.SyncMembersClient)(nil) -// ManagedInstancesClientAPI contains the set of methods on the ManagedInstancesClient type. -type ManagedInstancesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstance) (result sql.ManagedInstancesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType sql.ReplicaType) (result sql.ManagedInstancesFailoverFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) - List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) - ListComplete(ctx context.Context) (result sql.ManagedInstanceListResultIterator, err error) - ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) - ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) -} - -var _ ManagedInstancesClientAPI = (*sql.ManagedInstancesClient)(nil) - -// ManagedDatabaseRestoreDetailsClientAPI contains the set of methods on the ManagedDatabaseRestoreDetailsClient type. -type ManagedDatabaseRestoreDetailsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string) (result sql.ManagedDatabaseRestoreDetailsResult, err error) +// ImportExportClientAPI contains the set of methods on the ImportExportClient type. +type ImportExportClientAPI interface { + Import(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ImportExistingDatabaseDefinition) (result sql.ImportExportImportFuture, err error) } -var _ ManagedDatabaseRestoreDetailsClientAPI = (*sql.ManagedDatabaseRestoreDetailsClient)(nil) +var _ ImportExportClientAPI = (*sql.ImportExportClient)(nil) // ManagedDatabasesClientAPI contains the set of methods on the ManagedDatabasesClient type. type ManagedDatabasesClientAPI interface { @@ -1011,12 +983,24 @@ type ServerAzureADOnlyAuthenticationsClientAPI interface { var _ ServerAzureADOnlyAuthenticationsClientAPI = (*sql.ServerAzureADOnlyAuthenticationsClient)(nil) -// ImportExportClientAPI contains the set of methods on the ImportExportClient type. -type ImportExportClientAPI interface { - Import(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.ImportExistingDatabaseDefinition) (result sql.ImportExportImportFuture, err error) +// ManagedInstancesClientAPI contains the set of methods on the ManagedInstancesClient type. +type ManagedInstancesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstance) (result sql.ManagedInstancesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) + Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType sql.ReplicaType) (result sql.ManagedInstancesFailoverFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstance, err error) + List(ctx context.Context) (result sql.ManagedInstanceListResultPage, err error) + ListComplete(ctx context.Context) (result sql.ManagedInstanceListResultIterator, err error) + ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultPage, err error) + ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string) (result sql.ManagedInstanceListResultIterator, err error) + ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval sql.QueryTimeGrainType, aggregationFunction sql.AggregationFunctionType, observationMetric sql.MetricType) (result sql.TopQueriesListResultPage, err error) + ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval sql.QueryTimeGrainType, aggregationFunction sql.AggregationFunctionType, observationMetric sql.MetricType) (result sql.TopQueriesListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result sql.ManagedInstanceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) } -var _ ImportExportClientAPI = (*sql.ImportExportClient)(nil) +var _ ManagedInstancesClientAPI = (*sql.ManagedInstancesClient)(nil) // ManagedInstanceAzureADOnlyAuthenticationsClientAPI contains the set of methods on the ManagedInstanceAzureADOnlyAuthenticationsClient type. type ManagedInstanceAzureADOnlyAuthenticationsClientAPI interface { @@ -1041,3 +1025,14 @@ type ServerTrustGroupsClientAPI interface { } var _ ServerTrustGroupsClientAPI = (*sql.ServerTrustGroupsClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters sql.PrivateEndpointConnection) (result sql.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnection, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultPage, err error) + ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultIterator, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*sql.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/sql/mgmt/v4.0/sql/CHANGELOG.md b/services/preview/sql/mgmt/v4.0/sql/CHANGELOG.md index 52911e4cc5e4..0e6c7a6ac2ec 100644 --- a/services/preview/sql/mgmt/v4.0/sql/CHANGELOG.md +++ b/services/preview/sql/mgmt/v4.0/sql/CHANGELOG.md @@ -1,2 +1,336 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. DatabaseState2.DatabaseState2All +1. DatabaseState2.DatabaseState2Deleted +1. DatabaseState2.DatabaseState2Live +1. DatabaseState3.DatabaseState3All +1. DatabaseState3.DatabaseState3Deleted +1. DatabaseState3.DatabaseState3Live +1. DatabaseState4.DatabaseState4All +1. DatabaseState4.DatabaseState4Deleted +1. DatabaseState4.DatabaseState4Live +1. DatabaseState5.DatabaseState5All +1. DatabaseState5.DatabaseState5Deleted +1. DatabaseState5.DatabaseState5Live +1. DatabaseState6.DatabaseState6All +1. DatabaseState6.DatabaseState6Deleted +1. DatabaseState6.DatabaseState6Live +1. LongTermRetentionDatabaseState.LongTermRetentionDatabaseStateAll +1. LongTermRetentionDatabaseState.LongTermRetentionDatabaseStateDeleted +1. LongTermRetentionDatabaseState.LongTermRetentionDatabaseStateLive +1. SecondaryType.Named + +### Removed Funcs + +1. *BackupLongTermRetentionPoliciesCreateOrUpdateFuture.UnmarshalJSON([]byte) error +1. *BackupLongTermRetentionPolicy.UnmarshalJSON([]byte) error +1. BackupLongTermRetentionPoliciesClient.CreateOrUpdate(context.Context, string, string, string, BackupLongTermRetentionPolicy) (BackupLongTermRetentionPoliciesCreateOrUpdateFuture, error) +1. BackupLongTermRetentionPoliciesClient.CreateOrUpdatePreparer(context.Context, string, string, string, BackupLongTermRetentionPolicy) (*http.Request, error) +1. BackupLongTermRetentionPoliciesClient.CreateOrUpdateResponder(*http.Response) (BackupLongTermRetentionPolicy, error) +1. BackupLongTermRetentionPoliciesClient.CreateOrUpdateSender(*http.Request) (BackupLongTermRetentionPoliciesCreateOrUpdateFuture, error) +1. BackupLongTermRetentionPoliciesClient.Get(context.Context, string, string, string) (BackupLongTermRetentionPolicy, error) +1. BackupLongTermRetentionPoliciesClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. BackupLongTermRetentionPoliciesClient.GetResponder(*http.Response) (BackupLongTermRetentionPolicy, error) +1. BackupLongTermRetentionPoliciesClient.GetSender(*http.Request) (*http.Response, error) +1. BackupLongTermRetentionPoliciesClient.ListByDatabase(context.Context, string, string, string) (BackupLongTermRetentionPolicy, error) +1. BackupLongTermRetentionPoliciesClient.ListByDatabasePreparer(context.Context, string, string, string) (*http.Request, error) +1. BackupLongTermRetentionPoliciesClient.ListByDatabaseResponder(*http.Response) (BackupLongTermRetentionPolicy, error) +1. BackupLongTermRetentionPoliciesClient.ListByDatabaseSender(*http.Request) (*http.Response, error) +1. BackupLongTermRetentionPolicy.MarshalJSON() ([]byte, error) +1. NewBackupLongTermRetentionPoliciesClient(string) BackupLongTermRetentionPoliciesClient +1. NewBackupLongTermRetentionPoliciesClientWithBaseURI(string, string) BackupLongTermRetentionPoliciesClient +1. PossibleDatabaseState1Values() []DatabaseState1 +1. PossibleDatabaseState2Values() []DatabaseState2 +1. PossibleDatabaseState3Values() []DatabaseState3 +1. PossibleDatabaseState4Values() []DatabaseState4 +1. PossibleDatabaseState5Values() []DatabaseState5 +1. PossibleDatabaseState6Values() []DatabaseState6 +1. PossibleLongTermRetentionDatabaseStateValues() []LongTermRetentionDatabaseState +1. SystemData.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### Removed Structs + +1. BackupLongTermRetentionPoliciesClient +1. BackupLongTermRetentionPoliciesCreateOrUpdateFuture +1. BackupLongTermRetentionPolicy +1. LongTermRetentionPolicyProperties + +#### Removed Struct Fields + +1. DatabaseProperties.StorageAccountType + +### Signature Changes + +#### Const Types + +1. All changed type from DatabaseState1 to DatabaseState +1. Deleted changed type from DatabaseState1 to DatabaseState +1. Geo changed type from SecondaryType to BackupStorageRedundancy +1. Live changed type from DatabaseState1 to DatabaseState + +#### Funcs + +1. LongTermRetentionBackupsClient.ListByDatabase + - Params + - From: context.Context, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByDatabaseComplete + - Params + - From: context.Context, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByDatabasePreparer + - Params + - From: context.Context, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByLocation + - Params + - From: context.Context, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByLocationComplete + - Params + - From: context.Context, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByLocationPreparer + - Params + - From: context.Context, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupDatabase + - Params + - From: context.Context, string, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupDatabaseComplete + - Params + - From: context.Context, string, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupDatabasePreparer + - Params + - From: context.Context, string, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupLocation + - Params + - From: context.Context, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupLocationComplete + - Params + - From: context.Context, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupLocationPreparer + - Params + - From: context.Context, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupServer + - Params + - From: context.Context, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupServerComplete + - Params + - From: context.Context, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByResourceGroupServerPreparer + - Params + - From: context.Context, string, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByServer + - Params + - From: context.Context, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByServerComplete + - Params + - From: context.Context, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionBackupsClient.ListByServerPreparer + - Params + - From: context.Context, string, string, *bool, LongTermRetentionDatabaseState + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByDatabase + - Params + - From: context.Context, string, string, string, *bool, DatabaseState1 + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByDatabaseComplete + - Params + - From: context.Context, string, string, string, *bool, DatabaseState1 + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByDatabasePreparer + - Params + - From: context.Context, string, string, string, *bool, DatabaseState1 + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByInstance + - Params + - From: context.Context, string, string, *bool, DatabaseState2 + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByInstanceComplete + - Params + - From: context.Context, string, string, *bool, DatabaseState2 + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByInstancePreparer + - Params + - From: context.Context, string, string, *bool, DatabaseState2 + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByLocation + - Params + - From: context.Context, string, *bool, DatabaseState3 + - To: context.Context, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByLocationComplete + - Params + - From: context.Context, string, *bool, DatabaseState3 + - To: context.Context, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByLocationPreparer + - Params + - From: context.Context, string, *bool, DatabaseState3 + - To: context.Context, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupDatabase + - Params + - From: context.Context, string, string, string, string, *bool, DatabaseState4 + - To: context.Context, string, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupDatabaseComplete + - Params + - From: context.Context, string, string, string, string, *bool, DatabaseState4 + - To: context.Context, string, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupDatabasePreparer + - Params + - From: context.Context, string, string, string, string, *bool, DatabaseState4 + - To: context.Context, string, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupInstance + - Params + - From: context.Context, string, string, string, *bool, DatabaseState5 + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupInstanceComplete + - Params + - From: context.Context, string, string, string, *bool, DatabaseState5 + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupInstancePreparer + - Params + - From: context.Context, string, string, string, *bool, DatabaseState5 + - To: context.Context, string, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupLocation + - Params + - From: context.Context, string, string, *bool, DatabaseState6 + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupLocationComplete + - Params + - From: context.Context, string, string, *bool, DatabaseState6 + - To: context.Context, string, string, *bool, DatabaseState +1. LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupLocationPreparer + - Params + - From: context.Context, string, string, *bool, DatabaseState6 + - To: context.Context, string, string, *bool, DatabaseState + +## Additive Changes + +### New Constants + +1. BackupStorageRedundancy.Local +1. BackupStorageRedundancy.Zone +1. CurrentBackupStorageRedundancy.CurrentBackupStorageRedundancyGeo +1. CurrentBackupStorageRedundancy.CurrentBackupStorageRedundancyLocal +1. CurrentBackupStorageRedundancy.CurrentBackupStorageRedundancyZone +1. IdentityType.SystemAssignedUserAssigned +1. RequestedBackupStorageRedundancy.RequestedBackupStorageRedundancyGeo +1. RequestedBackupStorageRedundancy.RequestedBackupStorageRedundancyLocal +1. RequestedBackupStorageRedundancy.RequestedBackupStorageRedundancyZone +1. SecondaryType.SecondaryTypeGeo +1. SecondaryType.SecondaryTypeNamed +1. TargetBackupStorageRedundancy.TargetBackupStorageRedundancyGeo +1. TargetBackupStorageRedundancy.TargetBackupStorageRedundancyLocal +1. TargetBackupStorageRedundancy.TargetBackupStorageRedundancyZone + +### New Funcs + +1. *CopyLongTermRetentionBackupParameters.UnmarshalJSON([]byte) error +1. *LongTermRetentionBackupOperationResult.UnmarshalJSON([]byte) error +1. *LongTermRetentionBackupsCopyByResourceGroupFuture.UnmarshalJSON([]byte) error +1. *LongTermRetentionBackupsCopyFuture.UnmarshalJSON([]byte) error +1. *LongTermRetentionBackupsUpdateByResourceGroupFuture.UnmarshalJSON([]byte) error +1. *LongTermRetentionBackupsUpdateFuture.UnmarshalJSON([]byte) error +1. *LongTermRetentionPoliciesCreateOrUpdateFuture.UnmarshalJSON([]byte) error +1. *LongTermRetentionPolicy.UnmarshalJSON([]byte) error +1. *LongTermRetentionPolicyListResultIterator.Next() error +1. *LongTermRetentionPolicyListResultIterator.NextWithContext(context.Context) error +1. *LongTermRetentionPolicyListResultPage.Next() error +1. *LongTermRetentionPolicyListResultPage.NextWithContext(context.Context) error +1. *UpdateLongTermRetentionBackupParameters.UnmarshalJSON([]byte) error +1. CopyLongTermRetentionBackupParameters.MarshalJSON() ([]byte, error) +1. LongTermRetentionBackupOperationResult.MarshalJSON() ([]byte, error) +1. LongTermRetentionBackupsClient.Copy(context.Context, string, string, string, string, CopyLongTermRetentionBackupParameters) (LongTermRetentionBackupsCopyFuture, error) +1. LongTermRetentionBackupsClient.CopyByResourceGroup(context.Context, string, string, string, string, string, CopyLongTermRetentionBackupParameters) (LongTermRetentionBackupsCopyByResourceGroupFuture, error) +1. LongTermRetentionBackupsClient.CopyByResourceGroupPreparer(context.Context, string, string, string, string, string, CopyLongTermRetentionBackupParameters) (*http.Request, error) +1. LongTermRetentionBackupsClient.CopyByResourceGroupResponder(*http.Response) (LongTermRetentionBackupOperationResult, error) +1. LongTermRetentionBackupsClient.CopyByResourceGroupSender(*http.Request) (LongTermRetentionBackupsCopyByResourceGroupFuture, error) +1. LongTermRetentionBackupsClient.CopyPreparer(context.Context, string, string, string, string, CopyLongTermRetentionBackupParameters) (*http.Request, error) +1. LongTermRetentionBackupsClient.CopyResponder(*http.Response) (LongTermRetentionBackupOperationResult, error) +1. LongTermRetentionBackupsClient.CopySender(*http.Request) (LongTermRetentionBackupsCopyFuture, error) +1. LongTermRetentionBackupsClient.Update(context.Context, string, string, string, string, UpdateLongTermRetentionBackupParameters) (LongTermRetentionBackupsUpdateFuture, error) +1. LongTermRetentionBackupsClient.UpdateByResourceGroup(context.Context, string, string, string, string, string, UpdateLongTermRetentionBackupParameters) (LongTermRetentionBackupsUpdateByResourceGroupFuture, error) +1. LongTermRetentionBackupsClient.UpdateByResourceGroupPreparer(context.Context, string, string, string, string, string, UpdateLongTermRetentionBackupParameters) (*http.Request, error) +1. LongTermRetentionBackupsClient.UpdateByResourceGroupResponder(*http.Response) (LongTermRetentionBackupOperationResult, error) +1. LongTermRetentionBackupsClient.UpdateByResourceGroupSender(*http.Request) (LongTermRetentionBackupsUpdateByResourceGroupFuture, error) +1. LongTermRetentionBackupsClient.UpdatePreparer(context.Context, string, string, string, string, UpdateLongTermRetentionBackupParameters) (*http.Request, error) +1. LongTermRetentionBackupsClient.UpdateResponder(*http.Response) (LongTermRetentionBackupOperationResult, error) +1. LongTermRetentionBackupsClient.UpdateSender(*http.Request) (LongTermRetentionBackupsUpdateFuture, error) +1. LongTermRetentionOperationResultProperties.MarshalJSON() ([]byte, error) +1. LongTermRetentionPoliciesClient.CreateOrUpdate(context.Context, string, string, string, LongTermRetentionPolicy) (LongTermRetentionPoliciesCreateOrUpdateFuture, error) +1. LongTermRetentionPoliciesClient.CreateOrUpdatePreparer(context.Context, string, string, string, LongTermRetentionPolicy) (*http.Request, error) +1. LongTermRetentionPoliciesClient.CreateOrUpdateResponder(*http.Response) (LongTermRetentionPolicy, error) +1. LongTermRetentionPoliciesClient.CreateOrUpdateSender(*http.Request) (LongTermRetentionPoliciesCreateOrUpdateFuture, error) +1. LongTermRetentionPoliciesClient.Get(context.Context, string, string, string) (LongTermRetentionPolicy, error) +1. LongTermRetentionPoliciesClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. LongTermRetentionPoliciesClient.GetResponder(*http.Response) (LongTermRetentionPolicy, error) +1. LongTermRetentionPoliciesClient.GetSender(*http.Request) (*http.Response, error) +1. LongTermRetentionPoliciesClient.ListByDatabase(context.Context, string, string, string) (LongTermRetentionPolicyListResultPage, error) +1. LongTermRetentionPoliciesClient.ListByDatabaseComplete(context.Context, string, string, string) (LongTermRetentionPolicyListResultIterator, error) +1. LongTermRetentionPoliciesClient.ListByDatabasePreparer(context.Context, string, string, string) (*http.Request, error) +1. LongTermRetentionPoliciesClient.ListByDatabaseResponder(*http.Response) (LongTermRetentionPolicyListResult, error) +1. LongTermRetentionPoliciesClient.ListByDatabaseSender(*http.Request) (*http.Response, error) +1. LongTermRetentionPolicy.MarshalJSON() ([]byte, error) +1. LongTermRetentionPolicyListResult.IsEmpty() bool +1. LongTermRetentionPolicyListResult.MarshalJSON() ([]byte, error) +1. LongTermRetentionPolicyListResultIterator.NotDone() bool +1. LongTermRetentionPolicyListResultIterator.Response() LongTermRetentionPolicyListResult +1. LongTermRetentionPolicyListResultIterator.Value() LongTermRetentionPolicy +1. LongTermRetentionPolicyListResultPage.NotDone() bool +1. LongTermRetentionPolicyListResultPage.Response() LongTermRetentionPolicyListResult +1. LongTermRetentionPolicyListResultPage.Values() []LongTermRetentionPolicy +1. NewLongTermRetentionPoliciesClient(string) LongTermRetentionPoliciesClient +1. NewLongTermRetentionPoliciesClientWithBaseURI(string, string) LongTermRetentionPoliciesClient +1. NewLongTermRetentionPolicyListResultIterator(LongTermRetentionPolicyListResultPage) LongTermRetentionPolicyListResultIterator +1. NewLongTermRetentionPolicyListResultPage(LongTermRetentionPolicyListResult, func(context.Context, LongTermRetentionPolicyListResult) (LongTermRetentionPolicyListResult, error)) LongTermRetentionPolicyListResultPage +1. PossibleBackupStorageRedundancyValues() []BackupStorageRedundancy +1. PossibleCurrentBackupStorageRedundancyValues() []CurrentBackupStorageRedundancy +1. PossibleDatabaseStateValues() []DatabaseState +1. PossibleRequestedBackupStorageRedundancyValues() []RequestedBackupStorageRedundancy +1. PossibleTargetBackupStorageRedundancyValues() []TargetBackupStorageRedundancy +1. UpdateLongTermRetentionBackupParameters.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. CopyLongTermRetentionBackupParameters +1. CopyLongTermRetentionBackupParametersProperties +1. LongTermRetentionBackupOperationResult +1. LongTermRetentionBackupsCopyByResourceGroupFuture +1. LongTermRetentionBackupsCopyFuture +1. LongTermRetentionBackupsUpdateByResourceGroupFuture +1. LongTermRetentionBackupsUpdateFuture +1. LongTermRetentionOperationResultProperties +1. LongTermRetentionPoliciesClient +1. LongTermRetentionPoliciesCreateOrUpdateFuture +1. LongTermRetentionPolicy +1. LongTermRetentionPolicyListResult +1. LongTermRetentionPolicyListResultIterator +1. LongTermRetentionPolicyListResultPage +1. UpdateLongTermRetentionBackupParameters +1. UpdateLongTermRetentionBackupParametersProperties + +#### New Struct Fields + +1. DatabaseProperties.CurrentBackupStorageRedundancy +1. DatabaseProperties.RequestedBackupStorageRedundancy +1. LongTermRetentionBackupProperties.BackupStorageRedundancy +1. LongTermRetentionBackupProperties.RequestedBackupStorageRedundancy diff --git a/services/preview/sql/mgmt/v4.0/sql/_meta.json b/services/preview/sql/mgmt/v4.0/sql/_meta.json index bb735559bd7b..5075537762eb 100644 --- a/services/preview/sql/mgmt/v4.0/sql/_meta.json +++ b/services/preview/sql/mgmt/v4.0/sql/_meta.json @@ -1,5 +1,5 @@ { - "commit": "a1eee0489c374782a934ec1f093abd16fa7718ca", + "commit": "02a2528dc0ceeb13d8042069a07b450fe5353da2", "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", "tag": "package-composite-v4", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/sql/mgmt/v4.0/sql/databases.go b/services/preview/sql/mgmt/v4.0/sql/databases.go index 95d7c44d9246..52dec36114dd 100644 --- a/services/preview/sql/mgmt/v4.0/sql/databases.go +++ b/services/preview/sql/mgmt/v4.0/sql/databases.go @@ -86,7 +86,7 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -172,7 +172,7 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -348,7 +348,7 @@ func (client DatabasesClient) FailoverPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -439,7 +439,7 @@ func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -523,7 +523,7 @@ func (client DatabasesClient) ListByElasticPoolPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -642,7 +642,7 @@ func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -761,7 +761,7 @@ func (client DatabasesClient) ListInaccessibleByServerPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1030,7 +1030,7 @@ func (client DatabasesClient) PausePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1126,7 +1126,7 @@ func (client DatabasesClient) RenamePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1199,7 +1199,7 @@ func (client DatabasesClient) ResumePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1282,7 +1282,7 @@ func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1366,7 +1366,7 @@ func (client DatabasesClient) UpgradeDataWarehousePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-08-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v4.0/sql/enums.go b/services/preview/sql/mgmt/v4.0/sql/enums.go index eb3318b849a1..cc861f6c6013 100644 --- a/services/preview/sql/mgmt/v4.0/sql/enums.go +++ b/services/preview/sql/mgmt/v4.0/sql/enums.go @@ -137,6 +137,23 @@ func PossibleAutomaticTuningServerReasonValues() []AutomaticTuningServerReason { return []AutomaticTuningServerReason{AutomaticTuningServerReasonAutoConfigured, AutomaticTuningServerReasonDefault, AutomaticTuningServerReasonDisabled} } +// BackupStorageRedundancy enumerates the values for backup storage redundancy. +type BackupStorageRedundancy string + +const ( + // Geo ... + Geo BackupStorageRedundancy = "Geo" + // Local ... + Local BackupStorageRedundancy = "Local" + // Zone ... + Zone BackupStorageRedundancy = "Zone" +) + +// PossibleBackupStorageRedundancyValues returns an array of possible values for the BackupStorageRedundancy const type. +func PossibleBackupStorageRedundancyValues() []BackupStorageRedundancy { + return []BackupStorageRedundancy{Geo, Local, Zone} +} + // BlobAuditingPolicyState enumerates the values for blob auditing policy state. type BlobAuditingPolicyState string @@ -272,6 +289,23 @@ func PossibleCreateModeValues() []CreateMode { return []CreateMode{CreateModeCopy, CreateModeDefault, CreateModeOnlineSecondary, CreateModePointInTimeRestore, CreateModeRecovery, CreateModeRestore, CreateModeRestoreExternalBackup, CreateModeRestoreExternalBackupSecondary, CreateModeRestoreLongTermRetentionBackup, CreateModeSecondary} } +// CurrentBackupStorageRedundancy enumerates the values for current backup storage redundancy. +type CurrentBackupStorageRedundancy string + +const ( + // CurrentBackupStorageRedundancyGeo ... + CurrentBackupStorageRedundancyGeo CurrentBackupStorageRedundancy = "Geo" + // CurrentBackupStorageRedundancyLocal ... + CurrentBackupStorageRedundancyLocal CurrentBackupStorageRedundancy = "Local" + // CurrentBackupStorageRedundancyZone ... + CurrentBackupStorageRedundancyZone CurrentBackupStorageRedundancy = "Zone" +) + +// PossibleCurrentBackupStorageRedundancyValues returns an array of possible values for the CurrentBackupStorageRedundancy const type. +func PossibleCurrentBackupStorageRedundancyValues() []CurrentBackupStorageRedundancy { + return []CurrentBackupStorageRedundancy{CurrentBackupStorageRedundancyGeo, CurrentBackupStorageRedundancyLocal, CurrentBackupStorageRedundancyZone} +} + // DatabaseLicenseType enumerates the values for database license type. type DatabaseLicenseType string @@ -302,106 +336,21 @@ func PossibleDatabaseReadScaleValues() []DatabaseReadScale { return []DatabaseReadScale{DatabaseReadScaleDisabled, DatabaseReadScaleEnabled} } -// DatabaseState1 enumerates the values for database state 1. -type DatabaseState1 string +// DatabaseState enumerates the values for database state. +type DatabaseState string const ( // All ... - All DatabaseState1 = "All" + All DatabaseState = "All" // Deleted ... - Deleted DatabaseState1 = "Deleted" + Deleted DatabaseState = "Deleted" // Live ... - Live DatabaseState1 = "Live" -) - -// PossibleDatabaseState1Values returns an array of possible values for the DatabaseState1 const type. -func PossibleDatabaseState1Values() []DatabaseState1 { - return []DatabaseState1{All, Deleted, Live} -} - -// DatabaseState2 enumerates the values for database state 2. -type DatabaseState2 string - -const ( - // DatabaseState2All ... - DatabaseState2All DatabaseState2 = "All" - // DatabaseState2Deleted ... - DatabaseState2Deleted DatabaseState2 = "Deleted" - // DatabaseState2Live ... - DatabaseState2Live DatabaseState2 = "Live" -) - -// PossibleDatabaseState2Values returns an array of possible values for the DatabaseState2 const type. -func PossibleDatabaseState2Values() []DatabaseState2 { - return []DatabaseState2{DatabaseState2All, DatabaseState2Deleted, DatabaseState2Live} -} - -// DatabaseState3 enumerates the values for database state 3. -type DatabaseState3 string - -const ( - // DatabaseState3All ... - DatabaseState3All DatabaseState3 = "All" - // DatabaseState3Deleted ... - DatabaseState3Deleted DatabaseState3 = "Deleted" - // DatabaseState3Live ... - DatabaseState3Live DatabaseState3 = "Live" -) - -// PossibleDatabaseState3Values returns an array of possible values for the DatabaseState3 const type. -func PossibleDatabaseState3Values() []DatabaseState3 { - return []DatabaseState3{DatabaseState3All, DatabaseState3Deleted, DatabaseState3Live} -} - -// DatabaseState4 enumerates the values for database state 4. -type DatabaseState4 string - -const ( - // DatabaseState4All ... - DatabaseState4All DatabaseState4 = "All" - // DatabaseState4Deleted ... - DatabaseState4Deleted DatabaseState4 = "Deleted" - // DatabaseState4Live ... - DatabaseState4Live DatabaseState4 = "Live" + Live DatabaseState = "Live" ) -// PossibleDatabaseState4Values returns an array of possible values for the DatabaseState4 const type. -func PossibleDatabaseState4Values() []DatabaseState4 { - return []DatabaseState4{DatabaseState4All, DatabaseState4Deleted, DatabaseState4Live} -} - -// DatabaseState5 enumerates the values for database state 5. -type DatabaseState5 string - -const ( - // DatabaseState5All ... - DatabaseState5All DatabaseState5 = "All" - // DatabaseState5Deleted ... - DatabaseState5Deleted DatabaseState5 = "Deleted" - // DatabaseState5Live ... - DatabaseState5Live DatabaseState5 = "Live" -) - -// PossibleDatabaseState5Values returns an array of possible values for the DatabaseState5 const type. -func PossibleDatabaseState5Values() []DatabaseState5 { - return []DatabaseState5{DatabaseState5All, DatabaseState5Deleted, DatabaseState5Live} -} - -// DatabaseState6 enumerates the values for database state 6. -type DatabaseState6 string - -const ( - // DatabaseState6All ... - DatabaseState6All DatabaseState6 = "All" - // DatabaseState6Deleted ... - DatabaseState6Deleted DatabaseState6 = "Deleted" - // DatabaseState6Live ... - DatabaseState6Live DatabaseState6 = "Live" -) - -// PossibleDatabaseState6Values returns an array of possible values for the DatabaseState6 const type. -func PossibleDatabaseState6Values() []DatabaseState6 { - return []DatabaseState6{DatabaseState6All, DatabaseState6Deleted, DatabaseState6Live} +// PossibleDatabaseStateValues returns an array of possible values for the DatabaseState const type. +func PossibleDatabaseStateValues() []DatabaseState { + return []DatabaseState{All, Deleted, Live} } // DatabaseStatus enumerates the values for database status. @@ -601,13 +550,15 @@ const ( None IdentityType = "None" // SystemAssigned ... SystemAssigned IdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" // UserAssigned ... UserAssigned IdentityType = "UserAssigned" ) // PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{None, SystemAssigned, UserAssigned} + return []IdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} } // InstanceFailoverGroupReplicationRole enumerates the values for instance failover group replication role. @@ -803,23 +754,6 @@ func PossibleLogSizeUnitValues() []LogSizeUnit { return []LogSizeUnit{Gigabytes, Megabytes, Percent, Petabytes, Terabytes} } -// LongTermRetentionDatabaseState enumerates the values for long term retention database state. -type LongTermRetentionDatabaseState string - -const ( - // LongTermRetentionDatabaseStateAll ... - LongTermRetentionDatabaseStateAll LongTermRetentionDatabaseState = "All" - // LongTermRetentionDatabaseStateDeleted ... - LongTermRetentionDatabaseStateDeleted LongTermRetentionDatabaseState = "Deleted" - // LongTermRetentionDatabaseStateLive ... - LongTermRetentionDatabaseStateLive LongTermRetentionDatabaseState = "Live" -) - -// PossibleLongTermRetentionDatabaseStateValues returns an array of possible values for the LongTermRetentionDatabaseState const type. -func PossibleLongTermRetentionDatabaseStateValues() []LongTermRetentionDatabaseState { - return []LongTermRetentionDatabaseState{LongTermRetentionDatabaseStateAll, LongTermRetentionDatabaseStateDeleted, LongTermRetentionDatabaseStateLive} -} - // ManagedDatabaseCreateMode enumerates the values for managed database create mode. type ManagedDatabaseCreateMode string @@ -1329,6 +1263,23 @@ func PossibleReplicaTypeValues() []ReplicaType { return []ReplicaType{ReplicaTypePrimary, ReplicaTypeReadableSecondary} } +// RequestedBackupStorageRedundancy enumerates the values for requested backup storage redundancy. +type RequestedBackupStorageRedundancy string + +const ( + // RequestedBackupStorageRedundancyGeo ... + RequestedBackupStorageRedundancyGeo RequestedBackupStorageRedundancy = "Geo" + // RequestedBackupStorageRedundancyLocal ... + RequestedBackupStorageRedundancyLocal RequestedBackupStorageRedundancy = "Local" + // RequestedBackupStorageRedundancyZone ... + RequestedBackupStorageRedundancyZone RequestedBackupStorageRedundancy = "Zone" +) + +// PossibleRequestedBackupStorageRedundancyValues returns an array of possible values for the RequestedBackupStorageRedundancy const type. +func PossibleRequestedBackupStorageRedundancyValues() []RequestedBackupStorageRedundancy { + return []RequestedBackupStorageRedundancy{RequestedBackupStorageRedundancyGeo, RequestedBackupStorageRedundancyLocal, RequestedBackupStorageRedundancyZone} +} + // RestorePointType enumerates the values for restore point type. type RestorePointType string @@ -1365,15 +1316,15 @@ func PossibleSampleNameValues() []SampleName { type SecondaryType string const ( - // Geo ... - Geo SecondaryType = "Geo" - // Named ... - Named SecondaryType = "Named" + // SecondaryTypeGeo ... + SecondaryTypeGeo SecondaryType = "Geo" + // SecondaryTypeNamed ... + SecondaryTypeNamed SecondaryType = "Named" ) // PossibleSecondaryTypeValues returns an array of possible values for the SecondaryType const type. func PossibleSecondaryTypeValues() []SecondaryType { - return []SecondaryType{Geo, Named} + return []SecondaryType{SecondaryTypeGeo, SecondaryTypeNamed} } // SecurityAlertPolicyEmailAccountAdmins enumerates the values for security alert policy email account admins. @@ -1870,6 +1821,23 @@ func PossibleSyncMemberStateValues() []SyncMemberState { return []SyncMemberState{DeProvisioned, DeProvisionFailed, DeProvisioning, DisabledBackupRestore, DisabledTombstoneCleanup, Provisioned, ProvisionFailed, Provisioning, ReprovisionFailed, Reprovisioning, SyncCancelled, SyncCancelling, SyncFailed, SyncInProgress, SyncSucceeded, SyncSucceededWithWarnings, UnProvisioned, UnReprovisioned} } +// TargetBackupStorageRedundancy enumerates the values for target backup storage redundancy. +type TargetBackupStorageRedundancy string + +const ( + // TargetBackupStorageRedundancyGeo ... + TargetBackupStorageRedundancyGeo TargetBackupStorageRedundancy = "Geo" + // TargetBackupStorageRedundancyLocal ... + TargetBackupStorageRedundancyLocal TargetBackupStorageRedundancy = "Local" + // TargetBackupStorageRedundancyZone ... + TargetBackupStorageRedundancyZone TargetBackupStorageRedundancy = "Zone" +) + +// PossibleTargetBackupStorageRedundancyValues returns an array of possible values for the TargetBackupStorageRedundancy const type. +func PossibleTargetBackupStorageRedundancyValues() []TargetBackupStorageRedundancy { + return []TargetBackupStorageRedundancy{TargetBackupStorageRedundancyGeo, TargetBackupStorageRedundancyLocal, TargetBackupStorageRedundancyZone} +} + // TransparentDataEncryptionActivityStatus enumerates the values for transparent data encryption activity // status. type TransparentDataEncryptionActivityStatus string diff --git a/services/preview/sql/mgmt/v4.0/sql/longtermretentionbackups.go b/services/preview/sql/mgmt/v4.0/sql/longtermretentionbackups.go index c2b40d332dd1..99ca55b9bef1 100644 --- a/services/preview/sql/mgmt/v4.0/sql/longtermretentionbackups.go +++ b/services/preview/sql/mgmt/v4.0/sql/longtermretentionbackups.go @@ -33,6 +33,181 @@ func NewLongTermRetentionBackupsClientWithBaseURI(baseURI string, subscriptionID return LongTermRetentionBackupsClient{NewWithBaseURI(baseURI, subscriptionID)} } +// Copy copy an existing long term retention backup. +// Parameters: +// locationName - the location of the database. +// longTermRetentionServerName - the name of the server +// longTermRetentionDatabaseName - the name of the database +// backupName - the backup name. +// parameters - the parameters needed for long term retention copy request +func (client LongTermRetentionBackupsClient) Copy(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters CopyLongTermRetentionBackupParameters) (result LongTermRetentionBackupsCopyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.Copy") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CopyPreparer(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Copy", nil, "Failure preparing request") + return + } + + result, err = client.CopySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Copy", result.Response(), "Failure sending request") + return + } + + return +} + +// CopyPreparer prepares the Copy request. +func (client LongTermRetentionBackupsClient) CopyPreparer(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters CopyLongTermRetentionBackupParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupName": autorest.Encode("path", backupName), + "locationName": autorest.Encode("path", locationName), + "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), + "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/copy", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CopySender sends the Copy request. The method will close the +// http.Response Body if it receives an error. +func (client LongTermRetentionBackupsClient) CopySender(req *http.Request) (future LongTermRetentionBackupsCopyFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CopyResponder handles the response to the Copy request. The method always +// closes the http.Response Body. +func (client LongTermRetentionBackupsClient) CopyResponder(resp *http.Response) (result LongTermRetentionBackupOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CopyByResourceGroup copy an existing long term retention backup to a different server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// locationName - the location of the database. +// longTermRetentionServerName - the name of the server +// longTermRetentionDatabaseName - the name of the database +// backupName - the backup name. +// parameters - the parameters needed for long term retention copy request +func (client LongTermRetentionBackupsClient) CopyByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters CopyLongTermRetentionBackupParameters) (result LongTermRetentionBackupsCopyByResourceGroupFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.CopyByResourceGroup") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CopyByResourceGroupPreparer(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "CopyByResourceGroup", nil, "Failure preparing request") + return + } + + result, err = client.CopyByResourceGroupSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "CopyByResourceGroup", result.Response(), "Failure sending request") + return + } + + return +} + +// CopyByResourceGroupPreparer prepares the CopyByResourceGroup request. +func (client LongTermRetentionBackupsClient) CopyByResourceGroupPreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters CopyLongTermRetentionBackupParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupName": autorest.Encode("path", backupName), + "locationName": autorest.Encode("path", locationName), + "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), + "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/copy", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CopyByResourceGroupSender sends the CopyByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client LongTermRetentionBackupsClient) CopyByResourceGroupSender(req *http.Request) (future LongTermRetentionBackupsCopyByResourceGroupFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CopyByResourceGroupResponder handles the response to the CopyByResourceGroup request. The method always +// closes the http.Response Body. +func (client LongTermRetentionBackupsClient) CopyByResourceGroupResponder(resp *http.Response) (result LongTermRetentionBackupOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Delete deletes a long term retention backup. // Parameters: // locationName - the location of the database @@ -75,7 +250,7 @@ func (client LongTermRetentionBackupsClient) DeletePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +335,7 @@ func (client LongTermRetentionBackupsClient) DeleteByResourceGroupPreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -249,7 +424,7 @@ func (client LongTermRetentionBackupsClient) GetPreparer(ctx context.Context, lo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -332,7 +507,7 @@ func (client LongTermRetentionBackupsClient) GetByResourceGroupPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -370,7 +545,7 @@ func (client LongTermRetentionBackupsClient) GetByResourceGroupResponder(resp *h // longTermRetentionDatabaseName - the name of the database // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByDatabase(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionBackupsClient) ListByDatabase(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByDatabase") defer func() { @@ -409,7 +584,7 @@ func (client LongTermRetentionBackupsClient) ListByDatabase(ctx context.Context, } // ListByDatabasePreparer prepares the ListByDatabase request. -func (client LongTermRetentionBackupsClient) ListByDatabasePreparer(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { +func (client LongTermRetentionBackupsClient) ListByDatabasePreparer(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), @@ -417,7 +592,7 @@ func (client LongTermRetentionBackupsClient) ListByDatabasePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -476,7 +651,7 @@ func (client LongTermRetentionBackupsClient) listByDatabaseNextResults(ctx conte } // ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByDatabaseComplete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionBackupsClient) ListByDatabaseComplete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByDatabase") defer func() { @@ -496,7 +671,7 @@ func (client LongTermRetentionBackupsClient) ListByDatabaseComplete(ctx context. // locationName - the location of the database // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionBackupsClient) ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByLocation") defer func() { @@ -535,13 +710,13 @@ func (client LongTermRetentionBackupsClient) ListByLocation(ctx context.Context, } // ListByLocationPreparer prepares the ListByLocation request. -func (client LongTermRetentionBackupsClient) ListByLocationPreparer(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { +func (client LongTermRetentionBackupsClient) ListByLocationPreparer(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -600,7 +775,7 @@ func (client LongTermRetentionBackupsClient) listByLocationNextResults(ctx conte } // ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionBackupsClient) ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByLocation") defer func() { @@ -624,7 +799,7 @@ func (client LongTermRetentionBackupsClient) ListByLocationComplete(ctx context. // longTermRetentionDatabaseName - the name of the database // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupDatabase") defer func() { @@ -663,7 +838,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabase(ctx con } // ListByResourceGroupDatabasePreparer prepares the ListByResourceGroupDatabase request. -func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabasePreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabasePreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), @@ -672,7 +847,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabasePreparer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -731,7 +906,7 @@ func (client LongTermRetentionBackupsClient) listByResourceGroupDatabaseNextResu } // ListByResourceGroupDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupDatabase") defer func() { @@ -753,7 +928,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabaseComplete // locationName - the location of the database // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupLocation") defer func() { @@ -792,14 +967,14 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupLocation(ctx con } // ListByResourceGroupLocationPreparer prepares the ListByResourceGroupLocation request. -func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationPreparer(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationPreparer(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -858,7 +1033,7 @@ func (client LongTermRetentionBackupsClient) listByResourceGroupLocationNextResu } // ListByResourceGroupLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupLocation") defer func() { @@ -881,7 +1056,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationComplete // longTermRetentionServerName - the name of the server // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByResourceGroupServer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupServer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupServer") defer func() { @@ -920,7 +1095,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupServer(ctx conte } // ListByResourceGroupServerPreparer prepares the ListByResourceGroupServer request. -func (client LongTermRetentionBackupsClient) ListByResourceGroupServerPreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupServerPreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), @@ -928,7 +1103,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupServerPreparer(c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -987,7 +1162,7 @@ func (client LongTermRetentionBackupsClient) listByResourceGroupServerNextResult } // ListByResourceGroupServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByResourceGroupServerComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionBackupsClient) ListByResourceGroupServerComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByResourceGroupServer") defer func() { @@ -1008,7 +1183,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupServerComplete(c // longTermRetentionServerName - the name of the server // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionBackupsClient) ListByServer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionBackupsClient) ListByServer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByServer") defer func() { @@ -1047,14 +1222,14 @@ func (client LongTermRetentionBackupsClient) ListByServer(ctx context.Context, l } // ListByServerPreparer prepares the ListByServer request. -func (client LongTermRetentionBackupsClient) ListByServerPreparer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (*http.Request, error) { +func (client LongTermRetentionBackupsClient) ListByServerPreparer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1113,7 +1288,7 @@ func (client LongTermRetentionBackupsClient) listByServerNextResults(ctx context } // ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionBackupsClient) ListByServerComplete(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState LongTermRetentionDatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionBackupsClient) ListByServerComplete(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result LongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.ListByServer") defer func() { @@ -1127,3 +1302,178 @@ func (client LongTermRetentionBackupsClient) ListByServerComplete(ctx context.Co result.page, err = client.ListByServer(ctx, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) return } + +// Update updates an existing long term retention backup. +// Parameters: +// locationName - the location of the database. +// longTermRetentionServerName - the name of the server +// longTermRetentionDatabaseName - the name of the database +// backupName - the backup name. +// parameters - the requested backup resource state +func (client LongTermRetentionBackupsClient) Update(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters UpdateLongTermRetentionBackupParameters) (result LongTermRetentionBackupsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LongTermRetentionBackupsClient) UpdatePreparer(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters UpdateLongTermRetentionBackupParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupName": autorest.Encode("path", backupName), + "locationName": autorest.Encode("path", locationName), + "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), + "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/update", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client LongTermRetentionBackupsClient) UpdateSender(req *http.Request) (future LongTermRetentionBackupsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client LongTermRetentionBackupsClient) UpdateResponder(resp *http.Response) (result LongTermRetentionBackupOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateByResourceGroup updates an existing long term retention backup. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// locationName - the location of the database. +// longTermRetentionServerName - the name of the server +// longTermRetentionDatabaseName - the name of the database +// backupName - the backup name. +// parameters - the requested backup resource state +func (client LongTermRetentionBackupsClient) UpdateByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters UpdateLongTermRetentionBackupParameters) (result LongTermRetentionBackupsUpdateByResourceGroupFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupsClient.UpdateByResourceGroup") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateByResourceGroupPreparer(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "UpdateByResourceGroup", nil, "Failure preparing request") + return + } + + result, err = client.UpdateByResourceGroupSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsClient", "UpdateByResourceGroup", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateByResourceGroupPreparer prepares the UpdateByResourceGroup request. +func (client LongTermRetentionBackupsClient) UpdateByResourceGroupPreparer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters UpdateLongTermRetentionBackupParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupName": autorest.Encode("path", backupName), + "locationName": autorest.Encode("path", locationName), + "longTermRetentionDatabaseName": autorest.Encode("path", longTermRetentionDatabaseName), + "longTermRetentionServerName": autorest.Encode("path", longTermRetentionServerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/update", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateByResourceGroupSender sends the UpdateByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client LongTermRetentionBackupsClient) UpdateByResourceGroupSender(req *http.Request) (future LongTermRetentionBackupsUpdateByResourceGroupFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateByResourceGroupResponder handles the response to the UpdateByResourceGroup request. The method always +// closes the http.Response Body. +func (client LongTermRetentionBackupsClient) UpdateByResourceGroupResponder(resp *http.Response) (result LongTermRetentionBackupOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/sql/mgmt/v4.0/sql/longtermretentionmanagedinstancebackups.go b/services/preview/sql/mgmt/v4.0/sql/longtermretentionmanagedinstancebackups.go index a0b0712c782d..dcca4055b809 100644 --- a/services/preview/sql/mgmt/v4.0/sql/longtermretentionmanagedinstancebackups.go +++ b/services/preview/sql/mgmt/v4.0/sql/longtermretentionmanagedinstancebackups.go @@ -371,7 +371,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) GetByResourceGroupRe // databaseName - the name of the managed database. // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabase(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState1) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabase(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByDatabase") defer func() { @@ -410,7 +410,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabase(ctx c } // ListByDatabasePreparer prepares the ListByDatabase request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabasePreparer(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState1) (*http.Request, error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabasePreparer(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "locationName": autorest.Encode("path", locationName), @@ -477,7 +477,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) listByDatabaseNextRe } // ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabaseComplete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState1) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabaseComplete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByDatabase") defer func() { @@ -498,7 +498,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabaseComple // managedInstanceName - the name of the managed instance. // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstance(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState2) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstance(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByInstance") defer func() { @@ -537,7 +537,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstance(ctx c } // ListByInstancePreparer prepares the ListByInstance request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstancePreparer(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState2) (*http.Request, error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstancePreparer(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "managedInstanceName": autorest.Encode("path", managedInstanceName), @@ -603,7 +603,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) listByInstanceNextRe } // ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstanceComplete(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState2) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstanceComplete(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByInstance") defer func() { @@ -623,7 +623,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstanceComple // locationName - the location of the database. // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState3) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByLocation") defer func() { @@ -662,7 +662,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocation(ctx c } // ListByLocationPreparer prepares the ListByLocation request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationPreparer(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState3) (*http.Request, error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationPreparer(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -727,7 +727,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) listByLocationNextRe } // ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState3) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByLocation") defer func() { @@ -751,7 +751,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationComple // databaseName - the name of the managed database. // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState4) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupDatabase") defer func() { @@ -790,7 +790,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupD } // ListByResourceGroupDatabasePreparer prepares the ListByResourceGroupDatabase request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabasePreparer(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState4) (*http.Request, error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabasePreparer(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "locationName": autorest.Encode("path", locationName), @@ -858,7 +858,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupD } // ListByResourceGroupDatabaseComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState4) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupDatabase") defer func() { @@ -881,7 +881,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupD // managedInstanceName - the name of the managed instance. // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstance(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState5) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstance(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupInstance") defer func() { @@ -920,7 +920,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupI } // ListByResourceGroupInstancePreparer prepares the ListByResourceGroupInstance request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstancePreparer(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState5) (*http.Request, error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstancePreparer(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "managedInstanceName": autorest.Encode("path", managedInstanceName), @@ -987,7 +987,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupI } // ListByResourceGroupInstanceComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstanceComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState5) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupInstanceComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupInstance") defer func() { @@ -1009,7 +1009,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupI // locationName - the location of the database. // onlyLatestPerDatabase - whether or not to only get the latest backup for each database. // databaseState - whether to query against just live databases, just deleted databases, or all databases. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState6) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupLocation") defer func() { @@ -1048,7 +1048,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupL } // ListByResourceGroupLocationPreparer prepares the ListByResourceGroupLocation request. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocationPreparer(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState6) (*http.Request, error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocationPreparer(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (*http.Request, error) { pathParameters := map[string]interface{}{ "locationName": autorest.Encode("path", locationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -1114,7 +1114,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupL } // ListByResourceGroupLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState6) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { +func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState DatabaseState) (result ManagedInstanceLongTermRetentionBackupListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionManagedInstanceBackupsClient.ListByResourceGroupLocation") defer func() { diff --git a/services/preview/sql/mgmt/v4.0/sql/backuplongtermretentionpolicies.go b/services/preview/sql/mgmt/v4.0/sql/longtermretentionpolicies.go similarity index 53% rename from services/preview/sql/mgmt/v4.0/sql/backuplongtermretentionpolicies.go rename to services/preview/sql/mgmt/v4.0/sql/longtermretentionpolicies.go index 49886703a379..ebbcb1d3fac2 100644 --- a/services/preview/sql/mgmt/v4.0/sql/backuplongtermretentionpolicies.go +++ b/services/preview/sql/mgmt/v4.0/sql/longtermretentionpolicies.go @@ -14,23 +14,23 @@ import ( "net/http" ) -// BackupLongTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type BackupLongTermRetentionPoliciesClient struct { +// LongTermRetentionPoliciesClient is the the Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type LongTermRetentionPoliciesClient struct { BaseClient } -// NewBackupLongTermRetentionPoliciesClient creates an instance of the BackupLongTermRetentionPoliciesClient client. -func NewBackupLongTermRetentionPoliciesClient(subscriptionID string) BackupLongTermRetentionPoliciesClient { - return NewBackupLongTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewLongTermRetentionPoliciesClient creates an instance of the LongTermRetentionPoliciesClient client. +func NewLongTermRetentionPoliciesClient(subscriptionID string) LongTermRetentionPoliciesClient { + return NewLongTermRetentionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewBackupLongTermRetentionPoliciesClientWithBaseURI creates an instance of the BackupLongTermRetentionPoliciesClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupLongTermRetentionPoliciesClient { - return BackupLongTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewLongTermRetentionPoliciesClientWithBaseURI creates an instance of the LongTermRetentionPoliciesClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) LongTermRetentionPoliciesClient { + return LongTermRetentionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate sets a database's long term retention policy. @@ -40,9 +40,9 @@ func NewBackupLongTermRetentionPoliciesClientWithBaseURI(baseURI string, subscri // serverName - the name of the server. // databaseName - the name of the database. // parameters - the long term retention policy info. -func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupLongTermRetentionPolicy) (result BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) { +func (client LongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters LongTermRetentionPolicy) (result LongTermRetentionPoliciesCreateOrUpdateFuture, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.CreateOrUpdate") + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPoliciesClient.CreateOrUpdate") defer func() { sc := -1 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { @@ -53,13 +53,13 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.C } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") return } result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -67,7 +67,7 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdate(ctx context.C } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters BackupLongTermRetentionPolicy) (*http.Request, error) { +func (client LongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters LongTermRetentionPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "policyName": autorest.Encode("path", "default"), @@ -76,7 +76,7 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -93,7 +93,7 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdatePreparer(ctx c // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) { +func (client LongTermRetentionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future LongTermRetentionPoliciesCreateOrUpdateFuture, err error) { var resp *http.Response future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) @@ -109,7 +109,7 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateSender(req *ht // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, err error) { +func (client LongTermRetentionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result LongTermRetentionPolicy, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), @@ -125,9 +125,9 @@ func (client BackupLongTermRetentionPoliciesClient) CreateOrUpdateResponder(resp // from the Azure Resource Manager API or the portal. // serverName - the name of the server. // databaseName - the name of the database. -func (client BackupLongTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupLongTermRetentionPolicy, err error) { +func (client LongTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result LongTermRetentionPolicy, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPoliciesClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -138,20 +138,20 @@ func (client BackupLongTermRetentionPoliciesClient) Get(ctx context.Context, res } req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "Get", resp, "Failure responding to request") return } @@ -159,7 +159,7 @@ func (client BackupLongTermRetentionPoliciesClient) Get(ctx context.Context, res } // GetPreparer prepares the Get request. -func (client BackupLongTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { +func (client LongTermRetentionPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "policyName": autorest.Encode("path", "default"), @@ -168,7 +168,7 @@ func (client BackupLongTermRetentionPoliciesClient) GetPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -183,13 +183,13 @@ func (client BackupLongTermRetentionPoliciesClient) GetPreparer(ctx context.Cont // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client BackupLongTermRetentionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { +func (client LongTermRetentionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client BackupLongTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, err error) { +func (client LongTermRetentionPoliciesClient) GetResponder(resp *http.Response) (result LongTermRetentionPolicy, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -205,33 +205,38 @@ func (client BackupLongTermRetentionPoliciesClient) GetResponder(resp *http.Resp // from the Azure Resource Manager API or the portal. // serverName - the name of the server. // databaseName - the name of the database. -func (client BackupLongTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result BackupLongTermRetentionPolicy, err error) { +func (client LongTermRetentionPoliciesClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result LongTermRetentionPolicyListResultPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupLongTermRetentionPoliciesClient.ListByDatabase") + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPoliciesClient.ListByDatabase") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.ltrplr.Response.Response != nil { + sc = result.ltrplr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } + result.fn = client.listByDatabaseNextResults req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "ListByDatabase", nil, "Failure preparing request") return } resp, err := client.ListByDatabaseSender(req) if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure sending request") + result.ltrplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure sending request") return } - result, err = client.ListByDatabaseResponder(resp) + result.ltrplr, err = client.ListByDatabaseResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "ListByDatabase", resp, "Failure responding to request") + return + } + if result.ltrplr.hasNextLink() && result.ltrplr.IsEmpty() { + err = result.NextWithContext(ctx) return } @@ -239,7 +244,7 @@ func (client BackupLongTermRetentionPoliciesClient) ListByDatabase(ctx context.C } // ListByDatabasePreparer prepares the ListByDatabase request. -func (client BackupLongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { +func (client LongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -247,7 +252,7 @@ func (client BackupLongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2017-03-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -262,13 +267,13 @@ func (client BackupLongTermRetentionPoliciesClient) ListByDatabasePreparer(ctx c // ListByDatabaseSender sends the ListByDatabase request. The method will close the // http.Response Body if it receives an error. -func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { +func (client LongTermRetentionPoliciesClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByDatabaseResponder handles the response to the ListByDatabase request. The method always // closes the http.Response Body. -func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result BackupLongTermRetentionPolicy, err error) { +func (client LongTermRetentionPoliciesClient) ListByDatabaseResponder(resp *http.Response) (result LongTermRetentionPolicyListResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -277,3 +282,40 @@ func (client BackupLongTermRetentionPoliciesClient) ListByDatabaseResponder(resp result.Response = autorest.Response{Response: resp} return } + +// listByDatabaseNextResults retrieves the next set of results, if any. +func (client LongTermRetentionPoliciesClient) listByDatabaseNextResults(ctx context.Context, lastResults LongTermRetentionPolicyListResult) (result LongTermRetentionPolicyListResult, err error) { + req, err := lastResults.longTermRetentionPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. +func (client LongTermRetentionPoliciesClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result LongTermRetentionPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPoliciesClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) + return +} diff --git a/services/preview/sql/mgmt/v4.0/sql/models.go b/services/preview/sql/mgmt/v4.0/sql/models.go index 22e205ad101b..c02c4b9a43fe 100644 --- a/services/preview/sql/mgmt/v4.0/sql/models.go +++ b/services/preview/sql/mgmt/v4.0/sql/models.go @@ -477,122 +477,6 @@ type AzureADOnlyAuthProperties struct { AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` } -// BackupLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type BackupLongTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupLongTermRetentionPoliciesClient) (BackupLongTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupLongTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupLongTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *BackupLongTermRetentionPoliciesCreateOrUpdateFuture) result(client BackupLongTermRetentionPoliciesClient) (bltrp BackupLongTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bltrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bltrp.Response.Response, err = future.GetResult(sender); err == nil && bltrp.Response.Response.StatusCode != http.StatusNoContent { - bltrp, err = client.CreateOrUpdateResponder(bltrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", bltrp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupLongTermRetentionPolicy a long term retention policy. -type BackupLongTermRetentionPolicy struct { - autorest.Response `json:"-"` - // LongTermRetentionPolicyProperties - Resource properties. - *LongTermRetentionPolicyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupLongTermRetentionPolicy. -func (bltrp BackupLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bltrp.LongTermRetentionPolicyProperties != nil { - objectMap["properties"] = bltrp.LongTermRetentionPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupLongTermRetentionPolicy struct. -func (bltrp *BackupLongTermRetentionPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var longTermRetentionPolicyProperties LongTermRetentionPolicyProperties - err = json.Unmarshal(*v, &longTermRetentionPolicyProperties) - if err != nil { - return err - } - bltrp.LongTermRetentionPolicyProperties = &longTermRetentionPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bltrp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bltrp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bltrp.Type = &typeVar - } - } - } - - return nil -} - // BackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the // results of a long-running operation. type BackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { @@ -968,6 +852,63 @@ type CompleteDatabaseRestoreDefinition struct { LastBackupName *string `json:"lastBackupName,omitempty"` } +// CopyLongTermRetentionBackupParameters contains the information necessary to perform long term retention +// backup copy operation. +type CopyLongTermRetentionBackupParameters struct { + // CopyLongTermRetentionBackupParametersProperties - Resource properties. + *CopyLongTermRetentionBackupParametersProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CopyLongTermRetentionBackupParameters. +func (cltrbp CopyLongTermRetentionBackupParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cltrbp.CopyLongTermRetentionBackupParametersProperties != nil { + objectMap["properties"] = cltrbp.CopyLongTermRetentionBackupParametersProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CopyLongTermRetentionBackupParameters struct. +func (cltrbp *CopyLongTermRetentionBackupParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var copyLongTermRetentionBackupParametersProperties CopyLongTermRetentionBackupParametersProperties + err = json.Unmarshal(*v, ©LongTermRetentionBackupParametersProperties) + if err != nil { + return err + } + cltrbp.CopyLongTermRetentionBackupParametersProperties = ©LongTermRetentionBackupParametersProperties + } + } + } + + return nil +} + +// CopyLongTermRetentionBackupParametersProperties contains the properties to perform long term retention +// backup copy operation. +type CopyLongTermRetentionBackupParametersProperties struct { + // TargetSubscriptionID - The subscription that owns the target server + TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"` + // TargetResourceGroup - The resource group that owns the target server + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + // TargetServerResourceID - The resource Id of the target server that owns the database + TargetServerResourceID *string `json:"targetServerResourceId,omitempty"` + // TargetServerFullyQualifiedDomainName - The fully qualified domain name of the target server + TargetServerFullyQualifiedDomainName *string `json:"targetServerFullyQualifiedDomainName,omitempty"` + // TargetDatabaseName - The name of the database owns the copied backup. + TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` + // TargetBackupStorageRedundancy - The storage redundancy type of the copied backup. Possible values include: 'TargetBackupStorageRedundancyGeo', 'TargetBackupStorageRedundancyLocal', 'TargetBackupStorageRedundancyZone' + TargetBackupStorageRedundancy TargetBackupStorageRedundancy `json:"targetBackupStorageRedundancy,omitempty"` +} + // CreateDatabaseRestorePointDefinition contains the information necessary to perform a create database // restore point operation. type CreateDatabaseRestorePointDefinition struct { @@ -1514,6 +1455,9 @@ type DatabaseBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -2071,14 +2015,16 @@ type DatabaseProperties struct { ReadScale DatabaseReadScale `json:"readScale,omitempty"` // HighAvailabilityReplicaCount - The number of secondary replicas associated with the database that are used to provide high availability. HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` - // SecondaryType - The secondary type of the database if it is a secondary. Valid values are Geo and Named. Possible values include: 'Geo', 'Named' + // SecondaryType - The secondary type of the database if it is a secondary. Valid values are Geo and Named. Possible values include: 'SecondaryTypeGeo', 'SecondaryTypeNamed' SecondaryType SecondaryType `json:"secondaryType,omitempty"` // CurrentSku - READ-ONLY; The name and tier of the SKU. CurrentSku *Sku `json:"currentSku,omitempty"` // AutoPauseDelay - Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` - // StorageAccountType - The storage account type used to store backups for this database. Possible values include: 'GRS', 'LRS', 'ZRS' - StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` + // CurrentBackupStorageRedundancy - READ-ONLY; The storage account type used to store backups for this database. Possible values include: 'CurrentBackupStorageRedundancyGeo', 'CurrentBackupStorageRedundancyLocal', 'CurrentBackupStorageRedundancyZone' + CurrentBackupStorageRedundancy CurrentBackupStorageRedundancy `json:"currentBackupStorageRedundancy,omitempty"` + // RequestedBackupStorageRedundancy - The storage account type to be used to store backups for this database. Possible values include: 'RequestedBackupStorageRedundancyGeo', 'RequestedBackupStorageRedundancyLocal', 'RequestedBackupStorageRedundancyZone' + RequestedBackupStorageRedundancy RequestedBackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` // MinCapacity - Minimal capacity that database will always have allocated, if not paused MinCapacity *float64 `json:"minCapacity,omitempty"` // PausedDate - READ-ONLY; The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. @@ -2149,8 +2095,8 @@ func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { if dp.AutoPauseDelay != nil { objectMap["autoPauseDelay"] = dp.AutoPauseDelay } - if dp.StorageAccountType != "" { - objectMap["storageAccountType"] = dp.StorageAccountType + if dp.RequestedBackupStorageRedundancy != "" { + objectMap["requestedBackupStorageRedundancy"] = dp.RequestedBackupStorageRedundancy } if dp.MinCapacity != nil { objectMap["minCapacity"] = dp.MinCapacity @@ -5394,6 +5340,9 @@ type ExtendedDatabaseBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -5773,6 +5722,9 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -10155,24 +10107,753 @@ type LongTermRetentionBackupListResult struct { NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for LongTermRetentionBackupListResult. -func (ltrblr LongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LongTermRetentionBackupListResult. +func (ltrblr LongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LongTermRetentionBackupListResultIterator provides access to a complete listing of +// LongTermRetentionBackup values. +type LongTermRetentionBackupListResultIterator struct { + i int + page LongTermRetentionBackupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LongTermRetentionBackupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LongTermRetentionBackupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LongTermRetentionBackupListResultIterator) Response() LongTermRetentionBackupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LongTermRetentionBackupListResultIterator) Value() LongTermRetentionBackup { + if !iter.page.NotDone() { + return LongTermRetentionBackup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LongTermRetentionBackupListResultIterator type. +func NewLongTermRetentionBackupListResultIterator(page LongTermRetentionBackupListResultPage) LongTermRetentionBackupListResultIterator { + return LongTermRetentionBackupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ltrblr LongTermRetentionBackupListResult) IsEmpty() bool { + return ltrblr.Value == nil || len(*ltrblr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ltrblr LongTermRetentionBackupListResult) hasNextLink() bool { + return ltrblr.NextLink != nil && len(*ltrblr.NextLink) != 0 +} + +// longTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ltrblr LongTermRetentionBackupListResult) longTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ltrblr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ltrblr.NextLink))) +} + +// LongTermRetentionBackupListResultPage contains a page of LongTermRetentionBackup values. +type LongTermRetentionBackupListResultPage struct { + fn func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error) + ltrblr LongTermRetentionBackupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ltrblr) + if err != nil { + return err + } + page.ltrblr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LongTermRetentionBackupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LongTermRetentionBackupListResultPage) NotDone() bool { + return !page.ltrblr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LongTermRetentionBackupListResultPage) Response() LongTermRetentionBackupListResult { + return page.ltrblr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LongTermRetentionBackupListResultPage) Values() []LongTermRetentionBackup { + if page.ltrblr.IsEmpty() { + return nil + } + return *page.ltrblr.Value +} + +// Creates a new instance of the LongTermRetentionBackupListResultPage type. +func NewLongTermRetentionBackupListResultPage(cur LongTermRetentionBackupListResult, getNextPage func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error)) LongTermRetentionBackupListResultPage { + return LongTermRetentionBackupListResultPage{ + fn: getNextPage, + ltrblr: cur, + } +} + +// LongTermRetentionBackupOperationResult a LongTermRetentionBackup operation result resource. +type LongTermRetentionBackupOperationResult struct { + autorest.Response `json:"-"` + // LongTermRetentionOperationResultProperties - Resource properties. + *LongTermRetentionOperationResultProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LongTermRetentionBackupOperationResult. +func (ltrbor LongTermRetentionBackupOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ltrbor.LongTermRetentionOperationResultProperties != nil { + objectMap["properties"] = ltrbor.LongTermRetentionOperationResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LongTermRetentionBackupOperationResult struct. +func (ltrbor *LongTermRetentionBackupOperationResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var longTermRetentionOperationResultProperties LongTermRetentionOperationResultProperties + err = json.Unmarshal(*v, &longTermRetentionOperationResultProperties) + if err != nil { + return err + } + ltrbor.LongTermRetentionOperationResultProperties = &longTermRetentionOperationResultProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ltrbor.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ltrbor.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ltrbor.Type = &typeVar + } + } + } + + return nil +} + +// LongTermRetentionBackupProperties properties of a long term retention backup +type LongTermRetentionBackupProperties struct { + // ServerName - READ-ONLY; The server name that the backup database belong to. + ServerName *string `json:"serverName,omitempty"` + // ServerCreateTime - READ-ONLY; The create time of the server. + ServerCreateTime *date.Time `json:"serverCreateTime,omitempty"` + // DatabaseName - READ-ONLY; The name of the database the backup belong to + DatabaseName *string `json:"databaseName,omitempty"` + // DatabaseDeletionTime - READ-ONLY; The delete time of the database + DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` + // BackupTime - READ-ONLY; The time the backup was taken + BackupTime *date.Time `json:"backupTime,omitempty"` + // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. + BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` + // BackupStorageRedundancy - READ-ONLY; The storage redundancy type of the backup. Possible values include: 'Geo', 'Local', 'Zone' + BackupStorageRedundancy BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty"` + // RequestedBackupStorageRedundancy - The storage redundancy type of the backup. Possible values include: 'Geo', 'Local', 'Zone' + RequestedBackupStorageRedundancy BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` +} + +// MarshalJSON is the custom marshaler for LongTermRetentionBackupProperties. +func (ltrbp LongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ltrbp.RequestedBackupStorageRedundancy != "" { + objectMap["requestedBackupStorageRedundancy"] = ltrbp.RequestedBackupStorageRedundancy + } + return json.Marshal(objectMap) +} + +// LongTermRetentionBackupsCopyByResourceGroupFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LongTermRetentionBackupsCopyByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsCopyByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionBackupsCopyByResourceGroupFuture.Result. +func (future *LongTermRetentionBackupsCopyByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrbor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsCopyByResourceGroupFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { + ltrbor, err = client.CopyByResourceGroupResponder(ltrbor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyByResourceGroupFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + } + } + return +} + +// LongTermRetentionBackupsCopyFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LongTermRetentionBackupsCopyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsCopyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionBackupsCopyFuture.Result. +func (future *LongTermRetentionBackupsCopyFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrbor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsCopyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { + ltrbor, err = client.CopyResponder(ltrbor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + } + } + return +} + +// LongTermRetentionBackupsDeleteByResourceGroupFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LongTermRetentionBackupsDeleteByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionBackupsDeleteByResourceGroupFuture.Result. +func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteByResourceGroupFuture") + return + } + ar.Response = future.Response() + return +} + +// LongTermRetentionBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LongTermRetentionBackupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionBackupsDeleteFuture.Result. +func (future *LongTermRetentionBackupsDeleteFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LongTermRetentionBackupsUpdateByResourceGroupFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LongTermRetentionBackupsUpdateByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsUpdateByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionBackupsUpdateByResourceGroupFuture.Result. +func (future *LongTermRetentionBackupsUpdateByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrbor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsUpdateByResourceGroupFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { + ltrbor, err = client.UpdateByResourceGroupResponder(ltrbor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateByResourceGroupFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + } + } + return +} + +// LongTermRetentionBackupsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LongTermRetentionBackupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionBackupsUpdateFuture.Result. +func (future *LongTermRetentionBackupsUpdateFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrbor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { + ltrbor, err = client.UpdateResponder(ltrbor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + } + } + return +} + +// LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture.Result. +func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture") + return + } + ar.Response = future.Response() + return +} + +// LongTermRetentionManagedInstanceBackupsDeleteFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LongTermRetentionManagedInstanceBackupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteFuture.Result. +func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LongTermRetentionOperationResultProperties contains the operation result properties for long term +// retention backup operation. +type LongTermRetentionOperationResultProperties struct { + // RequestID - READ-ONLY; Request Id. + RequestID *uuid.UUID `json:"requestId,omitempty"` + // OperationType - READ-ONLY; Operation type. + OperationType *string `json:"operationType,omitempty"` + // FromBackupResourceID - READ-ONLY; Source backup resource id + FromBackupResourceID *string `json:"fromBackupResourceId,omitempty"` + // ToBackupResourceID - READ-ONLY; Target backup resource id + ToBackupResourceID *string `json:"toBackupResourceId,omitempty"` + // TargetBackupStorageRedundancy - READ-ONLY; The storage redundancy type of the copied backup. Possible values include: 'Geo', 'Local', 'Zone' + TargetBackupStorageRedundancy BackupStorageRedundancy `json:"targetBackupStorageRedundancy,omitempty"` + // Status - READ-ONLY; Operation status + Status *string `json:"status,omitempty"` + // Message - READ-ONLY; Progress message + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for LongTermRetentionOperationResultProperties. +func (ltrorp LongTermRetentionOperationResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type LongTermRetentionPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionPoliciesClient) (LongTermRetentionPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionPoliciesCreateOrUpdateFuture.Result. +func (future *LongTermRetentionPoliciesCreateOrUpdateFuture) result(client LongTermRetentionPoliciesClient) (ltrp LongTermRetentionPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrp.Response.Response, err = future.GetResult(sender); err == nil && ltrp.Response.Response.StatusCode != http.StatusNoContent { + ltrp, err = client.CreateOrUpdateResponder(ltrp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesCreateOrUpdateFuture", "Result", ltrp.Response.Response, "Failure responding to request") + } + } + return +} + +// LongTermRetentionPolicy a long term retention policy. +type LongTermRetentionPolicy struct { + autorest.Response `json:"-"` + // BaseLongTermRetentionPolicyProperties - Resource properties. + *BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LongTermRetentionPolicy. +func (ltrp LongTermRetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ltrp.BaseLongTermRetentionPolicyProperties != nil { + objectMap["properties"] = ltrp.BaseLongTermRetentionPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LongTermRetentionPolicy struct. +func (ltrp *LongTermRetentionPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var baseLongTermRetentionPolicyProperties BaseLongTermRetentionPolicyProperties + err = json.Unmarshal(*v, &baseLongTermRetentionPolicyProperties) + if err != nil { + return err + } + ltrp.BaseLongTermRetentionPolicyProperties = &baseLongTermRetentionPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ltrp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ltrp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ltrp.Type = &typeVar + } + } + } + + return nil +} + +// LongTermRetentionPolicyListResult a list of long term retention policies. +type LongTermRetentionPolicyListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]LongTermRetentionPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LongTermRetentionPolicyListResult. +func (ltrplr LongTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// LongTermRetentionBackupListResultIterator provides access to a complete listing of -// LongTermRetentionBackup values. -type LongTermRetentionBackupListResultIterator struct { +// LongTermRetentionPolicyListResultIterator provides access to a complete listing of +// LongTermRetentionPolicy values. +type LongTermRetentionPolicyListResultIterator struct { i int - page LongTermRetentionBackupListResultPage + page LongTermRetentionPolicyListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *LongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *LongTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPolicyListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -10197,67 +10878,67 @@ func (iter *LongTermRetentionBackupListResultIterator) NextWithContext(ctx conte // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *LongTermRetentionBackupListResultIterator) Next() error { +func (iter *LongTermRetentionPolicyListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LongTermRetentionBackupListResultIterator) NotDone() bool { +func (iter LongTermRetentionPolicyListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter LongTermRetentionBackupListResultIterator) Response() LongTermRetentionBackupListResult { +func (iter LongTermRetentionPolicyListResultIterator) Response() LongTermRetentionPolicyListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter LongTermRetentionBackupListResultIterator) Value() LongTermRetentionBackup { +func (iter LongTermRetentionPolicyListResultIterator) Value() LongTermRetentionPolicy { if !iter.page.NotDone() { - return LongTermRetentionBackup{} + return LongTermRetentionPolicy{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the LongTermRetentionBackupListResultIterator type. -func NewLongTermRetentionBackupListResultIterator(page LongTermRetentionBackupListResultPage) LongTermRetentionBackupListResultIterator { - return LongTermRetentionBackupListResultIterator{page: page} +// Creates a new instance of the LongTermRetentionPolicyListResultIterator type. +func NewLongTermRetentionPolicyListResultIterator(page LongTermRetentionPolicyListResultPage) LongTermRetentionPolicyListResultIterator { + return LongTermRetentionPolicyListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (ltrblr LongTermRetentionBackupListResult) IsEmpty() bool { - return ltrblr.Value == nil || len(*ltrblr.Value) == 0 +func (ltrplr LongTermRetentionPolicyListResult) IsEmpty() bool { + return ltrplr.Value == nil || len(*ltrplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (ltrblr LongTermRetentionBackupListResult) hasNextLink() bool { - return ltrblr.NextLink != nil && len(*ltrblr.NextLink) != 0 +func (ltrplr LongTermRetentionPolicyListResult) hasNextLink() bool { + return ltrplr.NextLink != nil && len(*ltrplr.NextLink) != 0 } -// longTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. +// longTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ltrblr LongTermRetentionBackupListResult) longTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ltrblr.hasNextLink() { +func (ltrplr LongTermRetentionPolicyListResult) longTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ltrplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ltrblr.NextLink))) + autorest.WithBaseURL(to.String(ltrplr.NextLink))) } -// LongTermRetentionBackupListResultPage contains a page of LongTermRetentionBackup values. -type LongTermRetentionBackupListResultPage struct { - fn func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error) - ltrblr LongTermRetentionBackupListResult +// LongTermRetentionPolicyListResultPage contains a page of LongTermRetentionPolicy values. +type LongTermRetentionPolicyListResultPage struct { + fn func(context.Context, LongTermRetentionPolicyListResult) (LongTermRetentionPolicyListResult, error) + ltrplr LongTermRetentionPolicyListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *LongTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPolicyListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -10267,11 +10948,11 @@ func (page *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.C }() } for { - next, err := page.fn(ctx, page.ltrblr) + next, err := page.fn(ctx, page.ltrplr) if err != nil { return err } - page.ltrblr = next + page.ltrplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -10282,216 +10963,34 @@ func (page *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.C // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *LongTermRetentionBackupListResultPage) Next() error { +func (page *LongTermRetentionPolicyListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LongTermRetentionBackupListResultPage) NotDone() bool { - return !page.ltrblr.IsEmpty() +func (page LongTermRetentionPolicyListResultPage) NotDone() bool { + return !page.ltrplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page LongTermRetentionBackupListResultPage) Response() LongTermRetentionBackupListResult { - return page.ltrblr +func (page LongTermRetentionPolicyListResultPage) Response() LongTermRetentionPolicyListResult { + return page.ltrplr } // Values returns the slice of values for the current page or nil if there are no values. -func (page LongTermRetentionBackupListResultPage) Values() []LongTermRetentionBackup { - if page.ltrblr.IsEmpty() { +func (page LongTermRetentionPolicyListResultPage) Values() []LongTermRetentionPolicy { + if page.ltrplr.IsEmpty() { return nil } - return *page.ltrblr.Value + return *page.ltrplr.Value } -// Creates a new instance of the LongTermRetentionBackupListResultPage type. -func NewLongTermRetentionBackupListResultPage(cur LongTermRetentionBackupListResult, getNextPage func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error)) LongTermRetentionBackupListResultPage { - return LongTermRetentionBackupListResultPage{ +// Creates a new instance of the LongTermRetentionPolicyListResultPage type. +func NewLongTermRetentionPolicyListResultPage(cur LongTermRetentionPolicyListResult, getNextPage func(context.Context, LongTermRetentionPolicyListResult) (LongTermRetentionPolicyListResult, error)) LongTermRetentionPolicyListResultPage { + return LongTermRetentionPolicyListResultPage{ fn: getNextPage, - ltrblr: cur, - } -} - -// LongTermRetentionBackupProperties properties of a long term retention backup -type LongTermRetentionBackupProperties struct { - // ServerName - READ-ONLY; The server name that the backup database belong to. - ServerName *string `json:"serverName,omitempty"` - // ServerCreateTime - READ-ONLY; The create time of the server. - ServerCreateTime *date.Time `json:"serverCreateTime,omitempty"` - // DatabaseName - READ-ONLY; The name of the database the backup belong to - DatabaseName *string `json:"databaseName,omitempty"` - // DatabaseDeletionTime - READ-ONLY; The delete time of the database - DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` - // BackupTime - READ-ONLY; The time the backup was taken - BackupTime *date.Time `json:"backupTime,omitempty"` - // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. - BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for LongTermRetentionBackupProperties. -func (ltrbp LongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LongTermRetentionBackupsDeleteByResourceGroupFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LongTermRetentionBackupsDeleteByResourceGroupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LongTermRetentionBackupsDeleteByResourceGroupFuture.Result. -func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteByResourceGroupFuture") - return - } - ar.Response = future.Response() - return -} - -// LongTermRetentionBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LongTermRetentionBackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LongTermRetentionBackupsDeleteFuture.Result. -func (future *LongTermRetentionBackupsDeleteFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture.Result. -func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture") - return - } - ar.Response = future.Response() - return -} - -// LongTermRetentionManagedInstanceBackupsDeleteFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LongTermRetentionManagedInstanceBackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteFuture.Result. -func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteFuture") - return + ltrplr: cur, } - ar.Response = future.Response() - return -} - -// LongTermRetentionPolicyProperties properties of a long term retention policy -type LongTermRetentionPolicyProperties struct { - // WeeklyRetention - The weekly retention policy for an LTR backup in an ISO 8601 format. - WeeklyRetention *string `json:"weeklyRetention,omitempty"` - // MonthlyRetention - The monthly retention policy for an LTR backup in an ISO 8601 format. - MonthlyRetention *string `json:"monthlyRetention,omitempty"` - // YearlyRetention - The yearly retention policy for an LTR backup in an ISO 8601 format. - YearlyRetention *string `json:"yearlyRetention,omitempty"` - // WeekOfYear - The week of year to take the yearly backup in an ISO 8601 format. - WeekOfYear *int32 `json:"weekOfYear,omitempty"` } // MaintenanceConfigurationCapability the maintenance configuration capability @@ -17507,7 +18006,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { type ResourceIdentity struct { // PrincipalID - READ-ONLY; The Azure Active Directory principal id. PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // 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: 'None', 'SystemAssigned', 'UserAssigned' + // 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: 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned' Type IdentityType `json:"type,omitempty"` // TenantID - READ-ONLY; The Azure Active Directory tenant id. TenantID *uuid.UUID `json:"tenantId,omitempty"` @@ -19247,6 +19746,9 @@ type ServerBlobAuditingPolicyProperties struct { // USER_CHANGE_PASSWORD_GROUP // BATCH_STARTED_GROUP // BATCH_COMPLETED_GROUP + // DBCC_GROUP + // DATABASE_OWNERSHIP_CHANGE_GROUP + // DATABASE_CHANGE_GROUP // // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. // @@ -24535,26 +25037,20 @@ func (future *SyncMembersUpdateFuture) result(client SyncMembersClient) (sm Sync // SystemData metadata pertaining to creation and last modification of the resource. type SystemData struct { - // CreatedBy - READ-ONLY; A string identifier for the identity that created the resource. + // CreatedBy - The identity that created the resource. CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - READ-ONLY; The type of identity that created the resource: . Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - READ-ONLY; The timestamp of resource creation (UTC). + // CreatedAt - The timestamp of resource creation (UTC). CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - READ-ONLY; A string identifier for the identity that last modified the resource. + // LastModifiedBy - The identity that last modified the resource. LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - READ-ONLY; The type of identity that last modified the resource: . Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - READ-ONLY; The timestamp of last modification (UTC). + // LastModifiedAt - The timestamp of resource last modification (UTC) LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` } -// MarshalJSON is the custom marshaler for SystemData. -func (sd SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - // TdeCertificate a TDE certificate that can be uploaded into a server. type TdeCertificate struct { // TdeCertificateProperties - Resource properties. @@ -25092,6 +25588,53 @@ type UnlinkParameters struct { ForcedTermination *bool `json:"forcedTermination,omitempty"` } +// UpdateLongTermRetentionBackupParameters contains the information necessary to perform long term +// retention backup update operation. +type UpdateLongTermRetentionBackupParameters struct { + // UpdateLongTermRetentionBackupParametersProperties - Resource properties. + *UpdateLongTermRetentionBackupParametersProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for UpdateLongTermRetentionBackupParameters. +func (ultrbp UpdateLongTermRetentionBackupParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ultrbp.UpdateLongTermRetentionBackupParametersProperties != nil { + objectMap["properties"] = ultrbp.UpdateLongTermRetentionBackupParametersProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for UpdateLongTermRetentionBackupParameters struct. +func (ultrbp *UpdateLongTermRetentionBackupParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var updateLongTermRetentionBackupParametersProperties UpdateLongTermRetentionBackupParametersProperties + err = json.Unmarshal(*v, &updateLongTermRetentionBackupParametersProperties) + if err != nil { + return err + } + ultrbp.UpdateLongTermRetentionBackupParametersProperties = &updateLongTermRetentionBackupParametersProperties + } + } + } + + return nil +} + +// UpdateLongTermRetentionBackupParametersProperties contains the properties to perform long term retention +// backup copy operation. +type UpdateLongTermRetentionBackupParametersProperties struct { + // RequestedBackupStorageRedundancy - The storage redundancy type of the copied backup. Possible values include: 'RequestedBackupStorageRedundancyGeo', 'RequestedBackupStorageRedundancyLocal', 'RequestedBackupStorageRedundancyZone' + RequestedBackupStorageRedundancy RequestedBackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` +} + // UpsertManagedServerOperationParameters ... type UpsertManagedServerOperationParameters struct { Family *string `json:"family,omitempty"` diff --git a/services/preview/sql/mgmt/v4.0/sql/privateendpointconnections.go b/services/preview/sql/mgmt/v4.0/sql/privateendpointconnections.go index d66b3e5f3f61..9fcd87b43a29 100644 --- a/services/preview/sql/mgmt/v4.0/sql/privateendpointconnections.go +++ b/services/preview/sql/mgmt/v4.0/sql/privateendpointconnections.go @@ -83,7 +83,7 @@ func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -166,7 +166,7 @@ func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -254,7 +254,7 @@ func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -336,7 +336,7 @@ func (client PrivateEndpointConnectionsClient) ListByServerPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-06-01-preview" + const APIVersion = "2020-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v4.0/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/v4.0/sql/sqlapi/interfaces.go index 6775b55a1c3c..6b968f8fd195 100644 --- a/services/preview/sql/mgmt/v4.0/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/v4.0/sql/sqlapi/interfaces.go @@ -471,37 +471,6 @@ type JobVersionsClientAPI interface { var _ JobVersionsClientAPI = (*sql.JobVersionsClient)(nil) -// LongTermRetentionBackupsClientAPI contains the set of methods on the LongTermRetentionBackupsClient type. -type LongTermRetentionBackupsClientAPI interface { - Delete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteFuture, err error) - DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteByResourceGroupFuture, err error) - Get(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) - GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) - ListByDatabase(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupServer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupServerComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByServer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByServerComplete(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.LongTermRetentionDatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) -} - -var _ LongTermRetentionBackupsClientAPI = (*sql.LongTermRetentionBackupsClient)(nil) - -// BackupLongTermRetentionPoliciesClientAPI contains the set of methods on the BackupLongTermRetentionPoliciesClient type. -type BackupLongTermRetentionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupLongTermRetentionPolicy) (result sql.BackupLongTermRetentionPoliciesCreateOrUpdateFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupLongTermRetentionPolicy, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.BackupLongTermRetentionPolicy, err error) -} - -var _ BackupLongTermRetentionPoliciesClientAPI = (*sql.BackupLongTermRetentionPoliciesClient)(nil) - // ManagedBackupShortTermRetentionPoliciesClientAPI contains the set of methods on the ManagedBackupShortTermRetentionPoliciesClient type. type ManagedBackupShortTermRetentionPoliciesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.ManagedBackupShortTermRetentionPolicy) (result sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) @@ -807,17 +776,6 @@ type UsagesClientAPI interface { var _ UsagesClientAPI = (*sql.UsagesClient)(nil) -// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters sql.PrivateEndpointConnection) (result sql.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnectionsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnection, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultIterator, err error) -} - -var _ PrivateEndpointConnectionsClientAPI = (*sql.PrivateEndpointConnectionsClient)(nil) - // PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. type PrivateLinkResourcesClientAPI interface { Get(ctx context.Context, resourceGroupName string, serverName string, groupName string) (result sql.PrivateLinkResource, err error) @@ -856,18 +814,18 @@ type LongTermRetentionManagedInstanceBackupsClientAPI interface { DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture, err error) Get(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.ManagedInstanceLongTermRetentionBackup, err error) GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.ManagedInstanceLongTermRetentionBackup, err error) - ListByDatabase(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState1) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState1) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByInstance(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState2) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByInstanceComplete(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState2) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState3) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState3) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState4) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState4) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupInstance(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState5) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupInstanceComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState5) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState6) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState6) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByDatabase(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByInstance(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByInstanceComplete(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupInstance(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByResourceGroupInstanceComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) } var _ LongTermRetentionManagedInstanceBackupsClientAPI = (*sql.LongTermRetentionManagedInstanceBackupsClient)(nil) @@ -1053,3 +1011,50 @@ type ServerDevOpsAuditSettingsClientAPI interface { } var _ ServerDevOpsAuditSettingsClientAPI = (*sql.ServerDevOpsAuditSettingsClient)(nil) + +// LongTermRetentionBackupsClientAPI contains the set of methods on the LongTermRetentionBackupsClient type. +type LongTermRetentionBackupsClientAPI interface { + Copy(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.CopyLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsCopyFuture, err error) + CopyByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.CopyLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsCopyByResourceGroupFuture, err error) + Delete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteFuture, err error) + DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteByResourceGroupFuture, err error) + Get(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) + GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) + ListByDatabase(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupServer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByResourceGroupServerComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByServer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByServerComplete(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + Update(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.UpdateLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsUpdateFuture, err error) + UpdateByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.UpdateLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsUpdateByResourceGroupFuture, err error) +} + +var _ LongTermRetentionBackupsClientAPI = (*sql.LongTermRetentionBackupsClient)(nil) + +// LongTermRetentionPoliciesClientAPI contains the set of methods on the LongTermRetentionPoliciesClient type. +type LongTermRetentionPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.LongTermRetentionPolicy) (result sql.LongTermRetentionPoliciesCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LongTermRetentionPolicy, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LongTermRetentionPolicyListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LongTermRetentionPolicyListResultIterator, err error) +} + +var _ LongTermRetentionPoliciesClientAPI = (*sql.LongTermRetentionPoliciesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters sql.PrivateEndpointConnection) (result sql.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result sql.PrivateEndpointConnection, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultPage, err error) + ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.PrivateEndpointConnectionListResultIterator, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*sql.PrivateEndpointConnectionsClient)(nil) diff --git a/services/preview/sql/mgmt/v5.0/sql/CHANGELOG.md b/services/preview/sql/mgmt/v5.0/sql/CHANGELOG.md index 52911e4cc5e4..d5df43ece728 100644 --- a/services/preview/sql/mgmt/v5.0/sql/CHANGELOG.md +++ b/services/preview/sql/mgmt/v5.0/sql/CHANGELOG.md @@ -1,2 +1,591 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. BackupStorageRedundancy1.BackupStorageRedundancy1Geo +1. BackupStorageRedundancy1.BackupStorageRedundancy1Local +1. BackupStorageRedundancy1.BackupStorageRedundancy1Zone +1. CurrentBackupStorageRedundancy.CurrentBackupStorageRedundancyGeo +1. CurrentBackupStorageRedundancy.CurrentBackupStorageRedundancyLocal +1. CurrentBackupStorageRedundancy.CurrentBackupStorageRedundancyZone +1. RequestedBackupStorageRedundancy.RequestedBackupStorageRedundancyGeo +1. RequestedBackupStorageRedundancy.RequestedBackupStorageRedundancyLocal +1. RequestedBackupStorageRedundancy.RequestedBackupStorageRedundancyZone +1. StorageAccountType1.StorageAccountType1GRS +1. StorageAccountType1.StorageAccountType1LRS +1. StorageAccountType1.StorageAccountType1ZRS +1. TargetBackupStorageRedundancy.TargetBackupStorageRedundancyGeo +1. TargetBackupStorageRedundancy.TargetBackupStorageRedundancyLocal +1. TargetBackupStorageRedundancy.TargetBackupStorageRedundancyZone +1. TransparentDataEncryptionActivityStatus.TransparentDataEncryptionActivityStatusDecrypting +1. TransparentDataEncryptionActivityStatus.TransparentDataEncryptionActivityStatusEncrypting +1. TransparentDataEncryptionStatus.TransparentDataEncryptionStatusDisabled +1. TransparentDataEncryptionStatus.TransparentDataEncryptionStatusEnabled + +### Removed Funcs + +1. *OperationsHealth.UnmarshalJSON([]byte) error +1. *OperationsHealthListResultIterator.Next() error +1. *OperationsHealthListResultIterator.NextWithContext(context.Context) error +1. *OperationsHealthListResultPage.Next() error +1. *OperationsHealthListResultPage.NextWithContext(context.Context) error +1. *ReplicationLinksUnlinkFuture.UnmarshalJSON([]byte) error +1. *TransparentDataEncryption.UnmarshalJSON([]byte) error +1. *TransparentDataEncryptionActivity.UnmarshalJSON([]byte) error +1. NewOperationsHealthClient(string) OperationsHealthClient +1. NewOperationsHealthClientWithBaseURI(string, string) OperationsHealthClient +1. NewOperationsHealthListResultIterator(OperationsHealthListResultPage) OperationsHealthListResultIterator +1. NewOperationsHealthListResultPage(OperationsHealthListResult, func(context.Context, OperationsHealthListResult) (OperationsHealthListResult, error)) OperationsHealthListResultPage +1. NewTransparentDataEncryptionActivitiesClient(string) TransparentDataEncryptionActivitiesClient +1. NewTransparentDataEncryptionActivitiesClientWithBaseURI(string, string) TransparentDataEncryptionActivitiesClient +1. OperationsHealth.MarshalJSON() ([]byte, error) +1. OperationsHealthClient.ListByLocation(context.Context, string) (OperationsHealthListResultPage, error) +1. OperationsHealthClient.ListByLocationComplete(context.Context, string) (OperationsHealthListResultIterator, error) +1. OperationsHealthClient.ListByLocationPreparer(context.Context, string) (*http.Request, error) +1. OperationsHealthClient.ListByLocationResponder(*http.Response) (OperationsHealthListResult, error) +1. OperationsHealthClient.ListByLocationSender(*http.Request) (*http.Response, error) +1. OperationsHealthListResult.IsEmpty() bool +1. OperationsHealthListResult.MarshalJSON() ([]byte, error) +1. OperationsHealthListResultIterator.NotDone() bool +1. OperationsHealthListResultIterator.Response() OperationsHealthListResult +1. OperationsHealthListResultIterator.Value() OperationsHealth +1. OperationsHealthListResultPage.NotDone() bool +1. OperationsHealthListResultPage.Response() OperationsHealthListResult +1. OperationsHealthListResultPage.Values() []OperationsHealth +1. OperationsHealthProperties.MarshalJSON() ([]byte, error) +1. PossibleBackupStorageRedundancy1Values() []BackupStorageRedundancy1 +1. PossibleCurrentBackupStorageRedundancyValues() []CurrentBackupStorageRedundancy +1. PossibleRequestedBackupStorageRedundancyValues() []RequestedBackupStorageRedundancy +1. PossibleStorageAccountType1Values() []StorageAccountType1 +1. PossibleTargetBackupStorageRedundancyValues() []TargetBackupStorageRedundancy +1. PossibleTransparentDataEncryptionActivityStatusValues() []TransparentDataEncryptionActivityStatus +1. PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus +1. ReplicationLinksClient.Unlink(context.Context, string, string, string, string, UnlinkParameters) (ReplicationLinksUnlinkFuture, error) +1. ReplicationLinksClient.UnlinkPreparer(context.Context, string, string, string, string, UnlinkParameters) (*http.Request, error) +1. ReplicationLinksClient.UnlinkResponder(*http.Response) (autorest.Response, error) +1. ReplicationLinksClient.UnlinkSender(*http.Request) (ReplicationLinksUnlinkFuture, error) +1. ResourceIdentityWithUserAssignedIdentities.MarshalJSON() ([]byte, error) +1. TransparentDataEncryption.MarshalJSON() ([]byte, error) +1. TransparentDataEncryptionActivitiesClient.ListByConfiguration(context.Context, string, string, string) (TransparentDataEncryptionActivityListResult, error) +1. TransparentDataEncryptionActivitiesClient.ListByConfigurationPreparer(context.Context, string, string, string) (*http.Request, error) +1. TransparentDataEncryptionActivitiesClient.ListByConfigurationResponder(*http.Response) (TransparentDataEncryptionActivityListResult, error) +1. TransparentDataEncryptionActivitiesClient.ListByConfigurationSender(*http.Request) (*http.Response, error) +1. TransparentDataEncryptionActivity.MarshalJSON() ([]byte, error) +1. TransparentDataEncryptionActivityProperties.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### Removed Structs + +1. OperationsHealth +1. OperationsHealthClient +1. OperationsHealthListResult +1. OperationsHealthListResultIterator +1. OperationsHealthListResultPage +1. OperationsHealthProperties +1. ReplicationLinksUnlinkFuture +1. ResourceIdentityWithUserAssignedIdentities +1. TransparentDataEncryption +1. TransparentDataEncryptionActivitiesClient +1. TransparentDataEncryptionActivity +1. TransparentDataEncryptionActivityListResult +1. TransparentDataEncryptionActivityProperties +1. UnlinkParameters + +#### Removed Struct Fields + +1. DatabaseUpdate.*DatabaseProperties +1. ManagedInstanceProperties.StorageAccountType +1. RestorableDroppedDatabaseProperties.ElasticPoolID +1. TransparentDataEncryptionProperties.Status + +### Signature Changes + +#### Funcs + +1. ElasticPoolsClient.ListByServer + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, string, *int64 +1. ElasticPoolsClient.ListByServerComplete + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, string, *int64 +1. ElasticPoolsClient.ListByServerPreparer + - Params + - From: context.Context, string, string, *int32 + - To: context.Context, string, string, *int64 +1. LedgerDigestUploadsClient.CreateOrUpdate + - Returns + - From: LedgerDigestUploads, error + - To: LedgerDigestUploadsCreateOrUpdateFuture, error +1. LedgerDigestUploadsClient.CreateOrUpdateSender + - Returns + - From: *http.Response, error + - To: LedgerDigestUploadsCreateOrUpdateFuture, error +1. LedgerDigestUploadsClient.Disable + - Returns + - From: LedgerDigestUploads, error + - To: LedgerDigestUploadsDisableFuture, error +1. LedgerDigestUploadsClient.DisableSender + - Returns + - From: *http.Response, error + - To: LedgerDigestUploadsDisableFuture, error +1. ReplicationLinksClient.FailoverAllowDataLossResponder + - Returns + - From: autorest.Response, error + - To: ReplicationLink, error +1. ReplicationLinksClient.FailoverResponder + - Returns + - From: autorest.Response, error + - To: ReplicationLink, error +1. ServerConnectionPoliciesClient.CreateOrUpdate + - Returns + - From: ServerConnectionPolicy, error + - To: ServerConnectionPoliciesCreateOrUpdateFuture, error +1. ServerConnectionPoliciesClient.CreateOrUpdateSender + - Returns + - From: *http.Response, error + - To: ServerConnectionPoliciesCreateOrUpdateFuture, error +1. SyncGroupsClient.ListLogs + - Params + - From: context.Context, string, string, string, string, string, string, string, string + - To: context.Context, string, string, string, string, string, string, SyncGroupsType, string +1. SyncGroupsClient.ListLogsComplete + - Params + - From: context.Context, string, string, string, string, string, string, string, string + - To: context.Context, string, string, string, string, string, string, SyncGroupsType, string +1. SyncGroupsClient.ListLogsPreparer + - Params + - From: context.Context, string, string, string, string, string, string, string, string + - To: context.Context, string, string, string, string, string, string, SyncGroupsType, string +1. TransparentDataEncryptionsClient.CreateOrUpdate + - Params + - From: context.Context, string, string, string, TransparentDataEncryption + - To: context.Context, string, string, string, LogicalDatabaseTransparentDataEncryption + - Returns + - From: TransparentDataEncryption, error + - To: LogicalDatabaseTransparentDataEncryption, error +1. TransparentDataEncryptionsClient.CreateOrUpdatePreparer + - Params + - From: context.Context, string, string, string, TransparentDataEncryption + - To: context.Context, string, string, string, LogicalDatabaseTransparentDataEncryption +1. TransparentDataEncryptionsClient.CreateOrUpdateResponder + - Returns + - From: TransparentDataEncryption, error + - To: LogicalDatabaseTransparentDataEncryption, error +1. TransparentDataEncryptionsClient.Get + - Returns + - From: TransparentDataEncryption, error + - To: LogicalDatabaseTransparentDataEncryption, error +1. TransparentDataEncryptionsClient.GetResponder + - Returns + - From: TransparentDataEncryption, error + - To: LogicalDatabaseTransparentDataEncryption, error + +#### Struct Fields + +1. CopyLongTermRetentionBackupParametersProperties.TargetBackupStorageRedundancy changed type from TargetBackupStorageRedundancy to BackupStorageRedundancy +1. DatabaseProperties.CurrentBackupStorageRedundancy changed type from CurrentBackupStorageRedundancy to BackupStorageRedundancy +1. DatabaseProperties.RequestedBackupStorageRedundancy changed type from RequestedBackupStorageRedundancy to BackupStorageRedundancy +1. ReplicationLinksFailoverAllowDataLossFuture.Result changed type from func(ReplicationLinksClient) (autorest.Response, error) to func(ReplicationLinksClient) (ReplicationLink, error) +1. ReplicationLinksFailoverFuture.Result changed type from func(ReplicationLinksClient) (autorest.Response, error) to func(ReplicationLinksClient) (ReplicationLink, error) +1. RestorableDroppedDatabaseProperties.BackupStorageRedundancy changed type from BackupStorageRedundancy1 to BackupStorageRedundancy +1. StorageCapability.StorageAccountType changed type from StorageAccountType1 to StorageAccountType +1. UpdateLongTermRetentionBackupParametersProperties.RequestedBackupStorageRedundancy changed type from RequestedBackupStorageRedundancy to BackupStorageRedundancy + +## Additive Changes + +### New Constants + +1. BackupStorageRedundancy.BackupStorageRedundancyGeoZone +1. DatabaseIdentityType.DatabaseIdentityTypeNone +1. DatabaseIdentityType.DatabaseIdentityTypeUserAssigned +1. DatabaseStatus.DatabaseStatusStarting +1. DatabaseStatus.DatabaseStatusStopped +1. DatabaseStatus.DatabaseStatusStopping +1. IdentityType.IdentityTypeSystemAssignedUserAssigned +1. ProvisioningState1.ProvisioningState1Accepted +1. ProvisioningState1.ProvisioningState1Canceled +1. ProvisioningState1.ProvisioningState1Created +1. ProvisioningState1.ProvisioningState1Deleted +1. ProvisioningState1.ProvisioningState1NotSpecified +1. ProvisioningState1.ProvisioningState1Registering +1. ProvisioningState1.ProvisioningState1Running +1. ProvisioningState1.ProvisioningState1TimedOut +1. ProvisioningState1.ProvisioningState1Unrecognized +1. ReplicationMode.ReplicationModeAsync +1. ReplicationMode.ReplicationModeSync +1. ServicePrincipalType.ServicePrincipalTypeNone +1. ServicePrincipalType.ServicePrincipalTypeSystemAssigned +1. SyncGroupsType.SyncGroupsTypeAll +1. SyncGroupsType.SyncGroupsTypeError +1. SyncGroupsType.SyncGroupsTypeSuccess +1. SyncGroupsType.SyncGroupsTypeWarning + +### New Funcs + +1. *DistributedAvailabilityGroup.UnmarshalJSON([]byte) error +1. *DistributedAvailabilityGroupsCreateOrUpdateFuture.UnmarshalJSON([]byte) error +1. *DistributedAvailabilityGroupsDeleteFuture.UnmarshalJSON([]byte) error +1. *DistributedAvailabilityGroupsListResultIterator.Next() error +1. *DistributedAvailabilityGroupsListResultIterator.NextWithContext(context.Context) error +1. *DistributedAvailabilityGroupsListResultPage.Next() error +1. *DistributedAvailabilityGroupsListResultPage.NextWithContext(context.Context) error +1. *DistributedAvailabilityGroupsUpdateFuture.UnmarshalJSON([]byte) error +1. *EndpointCertificate.UnmarshalJSON([]byte) error +1. *EndpointCertificateListResultIterator.Next() error +1. *EndpointCertificateListResultIterator.NextWithContext(context.Context) error +1. *EndpointCertificateListResultPage.Next() error +1. *EndpointCertificateListResultPage.NextWithContext(context.Context) error +1. *IPv6FirewallRule.UnmarshalJSON([]byte) error +1. *IPv6FirewallRuleListResultIterator.Next() error +1. *IPv6FirewallRuleListResultIterator.NextWithContext(context.Context) error +1. *IPv6FirewallRuleListResultPage.Next() error +1. *IPv6FirewallRuleListResultPage.NextWithContext(context.Context) error +1. *LedgerDigestUploadsCreateOrUpdateFuture.UnmarshalJSON([]byte) error +1. *LedgerDigestUploadsDisableFuture.UnmarshalJSON([]byte) error +1. *LogicalDatabaseTransparentDataEncryption.UnmarshalJSON([]byte) error +1. *LogicalDatabaseTransparentDataEncryptionListResultIterator.Next() error +1. *LogicalDatabaseTransparentDataEncryptionListResultIterator.NextWithContext(context.Context) error +1. *LogicalDatabaseTransparentDataEncryptionListResultPage.Next() error +1. *LogicalDatabaseTransparentDataEncryptionListResultPage.NextWithContext(context.Context) error +1. *ManagedInstanceDtc.UnmarshalJSON([]byte) error +1. *ManagedInstanceDtcListResultIterator.Next() error +1. *ManagedInstanceDtcListResultIterator.NextWithContext(context.Context) error +1. *ManagedInstanceDtcListResultPage.Next() error +1. *ManagedInstanceDtcListResultPage.NextWithContext(context.Context) error +1. *ManagedInstanceDtcsCreateOrUpdateFuture.UnmarshalJSON([]byte) error +1. *ManagedServerDNSAlias.UnmarshalJSON([]byte) error +1. *ManagedServerDNSAliasListResultIterator.Next() error +1. *ManagedServerDNSAliasListResultIterator.NextWithContext(context.Context) error +1. *ManagedServerDNSAliasListResultPage.Next() error +1. *ManagedServerDNSAliasListResultPage.NextWithContext(context.Context) error +1. *ManagedServerDNSAliasesAcquireFuture.UnmarshalJSON([]byte) error +1. *ManagedServerDNSAliasesCreateOrUpdateFuture.UnmarshalJSON([]byte) error +1. *ManagedServerDNSAliasesDeleteFuture.UnmarshalJSON([]byte) error +1. *ServerConnectionPoliciesCreateOrUpdateFuture.UnmarshalJSON([]byte) error +1. *ServerConnectionPolicyListResultIterator.Next() error +1. *ServerConnectionPolicyListResultIterator.NextWithContext(context.Context) error +1. *ServerConnectionPolicyListResultPage.Next() error +1. *ServerConnectionPolicyListResultPage.NextWithContext(context.Context) error +1. *ServerTrustCertificate.UnmarshalJSON([]byte) error +1. *ServerTrustCertificatesCreateOrUpdateFuture.UnmarshalJSON([]byte) error +1. *ServerTrustCertificatesDeleteFuture.UnmarshalJSON([]byte) error +1. *ServerTrustCertificatesListResultIterator.Next() error +1. *ServerTrustCertificatesListResultIterator.NextWithContext(context.Context) error +1. *ServerTrustCertificatesListResultPage.Next() error +1. *ServerTrustCertificatesListResultPage.NextWithContext(context.Context) error +1. DatabaseIdentity.MarshalJSON() ([]byte, error) +1. DatabaseUpdateProperties.MarshalJSON() ([]byte, error) +1. DatabaseUserIdentity.MarshalJSON() ([]byte, error) +1. DistributedAvailabilityGroup.MarshalJSON() ([]byte, error) +1. DistributedAvailabilityGroupProperties.MarshalJSON() ([]byte, error) +1. DistributedAvailabilityGroupsClient.CreateOrUpdate(context.Context, string, string, string, DistributedAvailabilityGroup) (DistributedAvailabilityGroupsCreateOrUpdateFuture, error) +1. DistributedAvailabilityGroupsClient.CreateOrUpdatePreparer(context.Context, string, string, string, DistributedAvailabilityGroup) (*http.Request, error) +1. DistributedAvailabilityGroupsClient.CreateOrUpdateResponder(*http.Response) (DistributedAvailabilityGroup, error) +1. DistributedAvailabilityGroupsClient.CreateOrUpdateSender(*http.Request) (DistributedAvailabilityGroupsCreateOrUpdateFuture, error) +1. DistributedAvailabilityGroupsClient.Delete(context.Context, string, string, string) (DistributedAvailabilityGroupsDeleteFuture, error) +1. DistributedAvailabilityGroupsClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error) +1. DistributedAvailabilityGroupsClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. DistributedAvailabilityGroupsClient.DeleteSender(*http.Request) (DistributedAvailabilityGroupsDeleteFuture, error) +1. DistributedAvailabilityGroupsClient.Get(context.Context, string, string, string) (DistributedAvailabilityGroup, error) +1. DistributedAvailabilityGroupsClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. DistributedAvailabilityGroupsClient.GetResponder(*http.Response) (DistributedAvailabilityGroup, error) +1. DistributedAvailabilityGroupsClient.GetSender(*http.Request) (*http.Response, error) +1. DistributedAvailabilityGroupsClient.ListByInstance(context.Context, string, string) (DistributedAvailabilityGroupsListResultPage, error) +1. DistributedAvailabilityGroupsClient.ListByInstanceComplete(context.Context, string, string) (DistributedAvailabilityGroupsListResultIterator, error) +1. DistributedAvailabilityGroupsClient.ListByInstancePreparer(context.Context, string, string) (*http.Request, error) +1. DistributedAvailabilityGroupsClient.ListByInstanceResponder(*http.Response) (DistributedAvailabilityGroupsListResult, error) +1. DistributedAvailabilityGroupsClient.ListByInstanceSender(*http.Request) (*http.Response, error) +1. DistributedAvailabilityGroupsClient.Update(context.Context, string, string, string, DistributedAvailabilityGroup) (DistributedAvailabilityGroupsUpdateFuture, error) +1. DistributedAvailabilityGroupsClient.UpdatePreparer(context.Context, string, string, string, DistributedAvailabilityGroup) (*http.Request, error) +1. DistributedAvailabilityGroupsClient.UpdateResponder(*http.Response) (DistributedAvailabilityGroup, error) +1. DistributedAvailabilityGroupsClient.UpdateSender(*http.Request) (DistributedAvailabilityGroupsUpdateFuture, error) +1. DistributedAvailabilityGroupsListResult.IsEmpty() bool +1. DistributedAvailabilityGroupsListResult.MarshalJSON() ([]byte, error) +1. DistributedAvailabilityGroupsListResultIterator.NotDone() bool +1. DistributedAvailabilityGroupsListResultIterator.Response() DistributedAvailabilityGroupsListResult +1. DistributedAvailabilityGroupsListResultIterator.Value() DistributedAvailabilityGroup +1. DistributedAvailabilityGroupsListResultPage.NotDone() bool +1. DistributedAvailabilityGroupsListResultPage.Response() DistributedAvailabilityGroupsListResult +1. DistributedAvailabilityGroupsListResultPage.Values() []DistributedAvailabilityGroup +1. EndpointCertificate.MarshalJSON() ([]byte, error) +1. EndpointCertificateListResult.IsEmpty() bool +1. EndpointCertificateListResult.MarshalJSON() ([]byte, error) +1. EndpointCertificateListResultIterator.NotDone() bool +1. EndpointCertificateListResultIterator.Response() EndpointCertificateListResult +1. EndpointCertificateListResultIterator.Value() EndpointCertificate +1. EndpointCertificateListResultPage.NotDone() bool +1. EndpointCertificateListResultPage.Response() EndpointCertificateListResult +1. EndpointCertificateListResultPage.Values() []EndpointCertificate +1. EndpointCertificatesClient.Get(context.Context, string, string, string) (EndpointCertificate, error) +1. EndpointCertificatesClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. EndpointCertificatesClient.GetResponder(*http.Response) (EndpointCertificate, error) +1. EndpointCertificatesClient.GetSender(*http.Request) (*http.Response, error) +1. EndpointCertificatesClient.ListByInstance(context.Context, string, string) (EndpointCertificateListResultPage, error) +1. EndpointCertificatesClient.ListByInstanceComplete(context.Context, string, string) (EndpointCertificateListResultIterator, error) +1. EndpointCertificatesClient.ListByInstancePreparer(context.Context, string, string) (*http.Request, error) +1. EndpointCertificatesClient.ListByInstanceResponder(*http.Response) (EndpointCertificateListResult, error) +1. EndpointCertificatesClient.ListByInstanceSender(*http.Request) (*http.Response, error) +1. IPv6FirewallRule.MarshalJSON() ([]byte, error) +1. IPv6FirewallRuleListResult.IsEmpty() bool +1. IPv6FirewallRuleListResult.MarshalJSON() ([]byte, error) +1. IPv6FirewallRuleListResultIterator.NotDone() bool +1. IPv6FirewallRuleListResultIterator.Response() IPv6FirewallRuleListResult +1. IPv6FirewallRuleListResultIterator.Value() IPv6FirewallRule +1. IPv6FirewallRuleListResultPage.NotDone() bool +1. IPv6FirewallRuleListResultPage.Response() IPv6FirewallRuleListResult +1. IPv6FirewallRuleListResultPage.Values() []IPv6FirewallRule +1. IPv6FirewallRulesClient.CreateOrUpdate(context.Context, string, string, string, IPv6FirewallRule) (IPv6FirewallRule, error) +1. IPv6FirewallRulesClient.CreateOrUpdatePreparer(context.Context, string, string, string, IPv6FirewallRule) (*http.Request, error) +1. IPv6FirewallRulesClient.CreateOrUpdateResponder(*http.Response) (IPv6FirewallRule, error) +1. IPv6FirewallRulesClient.CreateOrUpdateSender(*http.Request) (*http.Response, error) +1. IPv6FirewallRulesClient.Delete(context.Context, string, string, string) (autorest.Response, error) +1. IPv6FirewallRulesClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error) +1. IPv6FirewallRulesClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. IPv6FirewallRulesClient.DeleteSender(*http.Request) (*http.Response, error) +1. IPv6FirewallRulesClient.Get(context.Context, string, string, string) (IPv6FirewallRule, error) +1. IPv6FirewallRulesClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. IPv6FirewallRulesClient.GetResponder(*http.Response) (IPv6FirewallRule, error) +1. IPv6FirewallRulesClient.GetSender(*http.Request) (*http.Response, error) +1. IPv6FirewallRulesClient.ListByServer(context.Context, string, string) (IPv6FirewallRuleListResultPage, error) +1. IPv6FirewallRulesClient.ListByServerComplete(context.Context, string, string) (IPv6FirewallRuleListResultIterator, error) +1. IPv6FirewallRulesClient.ListByServerPreparer(context.Context, string, string) (*http.Request, error) +1. IPv6FirewallRulesClient.ListByServerResponder(*http.Response) (IPv6FirewallRuleListResult, error) +1. IPv6FirewallRulesClient.ListByServerSender(*http.Request) (*http.Response, error) +1. LogicalDatabaseTransparentDataEncryption.MarshalJSON() ([]byte, error) +1. LogicalDatabaseTransparentDataEncryptionListResult.IsEmpty() bool +1. LogicalDatabaseTransparentDataEncryptionListResult.MarshalJSON() ([]byte, error) +1. LogicalDatabaseTransparentDataEncryptionListResultIterator.NotDone() bool +1. LogicalDatabaseTransparentDataEncryptionListResultIterator.Response() LogicalDatabaseTransparentDataEncryptionListResult +1. LogicalDatabaseTransparentDataEncryptionListResultIterator.Value() LogicalDatabaseTransparentDataEncryption +1. LogicalDatabaseTransparentDataEncryptionListResultPage.NotDone() bool +1. LogicalDatabaseTransparentDataEncryptionListResultPage.Response() LogicalDatabaseTransparentDataEncryptionListResult +1. LogicalDatabaseTransparentDataEncryptionListResultPage.Values() []LogicalDatabaseTransparentDataEncryption +1. ManagedDatabaseSensitivityLabelsClient.ListByDatabase(context.Context, string, string, string, string) (SensitivityLabelListResultPage, error) +1. ManagedDatabaseSensitivityLabelsClient.ListByDatabaseComplete(context.Context, string, string, string, string) (SensitivityLabelListResultIterator, error) +1. ManagedDatabaseSensitivityLabelsClient.ListByDatabasePreparer(context.Context, string, string, string, string) (*http.Request, error) +1. ManagedDatabaseSensitivityLabelsClient.ListByDatabaseResponder(*http.Response) (SensitivityLabelListResult, error) +1. ManagedDatabaseSensitivityLabelsClient.ListByDatabaseSender(*http.Request) (*http.Response, error) +1. ManagedInstanceDtc.MarshalJSON() ([]byte, error) +1. ManagedInstanceDtcListResult.IsEmpty() bool +1. ManagedInstanceDtcListResult.MarshalJSON() ([]byte, error) +1. ManagedInstanceDtcListResultIterator.NotDone() bool +1. ManagedInstanceDtcListResultIterator.Response() ManagedInstanceDtcListResult +1. ManagedInstanceDtcListResultIterator.Value() ManagedInstanceDtc +1. ManagedInstanceDtcListResultPage.NotDone() bool +1. ManagedInstanceDtcListResultPage.Response() ManagedInstanceDtcListResult +1. ManagedInstanceDtcListResultPage.Values() []ManagedInstanceDtc +1. ManagedInstanceDtcProperties.MarshalJSON() ([]byte, error) +1. ManagedInstanceDtcsClient.CreateOrUpdate(context.Context, string, string, ManagedInstanceDtc) (ManagedInstanceDtcsCreateOrUpdateFuture, error) +1. ManagedInstanceDtcsClient.CreateOrUpdatePreparer(context.Context, string, string, ManagedInstanceDtc) (*http.Request, error) +1. ManagedInstanceDtcsClient.CreateOrUpdateResponder(*http.Response) (ManagedInstanceDtc, error) +1. ManagedInstanceDtcsClient.CreateOrUpdateSender(*http.Request) (ManagedInstanceDtcsCreateOrUpdateFuture, error) +1. ManagedInstanceDtcsClient.Get(context.Context, string, string) (ManagedInstanceDtc, error) +1. ManagedInstanceDtcsClient.GetPreparer(context.Context, string, string) (*http.Request, error) +1. ManagedInstanceDtcsClient.GetResponder(*http.Response) (ManagedInstanceDtc, error) +1. ManagedInstanceDtcsClient.GetSender(*http.Request) (*http.Response, error) +1. ManagedInstanceDtcsClient.ListByManagedInstance(context.Context, string, string) (ManagedInstanceDtcListResultPage, error) +1. ManagedInstanceDtcsClient.ListByManagedInstanceComplete(context.Context, string, string) (ManagedInstanceDtcListResultIterator, error) +1. ManagedInstanceDtcsClient.ListByManagedInstancePreparer(context.Context, string, string) (*http.Request, error) +1. ManagedInstanceDtcsClient.ListByManagedInstanceResponder(*http.Response) (ManagedInstanceDtcListResult, error) +1. ManagedInstanceDtcsClient.ListByManagedInstanceSender(*http.Request) (*http.Response, error) +1. ManagedServerDNSAlias.MarshalJSON() ([]byte, error) +1. ManagedServerDNSAliasListResult.IsEmpty() bool +1. ManagedServerDNSAliasListResult.MarshalJSON() ([]byte, error) +1. ManagedServerDNSAliasListResultIterator.NotDone() bool +1. ManagedServerDNSAliasListResultIterator.Response() ManagedServerDNSAliasListResult +1. ManagedServerDNSAliasListResultIterator.Value() ManagedServerDNSAlias +1. ManagedServerDNSAliasListResultPage.NotDone() bool +1. ManagedServerDNSAliasListResultPage.Response() ManagedServerDNSAliasListResult +1. ManagedServerDNSAliasListResultPage.Values() []ManagedServerDNSAlias +1. ManagedServerDNSAliasProperties.MarshalJSON() ([]byte, error) +1. ManagedServerDNSAliasesClient.Acquire(context.Context, string, string, string, ManagedServerDNSAliasAcquisition) (ManagedServerDNSAliasesAcquireFuture, error) +1. ManagedServerDNSAliasesClient.AcquirePreparer(context.Context, string, string, string, ManagedServerDNSAliasAcquisition) (*http.Request, error) +1. ManagedServerDNSAliasesClient.AcquireResponder(*http.Response) (ManagedServerDNSAlias, error) +1. ManagedServerDNSAliasesClient.AcquireSender(*http.Request) (ManagedServerDNSAliasesAcquireFuture, error) +1. ManagedServerDNSAliasesClient.CreateOrUpdate(context.Context, string, string, string, ManagedServerDNSAliasCreation) (ManagedServerDNSAliasesCreateOrUpdateFuture, error) +1. ManagedServerDNSAliasesClient.CreateOrUpdatePreparer(context.Context, string, string, string, ManagedServerDNSAliasCreation) (*http.Request, error) +1. ManagedServerDNSAliasesClient.CreateOrUpdateResponder(*http.Response) (ManagedServerDNSAlias, error) +1. ManagedServerDNSAliasesClient.CreateOrUpdateSender(*http.Request) (ManagedServerDNSAliasesCreateOrUpdateFuture, error) +1. ManagedServerDNSAliasesClient.Delete(context.Context, string, string, string) (ManagedServerDNSAliasesDeleteFuture, error) +1. ManagedServerDNSAliasesClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error) +1. ManagedServerDNSAliasesClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. ManagedServerDNSAliasesClient.DeleteSender(*http.Request) (ManagedServerDNSAliasesDeleteFuture, error) +1. ManagedServerDNSAliasesClient.Get(context.Context, string, string, string) (ManagedServerDNSAlias, error) +1. ManagedServerDNSAliasesClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. ManagedServerDNSAliasesClient.GetResponder(*http.Response) (ManagedServerDNSAlias, error) +1. ManagedServerDNSAliasesClient.GetSender(*http.Request) (*http.Response, error) +1. ManagedServerDNSAliasesClient.ListByManagedInstance(context.Context, string, string) (ManagedServerDNSAliasListResultPage, error) +1. ManagedServerDNSAliasesClient.ListByManagedInstanceComplete(context.Context, string, string) (ManagedServerDNSAliasListResultIterator, error) +1. ManagedServerDNSAliasesClient.ListByManagedInstancePreparer(context.Context, string, string) (*http.Request, error) +1. ManagedServerDNSAliasesClient.ListByManagedInstanceResponder(*http.Response) (ManagedServerDNSAliasListResult, error) +1. ManagedServerDNSAliasesClient.ListByManagedInstanceSender(*http.Request) (*http.Response, error) +1. NewDistributedAvailabilityGroupsClient(string) DistributedAvailabilityGroupsClient +1. NewDistributedAvailabilityGroupsClientWithBaseURI(string, string) DistributedAvailabilityGroupsClient +1. NewDistributedAvailabilityGroupsListResultIterator(DistributedAvailabilityGroupsListResultPage) DistributedAvailabilityGroupsListResultIterator +1. NewDistributedAvailabilityGroupsListResultPage(DistributedAvailabilityGroupsListResult, func(context.Context, DistributedAvailabilityGroupsListResult) (DistributedAvailabilityGroupsListResult, error)) DistributedAvailabilityGroupsListResultPage +1. NewEndpointCertificateListResultIterator(EndpointCertificateListResultPage) EndpointCertificateListResultIterator +1. NewEndpointCertificateListResultPage(EndpointCertificateListResult, func(context.Context, EndpointCertificateListResult) (EndpointCertificateListResult, error)) EndpointCertificateListResultPage +1. NewEndpointCertificatesClient(string) EndpointCertificatesClient +1. NewEndpointCertificatesClientWithBaseURI(string, string) EndpointCertificatesClient +1. NewIPv6FirewallRuleListResultIterator(IPv6FirewallRuleListResultPage) IPv6FirewallRuleListResultIterator +1. NewIPv6FirewallRuleListResultPage(IPv6FirewallRuleListResult, func(context.Context, IPv6FirewallRuleListResult) (IPv6FirewallRuleListResult, error)) IPv6FirewallRuleListResultPage +1. NewIPv6FirewallRulesClient(string) IPv6FirewallRulesClient +1. NewIPv6FirewallRulesClientWithBaseURI(string, string) IPv6FirewallRulesClient +1. NewLogicalDatabaseTransparentDataEncryptionListResultIterator(LogicalDatabaseTransparentDataEncryptionListResultPage) LogicalDatabaseTransparentDataEncryptionListResultIterator +1. NewLogicalDatabaseTransparentDataEncryptionListResultPage(LogicalDatabaseTransparentDataEncryptionListResult, func(context.Context, LogicalDatabaseTransparentDataEncryptionListResult) (LogicalDatabaseTransparentDataEncryptionListResult, error)) LogicalDatabaseTransparentDataEncryptionListResultPage +1. NewManagedInstanceDtcListResultIterator(ManagedInstanceDtcListResultPage) ManagedInstanceDtcListResultIterator +1. NewManagedInstanceDtcListResultPage(ManagedInstanceDtcListResult, func(context.Context, ManagedInstanceDtcListResult) (ManagedInstanceDtcListResult, error)) ManagedInstanceDtcListResultPage +1. NewManagedInstanceDtcsClient(string) ManagedInstanceDtcsClient +1. NewManagedInstanceDtcsClientWithBaseURI(string, string) ManagedInstanceDtcsClient +1. NewManagedServerDNSAliasListResultIterator(ManagedServerDNSAliasListResultPage) ManagedServerDNSAliasListResultIterator +1. NewManagedServerDNSAliasListResultPage(ManagedServerDNSAliasListResult, func(context.Context, ManagedServerDNSAliasListResult) (ManagedServerDNSAliasListResult, error)) ManagedServerDNSAliasListResultPage +1. NewManagedServerDNSAliasesClient(string) ManagedServerDNSAliasesClient +1. NewManagedServerDNSAliasesClientWithBaseURI(string, string) ManagedServerDNSAliasesClient +1. NewServerConnectionPolicyListResultIterator(ServerConnectionPolicyListResultPage) ServerConnectionPolicyListResultIterator +1. NewServerConnectionPolicyListResultPage(ServerConnectionPolicyListResult, func(context.Context, ServerConnectionPolicyListResult) (ServerConnectionPolicyListResult, error)) ServerConnectionPolicyListResultPage +1. NewServerTrustCertificatesClient(string) ServerTrustCertificatesClient +1. NewServerTrustCertificatesClientWithBaseURI(string, string) ServerTrustCertificatesClient +1. NewServerTrustCertificatesListResultIterator(ServerTrustCertificatesListResultPage) ServerTrustCertificatesListResultIterator +1. NewServerTrustCertificatesListResultPage(ServerTrustCertificatesListResult, func(context.Context, ServerTrustCertificatesListResult) (ServerTrustCertificatesListResult, error)) ServerTrustCertificatesListResultPage +1. PossibleDatabaseIdentityTypeValues() []DatabaseIdentityType +1. PossibleReplicationModeValues() []ReplicationMode +1. PossibleServicePrincipalTypeValues() []ServicePrincipalType +1. PossibleSyncGroupsTypeValues() []SyncGroupsType +1. SensitivityLabelsClient.ListByDatabase(context.Context, string, string, string, string) (SensitivityLabelListResultPage, error) +1. SensitivityLabelsClient.ListByDatabaseComplete(context.Context, string, string, string, string) (SensitivityLabelListResultIterator, error) +1. SensitivityLabelsClient.ListByDatabasePreparer(context.Context, string, string, string, string) (*http.Request, error) +1. SensitivityLabelsClient.ListByDatabaseResponder(*http.Response) (SensitivityLabelListResult, error) +1. SensitivityLabelsClient.ListByDatabaseSender(*http.Request) (*http.Response, error) +1. ServerConnectionPoliciesClient.ListByServer(context.Context, string, string) (ServerConnectionPolicyListResultPage, error) +1. ServerConnectionPoliciesClient.ListByServerComplete(context.Context, string, string) (ServerConnectionPolicyListResultIterator, error) +1. ServerConnectionPoliciesClient.ListByServerPreparer(context.Context, string, string) (*http.Request, error) +1. ServerConnectionPoliciesClient.ListByServerResponder(*http.Response) (ServerConnectionPolicyListResult, error) +1. ServerConnectionPoliciesClient.ListByServerSender(*http.Request) (*http.Response, error) +1. ServerConnectionPolicyListResult.IsEmpty() bool +1. ServerConnectionPolicyListResult.MarshalJSON() ([]byte, error) +1. ServerConnectionPolicyListResultIterator.NotDone() bool +1. ServerConnectionPolicyListResultIterator.Response() ServerConnectionPolicyListResult +1. ServerConnectionPolicyListResultIterator.Value() ServerConnectionPolicy +1. ServerConnectionPolicyListResultPage.NotDone() bool +1. ServerConnectionPolicyListResultPage.Response() ServerConnectionPolicyListResult +1. ServerConnectionPolicyListResultPage.Values() []ServerConnectionPolicy +1. ServerTrustCertificate.MarshalJSON() ([]byte, error) +1. ServerTrustCertificateProperties.MarshalJSON() ([]byte, error) +1. ServerTrustCertificatesClient.CreateOrUpdate(context.Context, string, string, string, ServerTrustCertificate) (ServerTrustCertificatesCreateOrUpdateFuture, error) +1. ServerTrustCertificatesClient.CreateOrUpdatePreparer(context.Context, string, string, string, ServerTrustCertificate) (*http.Request, error) +1. ServerTrustCertificatesClient.CreateOrUpdateResponder(*http.Response) (ServerTrustCertificate, error) +1. ServerTrustCertificatesClient.CreateOrUpdateSender(*http.Request) (ServerTrustCertificatesCreateOrUpdateFuture, error) +1. ServerTrustCertificatesClient.Delete(context.Context, string, string, string) (ServerTrustCertificatesDeleteFuture, error) +1. ServerTrustCertificatesClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error) +1. ServerTrustCertificatesClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. ServerTrustCertificatesClient.DeleteSender(*http.Request) (ServerTrustCertificatesDeleteFuture, error) +1. ServerTrustCertificatesClient.Get(context.Context, string, string, string) (ServerTrustCertificate, error) +1. ServerTrustCertificatesClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. ServerTrustCertificatesClient.GetResponder(*http.Response) (ServerTrustCertificate, error) +1. ServerTrustCertificatesClient.GetSender(*http.Request) (*http.Response, error) +1. ServerTrustCertificatesClient.ListByInstance(context.Context, string, string) (ServerTrustCertificatesListResultPage, error) +1. ServerTrustCertificatesClient.ListByInstanceComplete(context.Context, string, string) (ServerTrustCertificatesListResultIterator, error) +1. ServerTrustCertificatesClient.ListByInstancePreparer(context.Context, string, string) (*http.Request, error) +1. ServerTrustCertificatesClient.ListByInstanceResponder(*http.Response) (ServerTrustCertificatesListResult, error) +1. ServerTrustCertificatesClient.ListByInstanceSender(*http.Request) (*http.Response, error) +1. ServerTrustCertificatesListResult.IsEmpty() bool +1. ServerTrustCertificatesListResult.MarshalJSON() ([]byte, error) +1. ServerTrustCertificatesListResultIterator.NotDone() bool +1. ServerTrustCertificatesListResultIterator.Response() ServerTrustCertificatesListResult +1. ServerTrustCertificatesListResultIterator.Value() ServerTrustCertificate +1. ServerTrustCertificatesListResultPage.NotDone() bool +1. ServerTrustCertificatesListResultPage.Response() ServerTrustCertificatesListResult +1. ServerTrustCertificatesListResultPage.Values() []ServerTrustCertificate +1. ServicePrincipal.MarshalJSON() ([]byte, error) +1. TransparentDataEncryptionsClient.ListByDatabase(context.Context, string, string, string) (LogicalDatabaseTransparentDataEncryptionListResultPage, error) +1. TransparentDataEncryptionsClient.ListByDatabaseComplete(context.Context, string, string, string) (LogicalDatabaseTransparentDataEncryptionListResultIterator, error) +1. TransparentDataEncryptionsClient.ListByDatabasePreparer(context.Context, string, string, string) (*http.Request, error) +1. TransparentDataEncryptionsClient.ListByDatabaseResponder(*http.Response) (LogicalDatabaseTransparentDataEncryptionListResult, error) +1. TransparentDataEncryptionsClient.ListByDatabaseSender(*http.Request) (*http.Response, error) + +### Struct Changes + +#### New Structs + +1. DatabaseIdentity +1. DatabaseUpdateProperties +1. DatabaseUserIdentity +1. DistributedAvailabilityGroup +1. DistributedAvailabilityGroupProperties +1. DistributedAvailabilityGroupsClient +1. DistributedAvailabilityGroupsCreateOrUpdateFuture +1. DistributedAvailabilityGroupsDeleteFuture +1. DistributedAvailabilityGroupsListResult +1. DistributedAvailabilityGroupsListResultIterator +1. DistributedAvailabilityGroupsListResultPage +1. DistributedAvailabilityGroupsUpdateFuture +1. EndpointCertificate +1. EndpointCertificateListResult +1. EndpointCertificateListResultIterator +1. EndpointCertificateListResultPage +1. EndpointCertificateProperties +1. EndpointCertificatesClient +1. IPv6FirewallRule +1. IPv6FirewallRuleListResult +1. IPv6FirewallRuleListResultIterator +1. IPv6FirewallRuleListResultPage +1. IPv6FirewallRulesClient +1. IPv6ServerFirewallRuleProperties +1. LedgerDigestUploadsCreateOrUpdateFuture +1. LedgerDigestUploadsDisableFuture +1. LogicalDatabaseTransparentDataEncryption +1. LogicalDatabaseTransparentDataEncryptionListResult +1. LogicalDatabaseTransparentDataEncryptionListResultIterator +1. LogicalDatabaseTransparentDataEncryptionListResultPage +1. ManagedInstanceDtc +1. ManagedInstanceDtcListResult +1. ManagedInstanceDtcListResultIterator +1. ManagedInstanceDtcListResultPage +1. ManagedInstanceDtcProperties +1. ManagedInstanceDtcSecuritySettings +1. ManagedInstanceDtcTransactionManagerCommunicationSettings +1. ManagedInstanceDtcsClient +1. ManagedInstanceDtcsCreateOrUpdateFuture +1. ManagedServerDNSAlias +1. ManagedServerDNSAliasAcquisition +1. ManagedServerDNSAliasCreation +1. ManagedServerDNSAliasListResult +1. ManagedServerDNSAliasListResultIterator +1. ManagedServerDNSAliasListResultPage +1. ManagedServerDNSAliasProperties +1. ManagedServerDNSAliasesAcquireFuture +1. ManagedServerDNSAliasesClient +1. ManagedServerDNSAliasesCreateOrUpdateFuture +1. ManagedServerDNSAliasesDeleteFuture +1. ServerConnectionPoliciesCreateOrUpdateFuture +1. ServerConnectionPolicyListResult +1. ServerConnectionPolicyListResultIterator +1. ServerConnectionPolicyListResultPage +1. ServerTrustCertificate +1. ServerTrustCertificateProperties +1. ServerTrustCertificatesClient +1. ServerTrustCertificatesCreateOrUpdateFuture +1. ServerTrustCertificatesDeleteFuture +1. ServerTrustCertificatesListResult +1. ServerTrustCertificatesListResultIterator +1. ServerTrustCertificatesListResultPage +1. ServicePrincipal + +#### New Struct Fields + +1. Database.Identity +1. DatabaseProperties.FederatedClientID +1. DatabaseProperties.SourceResourceID +1. DatabaseUpdate.*DatabaseUpdateProperties +1. DatabaseUpdate.Identity +1. ElasticPoolProperties.HighAvailabilityReplicaCount +1. ElasticPoolUpdateProperties.HighAvailabilityReplicaCount +1. ManagedInstanceProperties.CurrentBackupStorageRedundancy +1. ManagedInstanceProperties.RequestedBackupStorageRedundancy +1. ManagedInstanceProperties.ServicePrincipal +1. TransparentDataEncryptionProperties.State diff --git a/services/preview/sql/mgmt/v5.0/sql/_meta.json b/services/preview/sql/mgmt/v5.0/sql/_meta.json index fe8ee2dae0a5..423a85ca90ee 100644 --- a/services/preview/sql/mgmt/v5.0/sql/_meta.json +++ b/services/preview/sql/mgmt/v5.0/sql/_meta.json @@ -1,5 +1,5 @@ { - "commit": "8dff86df71bee429af84ea4713288ef3cdd1db2f", + "commit": "02a2528dc0ceeb13d8042069a07b450fe5353da2", "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", "tag": "package-composite-v5", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/sql/mgmt/v5.0/sql/databases.go b/services/preview/sql/mgmt/v5.0/sql/databases.go index 148a7b9a3c1f..3393ead14dcb 100644 --- a/services/preview/sql/mgmt/v5.0/sql/databases.go +++ b/services/preview/sql/mgmt/v5.0/sql/databases.go @@ -86,7 +86,7 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -172,7 +172,7 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -263,7 +263,7 @@ func (client DatabasesClient) ExportPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -348,7 +348,7 @@ func (client DatabasesClient) FailoverPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -439,7 +439,7 @@ func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -521,7 +521,7 @@ func (client DatabasesClient) ImportPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -617,7 +617,7 @@ func (client DatabasesClient) ListByElasticPoolPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -736,7 +736,7 @@ func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -858,7 +858,7 @@ func (client DatabasesClient) ListInaccessibleByServerPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1127,7 +1127,7 @@ func (client DatabasesClient) PausePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1223,7 +1223,7 @@ func (client DatabasesClient) RenamePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1296,7 +1296,7 @@ func (client DatabasesClient) ResumePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1379,7 +1379,7 @@ func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1463,7 +1463,7 @@ func (client DatabasesClient) UpgradeDataWarehousePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/databasesecurityalertpolicies.go b/services/preview/sql/mgmt/v5.0/sql/databasesecurityalertpolicies.go index deace584057c..7637a7d50a2c 100644 --- a/services/preview/sql/mgmt/v5.0/sql/databasesecurityalertpolicies.go +++ b/services/preview/sql/mgmt/v5.0/sql/databasesecurityalertpolicies.go @@ -78,7 +78,7 @@ func (client DatabaseSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx con pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), + "securityAlertPolicyName": autorest.Encode("path", "Default"), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -161,7 +161,7 @@ func (client DatabaseSecurityAlertPoliciesClient) GetPreparer(ctx context.Contex pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), + "securityAlertPolicyName": autorest.Encode("path", "Default"), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } diff --git a/services/preview/sql/mgmt/v5.0/sql/distributedavailabilitygroups.go b/services/preview/sql/mgmt/v5.0/sql/distributedavailabilitygroups.go new file mode 100644 index 000000000000..78c05140f4e4 --- /dev/null +++ b/services/preview/sql/mgmt/v5.0/sql/distributedavailabilitygroups.go @@ -0,0 +1,483 @@ +package sql + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DistributedAvailabilityGroupsClient is the the Azure SQL Database management API provides a RESTful set of web +// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, +// retrieve, update, and delete databases. +type DistributedAvailabilityGroupsClient struct { + BaseClient +} + +// NewDistributedAvailabilityGroupsClient creates an instance of the DistributedAvailabilityGroupsClient client. +func NewDistributedAvailabilityGroupsClient(subscriptionID string) DistributedAvailabilityGroupsClient { + return NewDistributedAvailabilityGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDistributedAvailabilityGroupsClientWithBaseURI creates an instance of the DistributedAvailabilityGroupsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewDistributedAvailabilityGroupsClientWithBaseURI(baseURI string, subscriptionID string) DistributedAvailabilityGroupsClient { + return DistributedAvailabilityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a distributed availability group between Sql On-Prem and Sql Managed Instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// distributedAvailabilityGroupName - the distributed availability group name. +// parameters - the distributed availability group info. +func (client DistributedAvailabilityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroup) (result DistributedAvailabilityGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DistributedAvailabilityGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DistributedAvailabilityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "distributedAvailabilityGroupName": autorest.Encode("path", distributedAvailabilityGroupName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DistributedAvailabilityGroupsClient) CreateOrUpdateSender(req *http.Request) (future DistributedAvailabilityGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DistributedAvailabilityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result DistributedAvailabilityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete drops a distributed availability group between Sql On-Prem and Sql Managed Instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// distributedAvailabilityGroupName - the distributed availability group name. +func (client DistributedAvailabilityGroupsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string) (result DistributedAvailabilityGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DistributedAvailabilityGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DistributedAvailabilityGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "distributedAvailabilityGroupName": autorest.Encode("path", distributedAvailabilityGroupName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DistributedAvailabilityGroupsClient) DeleteSender(req *http.Request) (future DistributedAvailabilityGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DistributedAvailabilityGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a distributed availability group info. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// distributedAvailabilityGroupName - the distributed availability group name. +func (client DistributedAvailabilityGroupsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string) (result DistributedAvailabilityGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DistributedAvailabilityGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DistributedAvailabilityGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "distributedAvailabilityGroupName": autorest.Encode("path", distributedAvailabilityGroupName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DistributedAvailabilityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DistributedAvailabilityGroupsClient) GetResponder(resp *http.Response) (result DistributedAvailabilityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInstance gets a list of a distributed availability groups in instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client DistributedAvailabilityGroupsClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result DistributedAvailabilityGroupsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DistributedAvailabilityGroupsClient.ListByInstance") + defer func() { + sc := -1 + if result.daglr.Response.Response != nil { + sc = result.daglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByInstanceNextResults + req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "ListByInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.daglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "ListByInstance", resp, "Failure sending request") + return + } + + result.daglr, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "ListByInstance", resp, "Failure responding to request") + return + } + if result.daglr.hasNextLink() && result.daglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByInstancePreparer prepares the ListByInstance request. +func (client DistributedAvailabilityGroupsClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInstanceSender sends the ListByInstance request. The method will close the +// http.Response Body if it receives an error. +func (client DistributedAvailabilityGroupsClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByInstanceResponder handles the response to the ListByInstance request. The method always +// closes the http.Response Body. +func (client DistributedAvailabilityGroupsClient) ListByInstanceResponder(resp *http.Response) (result DistributedAvailabilityGroupsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByInstanceNextResults retrieves the next set of results, if any. +func (client DistributedAvailabilityGroupsClient) listByInstanceNextResults(ctx context.Context, lastResults DistributedAvailabilityGroupsListResult) (result DistributedAvailabilityGroupsListResult, err error) { + req, err := lastResults.distributedAvailabilityGroupsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "listByInstanceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "listByInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "listByInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client DistributedAvailabilityGroupsClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result DistributedAvailabilityGroupsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DistributedAvailabilityGroupsClient.ListByInstance") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByInstance(ctx, resourceGroupName, managedInstanceName) + return +} + +// Update updates a distributed availability group replication mode. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// distributedAvailabilityGroupName - the distributed availability group name. +// parameters - the distributed availability group info. +func (client DistributedAvailabilityGroupsClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroup) (result DistributedAvailabilityGroupsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DistributedAvailabilityGroupsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DistributedAvailabilityGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "distributedAvailabilityGroupName": autorest.Encode("path", distributedAvailabilityGroupName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DistributedAvailabilityGroupsClient) UpdateSender(req *http.Request) (future DistributedAvailabilityGroupsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DistributedAvailabilityGroupsClient) UpdateResponder(resp *http.Response) (result DistributedAvailabilityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/sql/mgmt/v5.0/sql/elasticpools.go b/services/preview/sql/mgmt/v5.0/sql/elasticpools.go index f69d6d42e21f..7ca8f52c2bb9 100644 --- a/services/preview/sql/mgmt/v5.0/sql/elasticpools.go +++ b/services/preview/sql/mgmt/v5.0/sql/elasticpools.go @@ -82,7 +82,7 @@ func (client ElasticPoolsClient) CreateOrUpdatePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-08-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -167,7 +167,7 @@ func (client ElasticPoolsClient) DeletePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-08-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -248,7 +248,7 @@ func (client ElasticPoolsClient) FailoverPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-08-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -336,7 +336,7 @@ func (client ElasticPoolsClient) GetPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-08-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -373,7 +373,7 @@ func (client ElasticPoolsClient) GetResponder(resp *http.Response) (result Elast // from the Azure Resource Manager API or the portal. // serverName - the name of the server. // skip - the number of elements in the collection to skip. -func (client ElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result ElasticPoolListResultPage, err error) { +func (client ElasticPoolsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, skip *int64) (result ElasticPoolListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListByServer") defer func() { @@ -412,14 +412,14 @@ func (client ElasticPoolsClient) ListByServer(ctx context.Context, resourceGroup } // ListByServerPreparer prepares the ListByServer request. -func (client ElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (*http.Request, error) { +func (client ElasticPoolsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, skip *int64) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-08-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -475,7 +475,7 @@ func (client ElasticPoolsClient) listByServerNextResults(ctx context.Context, la } // ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ElasticPoolsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result ElasticPoolListResultIterator, err error) { +func (client ElasticPoolsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, skip *int64) (result ElasticPoolListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolsClient.ListByServer") defer func() { @@ -692,7 +692,7 @@ func (client ElasticPoolsClient) UpdatePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-08-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/endpointcertificates.go b/services/preview/sql/mgmt/v5.0/sql/endpointcertificates.go new file mode 100644 index 000000000000..8ca9f8c7b43a --- /dev/null +++ b/services/preview/sql/mgmt/v5.0/sql/endpointcertificates.go @@ -0,0 +1,232 @@ +package sql + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EndpointCertificatesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type EndpointCertificatesClient struct { + BaseClient +} + +// NewEndpointCertificatesClient creates an instance of the EndpointCertificatesClient client. +func NewEndpointCertificatesClient(subscriptionID string) EndpointCertificatesClient { + return NewEndpointCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEndpointCertificatesClientWithBaseURI creates an instance of the EndpointCertificatesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewEndpointCertificatesClientWithBaseURI(baseURI string, subscriptionID string) EndpointCertificatesClient { + return EndpointCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a certificate used on the endpoint with the given id. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// endpointType - type of the endpoint whose certificate the customer is looking for. +func (client EndpointCertificatesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, endpointType string) (result EndpointCertificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointCertificatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName, endpointType) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EndpointCertificatesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, endpointType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointType": autorest.Encode("path", endpointType), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointCertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EndpointCertificatesClient) GetResponder(resp *http.Response) (result EndpointCertificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInstance list certificates used on endpoints on the target instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client EndpointCertificatesClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result EndpointCertificateListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointCertificatesClient.ListByInstance") + defer func() { + sc := -1 + if result.eclr.Response.Response != nil { + sc = result.eclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByInstanceNextResults + req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "ListByInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.eclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "ListByInstance", resp, "Failure sending request") + return + } + + result.eclr, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "ListByInstance", resp, "Failure responding to request") + return + } + if result.eclr.hasNextLink() && result.eclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByInstancePreparer prepares the ListByInstance request. +func (client EndpointCertificatesClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInstanceSender sends the ListByInstance request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointCertificatesClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByInstanceResponder handles the response to the ListByInstance request. The method always +// closes the http.Response Body. +func (client EndpointCertificatesClient) ListByInstanceResponder(resp *http.Response) (result EndpointCertificateListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByInstanceNextResults retrieves the next set of results, if any. +func (client EndpointCertificatesClient) listByInstanceNextResults(ctx context.Context, lastResults EndpointCertificateListResult) (result EndpointCertificateListResult, err error) { + req, err := lastResults.endpointCertificateListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "listByInstanceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "listByInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EndpointCertificatesClient", "listByInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client EndpointCertificatesClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result EndpointCertificateListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointCertificatesClient.ListByInstance") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByInstance(ctx, resourceGroupName, managedInstanceName) + return +} diff --git a/services/preview/sql/mgmt/v5.0/sql/enums.go b/services/preview/sql/mgmt/v5.0/sql/enums.go index d9231c128e95..9c5c86e2fdb3 100644 --- a/services/preview/sql/mgmt/v5.0/sql/enums.go +++ b/services/preview/sql/mgmt/v5.0/sql/enums.go @@ -213,6 +213,8 @@ type BackupStorageRedundancy string const ( // BackupStorageRedundancyGeo ... BackupStorageRedundancyGeo BackupStorageRedundancy = "Geo" + // BackupStorageRedundancyGeoZone ... + BackupStorageRedundancyGeoZone BackupStorageRedundancy = "GeoZone" // BackupStorageRedundancyLocal ... BackupStorageRedundancyLocal BackupStorageRedundancy = "Local" // BackupStorageRedundancyZone ... @@ -221,24 +223,7 @@ const ( // PossibleBackupStorageRedundancyValues returns an array of possible values for the BackupStorageRedundancy const type. func PossibleBackupStorageRedundancyValues() []BackupStorageRedundancy { - return []BackupStorageRedundancy{BackupStorageRedundancyGeo, BackupStorageRedundancyLocal, BackupStorageRedundancyZone} -} - -// BackupStorageRedundancy1 enumerates the values for backup storage redundancy 1. -type BackupStorageRedundancy1 string - -const ( - // BackupStorageRedundancy1Geo ... - BackupStorageRedundancy1Geo BackupStorageRedundancy1 = "Geo" - // BackupStorageRedundancy1Local ... - BackupStorageRedundancy1Local BackupStorageRedundancy1 = "Local" - // BackupStorageRedundancy1Zone ... - BackupStorageRedundancy1Zone BackupStorageRedundancy1 = "Zone" -) - -// PossibleBackupStorageRedundancy1Values returns an array of possible values for the BackupStorageRedundancy1 const type. -func PossibleBackupStorageRedundancy1Values() []BackupStorageRedundancy1 { - return []BackupStorageRedundancy1{BackupStorageRedundancy1Geo, BackupStorageRedundancy1Local, BackupStorageRedundancy1Zone} + return []BackupStorageRedundancy{BackupStorageRedundancyGeo, BackupStorageRedundancyGeoZone, BackupStorageRedundancyLocal, BackupStorageRedundancyZone} } // BlobAuditingPolicyState enumerates the values for blob auditing policy state. @@ -455,21 +440,19 @@ func PossibleCreateModeValues() []CreateMode { return []CreateMode{CreateModeCopy, CreateModeDefault, CreateModeOnlineSecondary, CreateModePointInTimeRestore, CreateModeRecovery, CreateModeRestore, CreateModeRestoreExternalBackup, CreateModeRestoreExternalBackupSecondary, CreateModeRestoreLongTermRetentionBackup, CreateModeSecondary} } -// CurrentBackupStorageRedundancy enumerates the values for current backup storage redundancy. -type CurrentBackupStorageRedundancy string +// DatabaseIdentityType enumerates the values for database identity type. +type DatabaseIdentityType string const ( - // CurrentBackupStorageRedundancyGeo ... - CurrentBackupStorageRedundancyGeo CurrentBackupStorageRedundancy = "Geo" - // CurrentBackupStorageRedundancyLocal ... - CurrentBackupStorageRedundancyLocal CurrentBackupStorageRedundancy = "Local" - // CurrentBackupStorageRedundancyZone ... - CurrentBackupStorageRedundancyZone CurrentBackupStorageRedundancy = "Zone" + // DatabaseIdentityTypeNone ... + DatabaseIdentityTypeNone DatabaseIdentityType = "None" + // DatabaseIdentityTypeUserAssigned ... + DatabaseIdentityTypeUserAssigned DatabaseIdentityType = "UserAssigned" ) -// PossibleCurrentBackupStorageRedundancyValues returns an array of possible values for the CurrentBackupStorageRedundancy const type. -func PossibleCurrentBackupStorageRedundancyValues() []CurrentBackupStorageRedundancy { - return []CurrentBackupStorageRedundancy{CurrentBackupStorageRedundancyGeo, CurrentBackupStorageRedundancyLocal, CurrentBackupStorageRedundancyZone} +// PossibleDatabaseIdentityTypeValues returns an array of possible values for the DatabaseIdentityType const type. +func PossibleDatabaseIdentityTypeValues() []DatabaseIdentityType { + return []DatabaseIdentityType{DatabaseIdentityTypeNone, DatabaseIdentityTypeUserAssigned} } // DatabaseLicenseType enumerates the values for database license type. @@ -563,13 +546,19 @@ const ( DatabaseStatusShutdown DatabaseStatus = "Shutdown" // DatabaseStatusStandby ... DatabaseStatusStandby DatabaseStatus = "Standby" + // DatabaseStatusStarting ... + DatabaseStatusStarting DatabaseStatus = "Starting" + // DatabaseStatusStopped ... + DatabaseStatusStopped DatabaseStatus = "Stopped" + // DatabaseStatusStopping ... + DatabaseStatusStopping DatabaseStatus = "Stopping" // DatabaseStatusSuspect ... DatabaseStatusSuspect DatabaseStatus = "Suspect" ) // PossibleDatabaseStatusValues returns an array of possible values for the DatabaseStatus const type. func PossibleDatabaseStatusValues() []DatabaseStatus { - return []DatabaseStatus{DatabaseStatusAutoClosed, DatabaseStatusCopying, DatabaseStatusCreating, DatabaseStatusDisabled, DatabaseStatusEmergencyMode, DatabaseStatusInaccessible, DatabaseStatusOffline, DatabaseStatusOfflineChangingDwPerformanceTiers, DatabaseStatusOfflineSecondary, DatabaseStatusOnline, DatabaseStatusOnlineChangingDwPerformanceTiers, DatabaseStatusPaused, DatabaseStatusPausing, DatabaseStatusRecovering, DatabaseStatusRecoveryPending, DatabaseStatusRestoring, DatabaseStatusResuming, DatabaseStatusScaling, DatabaseStatusShutdown, DatabaseStatusStandby, DatabaseStatusSuspect} + return []DatabaseStatus{DatabaseStatusAutoClosed, DatabaseStatusCopying, DatabaseStatusCreating, DatabaseStatusDisabled, DatabaseStatusEmergencyMode, DatabaseStatusInaccessible, DatabaseStatusOffline, DatabaseStatusOfflineChangingDwPerformanceTiers, DatabaseStatusOfflineSecondary, DatabaseStatusOnline, DatabaseStatusOnlineChangingDwPerformanceTiers, DatabaseStatusPaused, DatabaseStatusPausing, DatabaseStatusRecovering, DatabaseStatusRecoveryPending, DatabaseStatusRestoring, DatabaseStatusResuming, DatabaseStatusScaling, DatabaseStatusShutdown, DatabaseStatusStandby, DatabaseStatusStarting, DatabaseStatusStopped, DatabaseStatusStopping, DatabaseStatusSuspect} } // DataMaskingFunction enumerates the values for data masking function. @@ -720,13 +709,15 @@ const ( IdentityTypeNone IdentityType = "None" // IdentityTypeSystemAssigned ... IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + // IdentityTypeSystemAssignedUserAssigned ... + IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" // IdentityTypeUserAssigned ... IdentityTypeUserAssigned IdentityType = "UserAssigned" ) // PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeUserAssigned} + return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} } // ImplementationMethod enumerates the values for implementation method. @@ -1286,23 +1277,41 @@ func PossibleProvisioningStateValues() []ProvisioningState { type ProvisioningState1 string const ( + // ProvisioningState1Accepted ... + ProvisioningState1Accepted ProvisioningState1 = "Accepted" + // ProvisioningState1Canceled ... + ProvisioningState1Canceled ProvisioningState1 = "Canceled" + // ProvisioningState1Created ... + ProvisioningState1Created ProvisioningState1 = "Created" // ProvisioningState1Creating ... ProvisioningState1Creating ProvisioningState1 = "Creating" + // ProvisioningState1Deleted ... + ProvisioningState1Deleted ProvisioningState1 = "Deleted" // ProvisioningState1Deleting ... ProvisioningState1Deleting ProvisioningState1 = "Deleting" // ProvisioningState1Failed ... ProvisioningState1Failed ProvisioningState1 = "Failed" + // ProvisioningState1NotSpecified ... + ProvisioningState1NotSpecified ProvisioningState1 = "NotSpecified" + // ProvisioningState1Registering ... + ProvisioningState1Registering ProvisioningState1 = "Registering" + // ProvisioningState1Running ... + ProvisioningState1Running ProvisioningState1 = "Running" // ProvisioningState1Succeeded ... ProvisioningState1Succeeded ProvisioningState1 = "Succeeded" + // ProvisioningState1TimedOut ... + ProvisioningState1TimedOut ProvisioningState1 = "TimedOut" // ProvisioningState1Unknown ... ProvisioningState1Unknown ProvisioningState1 = "Unknown" + // ProvisioningState1Unrecognized ... + ProvisioningState1Unrecognized ProvisioningState1 = "Unrecognized" // ProvisioningState1Updating ... ProvisioningState1Updating ProvisioningState1 = "Updating" ) // PossibleProvisioningState1Values returns an array of possible values for the ProvisioningState1 const type. func PossibleProvisioningState1Values() []ProvisioningState1 { - return []ProvisioningState1{ProvisioningState1Creating, ProvisioningState1Deleting, ProvisioningState1Failed, ProvisioningState1Succeeded, ProvisioningState1Unknown, ProvisioningState1Updating} + return []ProvisioningState1{ProvisioningState1Accepted, ProvisioningState1Canceled, ProvisioningState1Created, ProvisioningState1Creating, ProvisioningState1Deleted, ProvisioningState1Deleting, ProvisioningState1Failed, ProvisioningState1NotSpecified, ProvisioningState1Registering, ProvisioningState1Running, ProvisioningState1Succeeded, ProvisioningState1TimedOut, ProvisioningState1Unknown, ProvisioningState1Unrecognized, ProvisioningState1Updating} } // QueryMetricUnitType enumerates the values for query metric unit type. @@ -1453,6 +1462,21 @@ func PossibleReplicationLinkTypeValues() []ReplicationLinkType { return []ReplicationLinkType{ReplicationLinkTypeGEO, ReplicationLinkTypeNAMED} } +// ReplicationMode enumerates the values for replication mode. +type ReplicationMode string + +const ( + // ReplicationModeAsync ... + ReplicationModeAsync ReplicationMode = "Async" + // ReplicationModeSync ... + ReplicationModeSync ReplicationMode = "Sync" +) + +// PossibleReplicationModeValues returns an array of possible values for the ReplicationMode const type. +func PossibleReplicationModeValues() []ReplicationMode { + return []ReplicationMode{ReplicationModeAsync, ReplicationModeSync} +} + // ReplicationRole enumerates the values for replication role. type ReplicationRole string @@ -1508,23 +1532,6 @@ func PossibleReplicaTypeValues() []ReplicaType { return []ReplicaType{ReplicaTypePrimary, ReplicaTypeReadableSecondary} } -// RequestedBackupStorageRedundancy enumerates the values for requested backup storage redundancy. -type RequestedBackupStorageRedundancy string - -const ( - // RequestedBackupStorageRedundancyGeo ... - RequestedBackupStorageRedundancyGeo RequestedBackupStorageRedundancy = "Geo" - // RequestedBackupStorageRedundancyLocal ... - RequestedBackupStorageRedundancyLocal RequestedBackupStorageRedundancy = "Local" - // RequestedBackupStorageRedundancyZone ... - RequestedBackupStorageRedundancyZone RequestedBackupStorageRedundancy = "Zone" -) - -// PossibleRequestedBackupStorageRedundancyValues returns an array of possible values for the RequestedBackupStorageRedundancy const type. -func PossibleRequestedBackupStorageRedundancyValues() []RequestedBackupStorageRedundancy { - return []RequestedBackupStorageRedundancy{RequestedBackupStorageRedundancyGeo, RequestedBackupStorageRedundancyLocal, RequestedBackupStorageRedundancyZone} -} - // RestorePointType enumerates the values for restore point type. type RestorePointType string @@ -1875,6 +1882,21 @@ func PossibleServiceObjectiveNameValues() []ServiceObjectiveName { return []ServiceObjectiveName{ServiceObjectiveNameBasic, ServiceObjectiveNameDS100, ServiceObjectiveNameDS1000, ServiceObjectiveNameDS1200, ServiceObjectiveNameDS1500, ServiceObjectiveNameDS200, ServiceObjectiveNameDS2000, ServiceObjectiveNameDS300, ServiceObjectiveNameDS400, ServiceObjectiveNameDS500, ServiceObjectiveNameDS600, ServiceObjectiveNameDW100, ServiceObjectiveNameDW1000, ServiceObjectiveNameDW10000c, ServiceObjectiveNameDW1000c, ServiceObjectiveNameDW1200, ServiceObjectiveNameDW1500, ServiceObjectiveNameDW15000c, ServiceObjectiveNameDW1500c, ServiceObjectiveNameDW200, ServiceObjectiveNameDW2000, ServiceObjectiveNameDW2000c, ServiceObjectiveNameDW2500c, ServiceObjectiveNameDW300, ServiceObjectiveNameDW3000, ServiceObjectiveNameDW30000c, ServiceObjectiveNameDW3000c, ServiceObjectiveNameDW400, ServiceObjectiveNameDW500, ServiceObjectiveNameDW5000c, ServiceObjectiveNameDW600, ServiceObjectiveNameDW6000, ServiceObjectiveNameDW6000c, ServiceObjectiveNameDW7500c, ServiceObjectiveNameElasticPool, ServiceObjectiveNameFree, ServiceObjectiveNameP1, ServiceObjectiveNameP11, ServiceObjectiveNameP15, ServiceObjectiveNameP2, ServiceObjectiveNameP3, ServiceObjectiveNameP4, ServiceObjectiveNameP6, ServiceObjectiveNamePRS1, ServiceObjectiveNamePRS2, ServiceObjectiveNamePRS4, ServiceObjectiveNamePRS6, ServiceObjectiveNameS0, ServiceObjectiveNameS1, ServiceObjectiveNameS12, ServiceObjectiveNameS2, ServiceObjectiveNameS3, ServiceObjectiveNameS4, ServiceObjectiveNameS6, ServiceObjectiveNameS7, ServiceObjectiveNameS9, ServiceObjectiveNameSystem, ServiceObjectiveNameSystem0, ServiceObjectiveNameSystem1, ServiceObjectiveNameSystem2, ServiceObjectiveNameSystem2L, ServiceObjectiveNameSystem3, ServiceObjectiveNameSystem3L, ServiceObjectiveNameSystem4, ServiceObjectiveNameSystem4L} } +// ServicePrincipalType enumerates the values for service principal type. +type ServicePrincipalType string + +const ( + // ServicePrincipalTypeNone ... + ServicePrincipalTypeNone ServicePrincipalType = "None" + // ServicePrincipalTypeSystemAssigned ... + ServicePrincipalTypeSystemAssigned ServicePrincipalType = "SystemAssigned" +) + +// PossibleServicePrincipalTypeValues returns an array of possible values for the ServicePrincipalType const type. +func PossibleServicePrincipalTypeValues() []ServicePrincipalType { + return []ServicePrincipalType{ServicePrincipalTypeNone, ServicePrincipalTypeSystemAssigned} +} + // State enumerates the values for state. type State string @@ -1945,23 +1967,6 @@ func PossibleStorageAccountTypeValues() []StorageAccountType { return []StorageAccountType{StorageAccountTypeGRS, StorageAccountTypeLRS, StorageAccountTypeZRS} } -// StorageAccountType1 enumerates the values for storage account type 1. -type StorageAccountType1 string - -const ( - // StorageAccountType1GRS ... - StorageAccountType1GRS StorageAccountType1 = "GRS" - // StorageAccountType1LRS ... - StorageAccountType1LRS StorageAccountType1 = "LRS" - // StorageAccountType1ZRS ... - StorageAccountType1ZRS StorageAccountType1 = "ZRS" -) - -// PossibleStorageAccountType1Values returns an array of possible values for the StorageAccountType1 const type. -func PossibleStorageAccountType1Values() []StorageAccountType1 { - return []StorageAccountType1{StorageAccountType1GRS, StorageAccountType1LRS, StorageAccountType1ZRS} -} - // StorageKeyType enumerates the values for storage key type. type StorageKeyType string @@ -2066,6 +2071,25 @@ func PossibleSyncGroupStateValues() []SyncGroupState { return []SyncGroupState{SyncGroupStateError, SyncGroupStateGood, SyncGroupStateNotReady, SyncGroupStateProgressing, SyncGroupStateWarning} } +// SyncGroupsType enumerates the values for sync groups type. +type SyncGroupsType string + +const ( + // SyncGroupsTypeAll ... + SyncGroupsTypeAll SyncGroupsType = "All" + // SyncGroupsTypeError ... + SyncGroupsTypeError SyncGroupsType = "Error" + // SyncGroupsTypeSuccess ... + SyncGroupsTypeSuccess SyncGroupsType = "Success" + // SyncGroupsTypeWarning ... + SyncGroupsTypeWarning SyncGroupsType = "Warning" +) + +// PossibleSyncGroupsTypeValues returns an array of possible values for the SyncGroupsType const type. +func PossibleSyncGroupsTypeValues() []SyncGroupsType { + return []SyncGroupsType{SyncGroupsTypeAll, SyncGroupsTypeError, SyncGroupsTypeSuccess, SyncGroupsTypeWarning} +} + // SyncMemberDbType enumerates the values for sync member db type. type SyncMemberDbType string @@ -2145,39 +2169,6 @@ func PossibleTableTemporalTypeValues() []TableTemporalType { return []TableTemporalType{TableTemporalTypeHistoryTable, TableTemporalTypeNonTemporalTable, TableTemporalTypeSystemVersionedTemporalTable} } -// TargetBackupStorageRedundancy enumerates the values for target backup storage redundancy. -type TargetBackupStorageRedundancy string - -const ( - // TargetBackupStorageRedundancyGeo ... - TargetBackupStorageRedundancyGeo TargetBackupStorageRedundancy = "Geo" - // TargetBackupStorageRedundancyLocal ... - TargetBackupStorageRedundancyLocal TargetBackupStorageRedundancy = "Local" - // TargetBackupStorageRedundancyZone ... - TargetBackupStorageRedundancyZone TargetBackupStorageRedundancy = "Zone" -) - -// PossibleTargetBackupStorageRedundancyValues returns an array of possible values for the TargetBackupStorageRedundancy const type. -func PossibleTargetBackupStorageRedundancyValues() []TargetBackupStorageRedundancy { - return []TargetBackupStorageRedundancy{TargetBackupStorageRedundancyGeo, TargetBackupStorageRedundancyLocal, TargetBackupStorageRedundancyZone} -} - -// TransparentDataEncryptionActivityStatus enumerates the values for transparent data encryption activity -// status. -type TransparentDataEncryptionActivityStatus string - -const ( - // TransparentDataEncryptionActivityStatusDecrypting ... - TransparentDataEncryptionActivityStatusDecrypting TransparentDataEncryptionActivityStatus = "Decrypting" - // TransparentDataEncryptionActivityStatusEncrypting ... - TransparentDataEncryptionActivityStatusEncrypting TransparentDataEncryptionActivityStatus = "Encrypting" -) - -// PossibleTransparentDataEncryptionActivityStatusValues returns an array of possible values for the TransparentDataEncryptionActivityStatus const type. -func PossibleTransparentDataEncryptionActivityStatusValues() []TransparentDataEncryptionActivityStatus { - return []TransparentDataEncryptionActivityStatus{TransparentDataEncryptionActivityStatusDecrypting, TransparentDataEncryptionActivityStatusEncrypting} -} - // TransparentDataEncryptionState enumerates the values for transparent data encryption state. type TransparentDataEncryptionState string @@ -2193,21 +2184,6 @@ func PossibleTransparentDataEncryptionStateValues() []TransparentDataEncryptionS return []TransparentDataEncryptionState{TransparentDataEncryptionStateDisabled, TransparentDataEncryptionStateEnabled} } -// TransparentDataEncryptionStatus enumerates the values for transparent data encryption status. -type TransparentDataEncryptionStatus string - -const ( - // TransparentDataEncryptionStatusDisabled ... - TransparentDataEncryptionStatusDisabled TransparentDataEncryptionStatus = "Disabled" - // TransparentDataEncryptionStatusEnabled ... - TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" -) - -// PossibleTransparentDataEncryptionStatusValues returns an array of possible values for the TransparentDataEncryptionStatus const type. -func PossibleTransparentDataEncryptionStatusValues() []TransparentDataEncryptionStatus { - return []TransparentDataEncryptionStatus{TransparentDataEncryptionStatusDisabled, TransparentDataEncryptionStatusEnabled} -} - // UnitDefinitionType enumerates the values for unit definition type. type UnitDefinitionType string diff --git a/services/preview/sql/mgmt/v5.0/sql/ipv6firewallrules.go b/services/preview/sql/mgmt/v5.0/sql/ipv6firewallrules.go new file mode 100644 index 000000000000..7bb7c5c21f54 --- /dev/null +++ b/services/preview/sql/mgmt/v5.0/sql/ipv6firewallrules.go @@ -0,0 +1,392 @@ +package sql + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IPv6FirewallRulesClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type IPv6FirewallRulesClient struct { + BaseClient +} + +// NewIPv6FirewallRulesClient creates an instance of the IPv6FirewallRulesClient client. +func NewIPv6FirewallRulesClient(subscriptionID string) IPv6FirewallRulesClient { + return NewIPv6FirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIPv6FirewallRulesClientWithBaseURI creates an instance of the IPv6FirewallRulesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewIPv6FirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) IPv6FirewallRulesClient { + return IPv6FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an IPv6 firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the firewall rule. +// parameters - the required parameters for creating or updating an IPv6 firewall rule. +func (client IPv6FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters IPv6FirewallRule) (result IPv6FirewallRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPv6FirewallRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, firewallRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IPv6FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters IPv6FirewallRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IPv6FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IPv6FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result IPv6FirewallRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an IPv6 firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the firewall rule. +func (client IPv6FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPv6FirewallRulesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IPv6FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IPv6FirewallRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IPv6FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an IPv6 firewall rule. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// firewallRuleName - the name of the firewall rule. +func (client IPv6FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result IPv6FirewallRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPv6FirewallRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serverName, firewallRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IPv6FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IPv6FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IPv6FirewallRulesClient) GetResponder(resp *http.Response) (result IPv6FirewallRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer gets a list of IPv6 firewall rules. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client IPv6FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result IPv6FirewallRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPv6FirewallRulesClient.ListByServer") + defer func() { + sc := -1 + if result.ip6frlr.Response.Response != nil { + sc = result.ip6frlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByServerNextResults + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.ip6frlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "ListByServer", resp, "Failure sending request") + return + } + + result.ip6frlr, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "ListByServer", resp, "Failure responding to request") + return + } + if result.ip6frlr.hasNextLink() && result.ip6frlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client IPv6FirewallRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client IPv6FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client IPv6FirewallRulesClient) ListByServerResponder(resp *http.Response) (result IPv6FirewallRuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByServerNextResults retrieves the next set of results, if any. +func (client IPv6FirewallRulesClient) listByServerNextResults(ctx context.Context, lastResults IPv6FirewallRuleListResult) (result IPv6FirewallRuleListResult, err error) { + req, err := lastResults.iPv6FirewallRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "listByServerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.IPv6FirewallRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. +func (client IPv6FirewallRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result IPv6FirewallRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPv6FirewallRulesClient.ListByServer") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) + return +} diff --git a/services/preview/sql/mgmt/v5.0/sql/ledgerdigestuploads.go b/services/preview/sql/mgmt/v5.0/sql/ledgerdigestuploads.go index c5103a6ca454..c758e79ad4b4 100644 --- a/services/preview/sql/mgmt/v5.0/sql/ledgerdigestuploads.go +++ b/services/preview/sql/mgmt/v5.0/sql/ledgerdigestuploads.go @@ -39,13 +39,13 @@ func NewLedgerDigestUploadsClientWithBaseURI(baseURI string, subscriptionID stri // from the Azure Resource Manager API or the portal. // serverName - the name of the server. // databaseName - the name of the database. -func (client LedgerDigestUploadsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters LedgerDigestUploads) (result LedgerDigestUploads, err error) { +func (client LedgerDigestUploadsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters LedgerDigestUploads) (result LedgerDigestUploadsCreateOrUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LedgerDigestUploadsClient.CreateOrUpdate") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -56,16 +56,9 @@ func (client LedgerDigestUploadsClient) CreateOrUpdate(ctx context.Context, reso return } - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) + result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -99,8 +92,18 @@ func (client LedgerDigestUploadsClient) CreateOrUpdatePreparer(ctx context.Conte // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client LedgerDigestUploadsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +func (client LedgerDigestUploadsClient) CreateOrUpdateSender(req *http.Request) (future LedgerDigestUploadsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always @@ -121,13 +124,13 @@ func (client LedgerDigestUploadsClient) CreateOrUpdateResponder(resp *http.Respo // from the Azure Resource Manager API or the portal. // serverName - the name of the server. // databaseName - the name of the database. -func (client LedgerDigestUploadsClient) Disable(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result LedgerDigestUploads, err error) { +func (client LedgerDigestUploadsClient) Disable(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result LedgerDigestUploadsDisableFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/LedgerDigestUploadsClient.Disable") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -138,16 +141,9 @@ func (client LedgerDigestUploadsClient) Disable(ctx context.Context, resourceGro return } - resp, err := client.DisableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsClient", "Disable", resp, "Failure sending request") - return - } - - result, err = client.DisableResponder(resp) + result, err = client.DisableSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsClient", "Disable", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsClient", "Disable", result.Response(), "Failure sending request") return } @@ -179,8 +175,18 @@ func (client LedgerDigestUploadsClient) DisablePreparer(ctx context.Context, res // DisableSender sends the Disable request. The method will close the // http.Response Body if it receives an error. -func (client LedgerDigestUploadsClient) DisableSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +func (client LedgerDigestUploadsClient) DisableSender(req *http.Request) (future LedgerDigestUploadsDisableFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return } // DisableResponder handles the response to the Disable request. The method always diff --git a/services/preview/sql/mgmt/v5.0/sql/longtermretentionbackups.go b/services/preview/sql/mgmt/v5.0/sql/longtermretentionbackups.go index 99ca55b9bef1..34221dfe6b02 100644 --- a/services/preview/sql/mgmt/v5.0/sql/longtermretentionbackups.go +++ b/services/preview/sql/mgmt/v5.0/sql/longtermretentionbackups.go @@ -76,7 +76,7 @@ func (client LongTermRetentionBackupsClient) CopyPreparer(ctx context.Context, l "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -165,7 +165,7 @@ func (client LongTermRetentionBackupsClient) CopyByResourceGroupPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -250,7 +250,7 @@ func (client LongTermRetentionBackupsClient) DeletePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -335,7 +335,7 @@ func (client LongTermRetentionBackupsClient) DeleteByResourceGroupPreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -424,7 +424,7 @@ func (client LongTermRetentionBackupsClient) GetPreparer(ctx context.Context, lo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -507,7 +507,7 @@ func (client LongTermRetentionBackupsClient) GetByResourceGroupPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -592,7 +592,7 @@ func (client LongTermRetentionBackupsClient) ListByDatabasePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -716,7 +716,7 @@ func (client LongTermRetentionBackupsClient) ListByLocationPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -847,7 +847,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupDatabasePreparer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -974,7 +974,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupLocationPreparer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1103,7 +1103,7 @@ func (client LongTermRetentionBackupsClient) ListByResourceGroupServerPreparer(c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1229,7 +1229,7 @@ func (client LongTermRetentionBackupsClient) ListByServerPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1346,7 +1346,7 @@ func (client LongTermRetentionBackupsClient) UpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1435,7 +1435,7 @@ func (client LongTermRetentionBackupsClient) UpdateByResourceGroupPreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/longtermretentionmanagedinstancebackups.go b/services/preview/sql/mgmt/v5.0/sql/longtermretentionmanagedinstancebackups.go index f9cde4f9388e..a3bbf78627ef 100644 --- a/services/preview/sql/mgmt/v5.0/sql/longtermretentionmanagedinstancebackups.go +++ b/services/preview/sql/mgmt/v5.0/sql/longtermretentionmanagedinstancebackups.go @@ -76,7 +76,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) DeletePreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -161,7 +161,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) DeleteByResourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -250,7 +250,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) GetPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -333,7 +333,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) GetByResourceGroupPr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -418,7 +418,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByDatabasePrepar "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -544,7 +544,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByInstancePrepar "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -668,7 +668,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByLocationPrepar "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -799,7 +799,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupD "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -928,7 +928,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupI "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1055,7 +1055,7 @@ func (client LongTermRetentionManagedInstanceBackupsClient) ListByResourceGroupL "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/manageddatabaserecommendedsensitivitylabels.go b/services/preview/sql/mgmt/v5.0/sql/manageddatabaserecommendedsensitivitylabels.go index a235d74b0697..8ceb4bd24310 100644 --- a/services/preview/sql/mgmt/v5.0/sql/manageddatabaserecommendedsensitivitylabels.go +++ b/services/preview/sql/mgmt/v5.0/sql/manageddatabaserecommendedsensitivitylabels.go @@ -82,7 +82,7 @@ func (client ManagedDatabaseRecommendedSensitivityLabelsClient) UpdatePreparer(c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/manageddatabasesecurityalertpolicies.go b/services/preview/sql/mgmt/v5.0/sql/manageddatabasesecurityalertpolicies.go index dfd1380ebc88..b52b859cd667 100644 --- a/services/preview/sql/mgmt/v5.0/sql/manageddatabasesecurityalertpolicies.go +++ b/services/preview/sql/mgmt/v5.0/sql/manageddatabasesecurityalertpolicies.go @@ -80,7 +80,7 @@ func (client ManagedDatabaseSecurityAlertPoliciesClient) CreateOrUpdatePreparer( "databaseName": autorest.Encode("path", databaseName), "managedInstanceName": autorest.Encode("path", managedInstanceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), + "securityAlertPolicyName": autorest.Encode("path", "Default"), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -162,7 +162,7 @@ func (client ManagedDatabaseSecurityAlertPoliciesClient) GetPreparer(ctx context "databaseName": autorest.Encode("path", databaseName), "managedInstanceName": autorest.Encode("path", managedInstanceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "default"), + "securityAlertPolicyName": autorest.Encode("path", "Default"), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } diff --git a/services/preview/sql/mgmt/v5.0/sql/manageddatabasesensitivitylabels.go b/services/preview/sql/mgmt/v5.0/sql/manageddatabasesensitivitylabels.go index f74ae569ae7f..8d511b709c45 100644 --- a/services/preview/sql/mgmt/v5.0/sql/manageddatabasesensitivitylabels.go +++ b/services/preview/sql/mgmt/v5.0/sql/manageddatabasesensitivitylabels.go @@ -89,7 +89,7 @@ func (client ManagedDatabaseSensitivityLabelsClient) CreateOrUpdatePreparer(ctx "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -178,7 +178,7 @@ func (client ManagedDatabaseSensitivityLabelsClient) DeletePreparer(ctx context. "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -263,7 +263,7 @@ func (client ManagedDatabaseSensitivityLabelsClient) DisableRecommendationPrepar "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -349,7 +349,7 @@ func (client ManagedDatabaseSensitivityLabelsClient) EnableRecommendationPrepare "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -435,7 +435,7 @@ func (client ManagedDatabaseSensitivityLabelsClient) GetPreparer(ctx context.Con "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -466,6 +466,131 @@ func (client ManagedDatabaseSensitivityLabelsClient) GetResponder(resp *http.Res return } +// ListByDatabase gets the sensitivity labels of a given database +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// databaseName - the name of the database. +// filter - an OData filter expression that filters elements in the collection. +func (client ManagedDatabaseSensitivityLabelsClient) ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (result SensitivityLabelListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.ListByDatabase") + defer func() { + sc := -1 + if result.sllr.Response.Response != nil { + sc = result.sllr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDatabaseNextResults + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, managedInstanceName, databaseName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.sllr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result.sllr, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "ListByDatabase", resp, "Failure responding to request") + return + } + if result.sllr.hasNextLink() && result.sllr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client ManagedDatabaseSensitivityLabelsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/sensitivityLabels", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedDatabaseSensitivityLabelsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client ManagedDatabaseSensitivityLabelsClient) ListByDatabaseResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDatabaseNextResults retrieves the next set of results, if any. +func (client ManagedDatabaseSensitivityLabelsClient) listByDatabaseNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { + req, err := lastResults.sensitivityLabelListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseSensitivityLabelsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedDatabaseSensitivityLabelsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (result SensitivityLabelListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSensitivityLabelsClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDatabase(ctx, resourceGroupName, managedInstanceName, databaseName, filter) + return +} + // ListCurrentByDatabase gets the sensitivity labels of a given database // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value @@ -520,7 +645,7 @@ func (client ManagedDatabaseSensitivityLabelsClient) ListCurrentByDatabasePrepar "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -652,7 +777,7 @@ func (client ManagedDatabaseSensitivityLabelsClient) ListRecommendedByDatabasePr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -777,7 +902,7 @@ func (client ManagedDatabaseSensitivityLabelsClient) UpdatePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/managedinstancedtcs.go b/services/preview/sql/mgmt/v5.0/sql/managedinstancedtcs.go new file mode 100644 index 000000000000..3f405ad0ab60 --- /dev/null +++ b/services/preview/sql/mgmt/v5.0/sql/managedinstancedtcs.go @@ -0,0 +1,315 @@ +package sql + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedInstanceDtcsClient is the the Azure SQL Database management API provides a RESTful set of web services that +// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type ManagedInstanceDtcsClient struct { + BaseClient +} + +// NewManagedInstanceDtcsClient creates an instance of the ManagedInstanceDtcsClient client. +func NewManagedInstanceDtcsClient(subscriptionID string) ManagedInstanceDtcsClient { + return NewManagedInstanceDtcsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedInstanceDtcsClientWithBaseURI creates an instance of the ManagedInstanceDtcsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewManagedInstanceDtcsClientWithBaseURI(baseURI string, subscriptionID string) ManagedInstanceDtcsClient { + return ManagedInstanceDtcsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate updates the managed instance DTC settings. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// parameters - managed instance DTC settings. +func (client ManagedInstanceDtcsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceDtc) (result ManagedInstanceDtcsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceDtcsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedInstanceDtcsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceDtc) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dtcName": autorest.Encode("path", "current"), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstanceDtcsClient) CreateOrUpdateSender(req *http.Request) (future ManagedInstanceDtcsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedInstanceDtcsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedInstanceDtc, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the managed instance DTC settings. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedInstanceDtcsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceDtc, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceDtcsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedInstanceDtcsClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dtcName": autorest.Encode("path", "current"), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstanceDtcsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedInstanceDtcsClient) GetResponder(resp *http.Response) (result ManagedInstanceDtc, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManagedInstance gets a list of the managed instance DTC settings. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedInstanceDtcsClient) ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceDtcListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceDtcsClient.ListByManagedInstance") + defer func() { + sc := -1 + if result.midlr.Response.Response != nil { + sc = result.midlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByManagedInstanceNextResults + req, err := client.ListByManagedInstancePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "ListByManagedInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagedInstanceSender(req) + if err != nil { + result.midlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "ListByManagedInstance", resp, "Failure sending request") + return + } + + result.midlr, err = client.ListByManagedInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "ListByManagedInstance", resp, "Failure responding to request") + return + } + if result.midlr.hasNextLink() && result.midlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByManagedInstancePreparer prepares the ListByManagedInstance request. +func (client ManagedInstanceDtcsClient) ListByManagedInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByManagedInstanceSender sends the ListByManagedInstance request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedInstanceDtcsClient) ListByManagedInstanceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByManagedInstanceResponder handles the response to the ListByManagedInstance request. The method always +// closes the http.Response Body. +func (client ManagedInstanceDtcsClient) ListByManagedInstanceResponder(resp *http.Response) (result ManagedInstanceDtcListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByManagedInstanceNextResults retrieves the next set of results, if any. +func (client ManagedInstanceDtcsClient) listByManagedInstanceNextResults(ctx context.Context, lastResults ManagedInstanceDtcListResult) (result ManagedInstanceDtcListResult, err error) { + req, err := lastResults.managedInstanceDtcListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "listByManagedInstanceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByManagedInstanceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "listByManagedInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByManagedInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsClient", "listByManagedInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByManagedInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedInstanceDtcsClient) ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedInstanceDtcListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceDtcsClient.ListByManagedInstance") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByManagedInstance(ctx, resourceGroupName, managedInstanceName) + return +} diff --git a/services/preview/sql/mgmt/v5.0/sql/managedinstances.go b/services/preview/sql/mgmt/v5.0/sql/managedinstances.go index 6cd74238340c..a8d719b66602 100644 --- a/services/preview/sql/mgmt/v5.0/sql/managedinstances.go +++ b/services/preview/sql/mgmt/v5.0/sql/managedinstances.go @@ -81,7 +81,7 @@ func (client ManagedInstancesClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -163,7 +163,7 @@ func (client ManagedInstancesClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -243,7 +243,7 @@ func (client ManagedInstancesClient) FailoverPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -333,7 +333,7 @@ func (client ManagedInstancesClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -414,7 +414,7 @@ func (client ManagedInstancesClient) ListPreparer(ctx context.Context, expand st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -537,7 +537,7 @@ func (client ManagedInstancesClient) ListByInstancePoolPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -667,7 +667,7 @@ func (client ManagedInstancesClient) ListByManagedInstancePreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -806,7 +806,7 @@ func (client ManagedInstancesClient) ListByResourceGroupPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -917,7 +917,7 @@ func (client ManagedInstancesClient) UpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/managedserverdnsaliases.go b/services/preview/sql/mgmt/v5.0/sql/managedserverdnsaliases.go new file mode 100644 index 000000000000..0586ca33398b --- /dev/null +++ b/services/preview/sql/mgmt/v5.0/sql/managedserverdnsaliases.go @@ -0,0 +1,484 @@ +package sql + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedServerDNSAliasesClient is the the Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type ManagedServerDNSAliasesClient struct { + BaseClient +} + +// NewManagedServerDNSAliasesClient creates an instance of the ManagedServerDNSAliasesClient client. +func NewManagedServerDNSAliasesClient(subscriptionID string) ManagedServerDNSAliasesClient { + return NewManagedServerDNSAliasesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedServerDNSAliasesClientWithBaseURI creates an instance of the ManagedServerDNSAliasesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewManagedServerDNSAliasesClientWithBaseURI(baseURI string, subscriptionID string) ManagedServerDNSAliasesClient { + return ManagedServerDNSAliasesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Acquire acquires managed server DNS alias from another managed server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedServerDNSAliasesClient) Acquire(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string, parameters ManagedServerDNSAliasAcquisition) (result ManagedServerDNSAliasesAcquireFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerDNSAliasesClient.Acquire") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.OldManagedServerDNSAliasResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("sql.ManagedServerDNSAliasesClient", "Acquire", err.Error()) + } + + req, err := client.AcquirePreparer(ctx, resourceGroupName, managedInstanceName, DNSAliasName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "Acquire", nil, "Failure preparing request") + return + } + + result, err = client.AcquireSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "Acquire", result.Response(), "Failure sending request") + return + } + + return +} + +// AcquirePreparer prepares the Acquire request. +func (client ManagedServerDNSAliasesClient) AcquirePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string, parameters ManagedServerDNSAliasAcquisition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dnsAliasName": autorest.Encode("path", DNSAliasName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}/acquire", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AcquireSender sends the Acquire request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedServerDNSAliasesClient) AcquireSender(req *http.Request) (future ManagedServerDNSAliasesAcquireFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// AcquireResponder handles the response to the Acquire request. The method always +// closes the http.Response Body. +func (client ManagedServerDNSAliasesClient) AcquireResponder(resp *http.Response) (result ManagedServerDNSAlias, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates a managed server DNS alias. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedServerDNSAliasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string, parameters ManagedServerDNSAliasCreation) (result ManagedServerDNSAliasesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerDNSAliasesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, DNSAliasName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedServerDNSAliasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string, parameters ManagedServerDNSAliasCreation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dnsAliasName": autorest.Encode("path", DNSAliasName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedServerDNSAliasesClient) CreateOrUpdateSender(req *http.Request) (future ManagedServerDNSAliasesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedServerDNSAliasesClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedServerDNSAlias, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the managed server DNS alias with the given name. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedServerDNSAliasesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string) (result ManagedServerDNSAliasesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerDNSAliasesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, DNSAliasName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedServerDNSAliasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dnsAliasName": autorest.Encode("path", DNSAliasName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedServerDNSAliasesClient) DeleteSender(req *http.Request) (future ManagedServerDNSAliasesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedServerDNSAliasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a server DNS alias. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedServerDNSAliasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string) (result ManagedServerDNSAlias, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerDNSAliasesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName, DNSAliasName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedServerDNSAliasesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dnsAliasName": autorest.Encode("path", DNSAliasName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedServerDNSAliasesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedServerDNSAliasesClient) GetResponder(resp *http.Response) (result ManagedServerDNSAlias, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManagedInstance gets a list of managed server DNS aliases for a managed server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ManagedServerDNSAliasesClient) ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedServerDNSAliasListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerDNSAliasesClient.ListByManagedInstance") + defer func() { + sc := -1 + if result.msdalr.Response.Response != nil { + sc = result.msdalr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByManagedInstanceNextResults + req, err := client.ListByManagedInstancePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "ListByManagedInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagedInstanceSender(req) + if err != nil { + result.msdalr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "ListByManagedInstance", resp, "Failure sending request") + return + } + + result.msdalr, err = client.ListByManagedInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "ListByManagedInstance", resp, "Failure responding to request") + return + } + if result.msdalr.hasNextLink() && result.msdalr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByManagedInstancePreparer prepares the ListByManagedInstance request. +func (client ManagedServerDNSAliasesClient) ListByManagedInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByManagedInstanceSender sends the ListByManagedInstance request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedServerDNSAliasesClient) ListByManagedInstanceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByManagedInstanceResponder handles the response to the ListByManagedInstance request. The method always +// closes the http.Response Body. +func (client ManagedServerDNSAliasesClient) ListByManagedInstanceResponder(resp *http.Response) (result ManagedServerDNSAliasListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByManagedInstanceNextResults retrieves the next set of results, if any. +func (client ManagedServerDNSAliasesClient) listByManagedInstanceNextResults(ctx context.Context, lastResults ManagedServerDNSAliasListResult) (result ManagedServerDNSAliasListResult, err error) { + req, err := lastResults.managedServerDNSAliasListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "listByManagedInstanceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByManagedInstanceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "listByManagedInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByManagedInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesClient", "listByManagedInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByManagedInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedServerDNSAliasesClient) ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ManagedServerDNSAliasListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerDNSAliasesClient.ListByManagedInstance") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByManagedInstance(ctx, resourceGroupName, managedInstanceName) + return +} diff --git a/services/preview/sql/mgmt/v5.0/sql/models.go b/services/preview/sql/mgmt/v5.0/sql/models.go index 32af3e49022d..f4640288e730 100644 --- a/services/preview/sql/mgmt/v5.0/sql/models.go +++ b/services/preview/sql/mgmt/v5.0/sql/models.go @@ -1106,8 +1106,8 @@ type CopyLongTermRetentionBackupParametersProperties struct { TargetServerFullyQualifiedDomainName *string `json:"targetServerFullyQualifiedDomainName,omitempty"` // TargetDatabaseName - The name of the database owns the copied backup. TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` - // TargetBackupStorageRedundancy - The storage redundancy type of the copied backup. Possible values include: 'TargetBackupStorageRedundancyGeo', 'TargetBackupStorageRedundancyLocal', 'TargetBackupStorageRedundancyZone' - TargetBackupStorageRedundancy TargetBackupStorageRedundancy `json:"targetBackupStorageRedundancy,omitempty"` + // TargetBackupStorageRedundancy - The storage redundancy type of the copied backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + TargetBackupStorageRedundancy BackupStorageRedundancy `json:"targetBackupStorageRedundancy,omitempty"` } // CreateDatabaseRestorePointDefinition contains the information necessary to perform a create database @@ -1136,6 +1136,8 @@ type Database struct { Kind *string `json:"kind,omitempty"` // ManagedBy - READ-ONLY; Resource that manages the database. ManagedBy *string `json:"managedBy,omitempty"` + // Identity - The Azure Active Directory identity of the database. + Identity *DatabaseIdentity `json:"identity,omitempty"` // DatabaseProperties - Resource properties. *DatabaseProperties `json:"properties,omitempty"` // Location - Resource location. @@ -1156,6 +1158,9 @@ func (d Database) MarshalJSON() ([]byte, error) { if d.Sku != nil { objectMap["sku"] = d.Sku } + if d.Identity != nil { + objectMap["identity"] = d.Identity + } if d.DatabaseProperties != nil { objectMap["properties"] = d.DatabaseProperties } @@ -1204,6 +1209,15 @@ func (d *Database) UnmarshalJSON(body []byte) error { } d.ManagedBy = &managedBy } + case "identity": + if v != nil { + var identity DatabaseIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + d.Identity = &identity + } case "properties": if v != nil { var databaseProperties DatabaseProperties @@ -2080,6 +2094,28 @@ type DatabaseExtensionsProperties struct { StorageURI *string `json:"storageUri,omitempty"` } +// DatabaseIdentity azure Active Directory identity configuration for a resource. +type DatabaseIdentity struct { + // Type - The identity type. Possible values include: 'DatabaseIdentityTypeNone', 'DatabaseIdentityTypeUserAssigned' + Type DatabaseIdentityType `json:"type,omitempty"` + // TenantID - READ-ONLY; The Azure Active Directory tenant id. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // UserAssignedIdentities - The resource ids of the user assigned identities to use + UserAssignedIdentities map[string]*DatabaseUserIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for DatabaseIdentity. +func (di DatabaseIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if di.Type != "" { + objectMap["type"] = di.Type + } + if di.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = di.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + // DatabaseListResult a list of databases. type DatabaseListResult struct { autorest.Response `json:"-"` @@ -2550,7 +2586,7 @@ type DatabaseProperties struct { ElasticPoolID *string `json:"elasticPoolId,omitempty"` // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // Status - READ-ONLY; The status of the database. Possible values include: 'DatabaseStatusOnline', 'DatabaseStatusRestoring', 'DatabaseStatusRecoveryPending', 'DatabaseStatusRecovering', 'DatabaseStatusSuspect', 'DatabaseStatusOffline', 'DatabaseStatusStandby', 'DatabaseStatusShutdown', 'DatabaseStatusEmergencyMode', 'DatabaseStatusAutoClosed', 'DatabaseStatusCopying', 'DatabaseStatusCreating', 'DatabaseStatusInaccessible', 'DatabaseStatusOfflineSecondary', 'DatabaseStatusPausing', 'DatabaseStatusPaused', 'DatabaseStatusResuming', 'DatabaseStatusScaling', 'DatabaseStatusOfflineChangingDwPerformanceTiers', 'DatabaseStatusOnlineChangingDwPerformanceTiers', 'DatabaseStatusDisabled' + // Status - READ-ONLY; The status of the database. Possible values include: 'DatabaseStatusOnline', 'DatabaseStatusRestoring', 'DatabaseStatusRecoveryPending', 'DatabaseStatusRecovering', 'DatabaseStatusSuspect', 'DatabaseStatusOffline', 'DatabaseStatusStandby', 'DatabaseStatusShutdown', 'DatabaseStatusEmergencyMode', 'DatabaseStatusAutoClosed', 'DatabaseStatusCopying', 'DatabaseStatusCreating', 'DatabaseStatusInaccessible', 'DatabaseStatusOfflineSecondary', 'DatabaseStatusPausing', 'DatabaseStatusPaused', 'DatabaseStatusResuming', 'DatabaseStatusScaling', 'DatabaseStatusOfflineChangingDwPerformanceTiers', 'DatabaseStatusOnlineChangingDwPerformanceTiers', 'DatabaseStatusDisabled', 'DatabaseStatusStopping', 'DatabaseStatusStopped', 'DatabaseStatusStarting' Status DatabaseStatus `json:"status,omitempty"` // DatabaseID - READ-ONLY; The ID of the database. DatabaseID *uuid.UUID `json:"databaseId,omitempty"` @@ -2586,9 +2622,9 @@ type DatabaseProperties struct { MaxLogSizeBytes *int64 `json:"maxLogSizeBytes,omitempty"` // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // ReadScale - The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'DatabaseReadScaleEnabled', 'DatabaseReadScaleDisabled' + // ReadScale - The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. Possible values include: 'DatabaseReadScaleEnabled', 'DatabaseReadScaleDisabled' ReadScale DatabaseReadScale `json:"readScale,omitempty"` - // HighAvailabilityReplicaCount - The number of secondary replicas associated with the database that are used to provide high availability. + // HighAvailabilityReplicaCount - The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` // SecondaryType - The secondary type of the database if it is a secondary. Valid values are Geo and Named. Possible values include: 'SecondaryTypeGeo', 'SecondaryTypeNamed' SecondaryType SecondaryType `json:"secondaryType,omitempty"` @@ -2596,10 +2632,10 @@ type DatabaseProperties struct { CurrentSku *Sku `json:"currentSku,omitempty"` // AutoPauseDelay - Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` - // CurrentBackupStorageRedundancy - READ-ONLY; The storage account type used to store backups for this database. Possible values include: 'CurrentBackupStorageRedundancyGeo', 'CurrentBackupStorageRedundancyLocal', 'CurrentBackupStorageRedundancyZone' - CurrentBackupStorageRedundancy CurrentBackupStorageRedundancy `json:"currentBackupStorageRedundancy,omitempty"` - // RequestedBackupStorageRedundancy - The storage account type to be used to store backups for this database. Possible values include: 'RequestedBackupStorageRedundancyGeo', 'RequestedBackupStorageRedundancyLocal', 'RequestedBackupStorageRedundancyZone' - RequestedBackupStorageRedundancy RequestedBackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` + // CurrentBackupStorageRedundancy - READ-ONLY; The storage account type used to store backups for this database. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + CurrentBackupStorageRedundancy BackupStorageRedundancy `json:"currentBackupStorageRedundancy,omitempty"` + // RequestedBackupStorageRedundancy - The storage account type to be used to store backups for this database. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + RequestedBackupStorageRedundancy BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` // MinCapacity - Minimal capacity that database will always have allocated, if not paused MinCapacity *float64 `json:"minCapacity,omitempty"` // PausedDate - READ-ONLY; The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. @@ -2612,6 +2648,22 @@ type DatabaseProperties struct { IsLedgerOn *bool `json:"isLedgerOn,omitempty"` // IsInfraEncryptionEnabled - READ-ONLY; Infra encryption is enabled for this database. IsInfraEncryptionEnabled *bool `json:"isInfraEncryptionEnabled,omitempty"` + // FederatedClientID - The Client id used for cross tenant per database CMK scenario + FederatedClientID *uuid.UUID `json:"federatedClientId,omitempty"` + // SourceResourceID - The resource identifier of the source associated with the create operation of this database. + // + // When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + // + // When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or existing sql pool, and restorePointInTime must be specified. + // + // When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. + // + // When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. + // + // This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + // + // When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + SourceResourceID *string `json:"sourceResourceId,omitempty"` } // MarshalJSON is the custom marshaler for DatabaseProperties. @@ -2686,6 +2738,12 @@ func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { if dp.IsLedgerOn != nil { objectMap["isLedgerOn"] = dp.IsLedgerOn } + if dp.FederatedClientID != nil { + objectMap["federatedClientId"] = dp.FederatedClientID + } + if dp.SourceResourceID != nil { + objectMap["sourceResourceId"] = dp.SourceResourceID + } return json.Marshal(objectMap) } @@ -3736,12 +3794,14 @@ type DatabaseTableProperties struct { MemoryOptimized *bool `json:"memoryOptimized,omitempty"` } -// DatabaseUpdate a database resource. +// DatabaseUpdate a database update resource. type DatabaseUpdate struct { // Sku - The name and tier of the SKU. Sku *Sku `json:"sku,omitempty"` - // DatabaseProperties - Resource properties. - *DatabaseProperties `json:"properties,omitempty"` + // Identity - Database identity + Identity *DatabaseIdentity `json:"identity,omitempty"` + // DatabaseUpdateProperties - Resource properties. + *DatabaseUpdateProperties `json:"properties,omitempty"` // Tags - Resource tags. Tags map[string]*string `json:"tags"` } @@ -3752,8 +3812,11 @@ func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { if du.Sku != nil { objectMap["sku"] = du.Sku } - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties + if du.Identity != nil { + objectMap["identity"] = du.Identity + } + if du.DatabaseUpdateProperties != nil { + objectMap["properties"] = du.DatabaseUpdateProperties } if du.Tags != nil { objectMap["tags"] = du.Tags @@ -3779,14 +3842,23 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { } du.Sku = &sku } + case "identity": + if v != nil { + var identity DatabaseIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + du.Identity = &identity + } case "properties": if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) + var databaseUpdateProperties DatabaseUpdateProperties + err = json.Unmarshal(*v, &databaseUpdateProperties) if err != nil { return err } - du.DatabaseProperties = &databaseProperties + du.DatabaseUpdateProperties = &databaseUpdateProperties } case "tags": if v != nil { @@ -3803,6 +3875,180 @@ func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { return nil } +// DatabaseUpdateProperties a database update properties. +type DatabaseUpdateProperties struct { + // CreateMode - Specifies the mode of database creation. + // + // Default: regular database creation. + // + // Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + // + // Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + // + // PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + // + // Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + // + // Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + // + // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + // + // Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'CreateModeDefault', 'CreateModeCopy', 'CreateModeSecondary', 'CreateModePointInTimeRestore', 'CreateModeRestore', 'CreateModeRecovery', 'CreateModeRestoreExternalBackup', 'CreateModeRestoreExternalBackupSecondary', 'CreateModeRestoreLongTermRetentionBackup', 'CreateModeOnlineSecondary' + CreateMode CreateMode `json:"createMode,omitempty"` + // Collation - The collation of the database. + Collation *string `json:"collation,omitempty"` + // MaxSizeBytes - The max size of the database expressed in bytes. + MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` + // SampleName - The name of the sample schema to apply when creating this database. Possible values include: 'SampleNameAdventureWorksLT', 'SampleNameWideWorldImportersStd', 'SampleNameWideWorldImportersFull' + SampleName SampleName `json:"sampleName,omitempty"` + // ElasticPoolID - The resource identifier of the elastic pool containing this database. + ElasticPoolID *string `json:"elasticPoolId,omitempty"` + // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. + SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + // Status - READ-ONLY; The status of the database. Possible values include: 'DatabaseStatusOnline', 'DatabaseStatusRestoring', 'DatabaseStatusRecoveryPending', 'DatabaseStatusRecovering', 'DatabaseStatusSuspect', 'DatabaseStatusOffline', 'DatabaseStatusStandby', 'DatabaseStatusShutdown', 'DatabaseStatusEmergencyMode', 'DatabaseStatusAutoClosed', 'DatabaseStatusCopying', 'DatabaseStatusCreating', 'DatabaseStatusInaccessible', 'DatabaseStatusOfflineSecondary', 'DatabaseStatusPausing', 'DatabaseStatusPaused', 'DatabaseStatusResuming', 'DatabaseStatusScaling', 'DatabaseStatusOfflineChangingDwPerformanceTiers', 'DatabaseStatusOnlineChangingDwPerformanceTiers', 'DatabaseStatusDisabled', 'DatabaseStatusStopping', 'DatabaseStatusStopped', 'DatabaseStatusStarting' + Status DatabaseStatus `json:"status,omitempty"` + // DatabaseID - READ-ONLY; The ID of the database. + DatabaseID *uuid.UUID `json:"databaseId,omitempty"` + // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). + CreationDate *date.Time `json:"creationDate,omitempty"` + // CurrentServiceObjectiveName - READ-ONLY; The current service level objective name of the database. + CurrentServiceObjectiveName *string `json:"currentServiceObjectiveName,omitempty"` + // RequestedServiceObjectiveName - READ-ONLY; The requested service level objective name of the database. + RequestedServiceObjectiveName *string `json:"requestedServiceObjectiveName,omitempty"` + // DefaultSecondaryLocation - READ-ONLY; The default secondary region for this database. + DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` + // FailoverGroupID - READ-ONLY; Failover Group resource identifier that this database belongs to. + FailoverGroupID *string `json:"failoverGroupId,omitempty"` + // RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` + // SourceDatabaseDeletionDate - Specifies the time that the database was deleted. + SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` + // RecoveryServicesRecoveryPointID - The resource identifier of the recovery point associated with create operation of this database. + RecoveryServicesRecoveryPointID *string `json:"recoveryServicesRecoveryPointId,omitempty"` + // LongTermRetentionBackupResourceID - The resource identifier of the long term retention backup associated with create operation of this database. + LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` + // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. + RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` + // RestorableDroppedDatabaseID - The resource identifier of the restorable dropped database associated with create operation of this database. + RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` + // CatalogCollation - Collation of the metadata catalog. Possible values include: 'CatalogCollationTypeDATABASEDEFAULT', 'CatalogCollationTypeSQLLatin1GeneralCP1CIAS' + CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` + // ZoneRedundant - Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // LicenseType - The license type to apply for this database. `LicenseIncluded` if you need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. Possible values include: 'DatabaseLicenseTypeLicenseIncluded', 'DatabaseLicenseTypeBasePrice' + LicenseType DatabaseLicenseType `json:"licenseType,omitempty"` + // MaxLogSizeBytes - READ-ONLY; The max log size for this database. + MaxLogSizeBytes *int64 `json:"maxLogSizeBytes,omitempty"` + // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` + // ReadScale - The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. Possible values include: 'DatabaseReadScaleEnabled', 'DatabaseReadScaleDisabled' + ReadScale DatabaseReadScale `json:"readScale,omitempty"` + // HighAvailabilityReplicaCount - The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` + // SecondaryType - The secondary type of the database if it is a secondary. Valid values are Geo and Named. Possible values include: 'SecondaryTypeGeo', 'SecondaryTypeNamed' + SecondaryType SecondaryType `json:"secondaryType,omitempty"` + // CurrentSku - READ-ONLY; The name and tier of the SKU. + CurrentSku *Sku `json:"currentSku,omitempty"` + // AutoPauseDelay - Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled + AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` + // CurrentBackupStorageRedundancy - READ-ONLY; The storage account type used to store backups for this database. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + CurrentBackupStorageRedundancy BackupStorageRedundancy `json:"currentBackupStorageRedundancy,omitempty"` + // RequestedBackupStorageRedundancy - The storage account type to be used to store backups for this database. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + RequestedBackupStorageRedundancy BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` + // MinCapacity - Minimal capacity that database will always have allocated, if not paused + MinCapacity *float64 `json:"minCapacity,omitempty"` + // PausedDate - READ-ONLY; The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. + PausedDate *date.Time `json:"pausedDate,omitempty"` + // ResumedDate - READ-ONLY; The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. + ResumedDate *date.Time `json:"resumedDate,omitempty"` + // MaintenanceConfigurationID - Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. + MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + // IsLedgerOn - Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the value of this property cannot be changed after the database has been created. + IsLedgerOn *bool `json:"isLedgerOn,omitempty"` + // IsInfraEncryptionEnabled - READ-ONLY; Infra encryption is enabled for this database. + IsInfraEncryptionEnabled *bool `json:"isInfraEncryptionEnabled,omitempty"` + // FederatedClientID - The Client id used for cross tenant per database CMK scenario + FederatedClientID *uuid.UUID `json:"federatedClientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabaseUpdateProperties. +func (dup DatabaseUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dup.CreateMode != "" { + objectMap["createMode"] = dup.CreateMode + } + if dup.Collation != nil { + objectMap["collation"] = dup.Collation + } + if dup.MaxSizeBytes != nil { + objectMap["maxSizeBytes"] = dup.MaxSizeBytes + } + if dup.SampleName != "" { + objectMap["sampleName"] = dup.SampleName + } + if dup.ElasticPoolID != nil { + objectMap["elasticPoolId"] = dup.ElasticPoolID + } + if dup.SourceDatabaseID != nil { + objectMap["sourceDatabaseId"] = dup.SourceDatabaseID + } + if dup.RestorePointInTime != nil { + objectMap["restorePointInTime"] = dup.RestorePointInTime + } + if dup.SourceDatabaseDeletionDate != nil { + objectMap["sourceDatabaseDeletionDate"] = dup.SourceDatabaseDeletionDate + } + if dup.RecoveryServicesRecoveryPointID != nil { + objectMap["recoveryServicesRecoveryPointId"] = dup.RecoveryServicesRecoveryPointID + } + if dup.LongTermRetentionBackupResourceID != nil { + objectMap["longTermRetentionBackupResourceId"] = dup.LongTermRetentionBackupResourceID + } + if dup.RecoverableDatabaseID != nil { + objectMap["recoverableDatabaseId"] = dup.RecoverableDatabaseID + } + if dup.RestorableDroppedDatabaseID != nil { + objectMap["restorableDroppedDatabaseId"] = dup.RestorableDroppedDatabaseID + } + if dup.CatalogCollation != "" { + objectMap["catalogCollation"] = dup.CatalogCollation + } + if dup.ZoneRedundant != nil { + objectMap["zoneRedundant"] = dup.ZoneRedundant + } + if dup.LicenseType != "" { + objectMap["licenseType"] = dup.LicenseType + } + if dup.ReadScale != "" { + objectMap["readScale"] = dup.ReadScale + } + if dup.HighAvailabilityReplicaCount != nil { + objectMap["highAvailabilityReplicaCount"] = dup.HighAvailabilityReplicaCount + } + if dup.SecondaryType != "" { + objectMap["secondaryType"] = dup.SecondaryType + } + if dup.AutoPauseDelay != nil { + objectMap["autoPauseDelay"] = dup.AutoPauseDelay + } + if dup.RequestedBackupStorageRedundancy != "" { + objectMap["requestedBackupStorageRedundancy"] = dup.RequestedBackupStorageRedundancy + } + if dup.MinCapacity != nil { + objectMap["minCapacity"] = dup.MinCapacity + } + if dup.MaintenanceConfigurationID != nil { + objectMap["maintenanceConfigurationId"] = dup.MaintenanceConfigurationID + } + if dup.IsLedgerOn != nil { + objectMap["isLedgerOn"] = dup.IsLedgerOn + } + if dup.FederatedClientID != nil { + objectMap["federatedClientId"] = dup.FederatedClientID + } + return json.Marshal(objectMap) +} + // DatabaseUsage usage metric of a database. type DatabaseUsage struct { // DatabaseUsageProperties - Resource properties. @@ -4058,6 +4304,20 @@ func (dup DatabaseUsageProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// DatabaseUserIdentity azure Active Directory identity configuration for a resource. +type DatabaseUserIdentity struct { + // PrincipalID - READ-ONLY; The Azure Active Directory principal id. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The Azure Active Directory client id. + ClientID *uuid.UUID `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabaseUserIdentity. +func (dui DatabaseUserIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // DatabaseVulnerabilityAssessment a database vulnerability assessment. type DatabaseVulnerabilityAssessment struct { autorest.Response `json:"-"` @@ -5358,64 +5618,11 @@ func (future *DeletedServersRecoverFuture) result(client DeletedServersClient) ( return } -// DNSRefreshConfigurationProperties DNS refresh configuration properties. -type DNSRefreshConfigurationProperties struct { - // Status - READ-ONLY; The status of the DNS refresh operation. Possible values include: 'Status1Succeeded', 'Status1Failed' - Status Status1 `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for DNSRefreshConfigurationProperties. -func (drcp DNSRefreshConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EditionCapability the edition capability. -type EditionCapability struct { - // Name - READ-ONLY; The database edition name. - Name *string `json:"name,omitempty"` - // SupportedServiceLevelObjectives - READ-ONLY; The list of supported service objectives for the edition. - SupportedServiceLevelObjectives *[]ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // ReadScale - READ-ONLY; The read scale capability for the edition. - ReadScale *ReadScaleCapability `json:"readScale,omitempty"` - // SupportedStorageCapabilities - READ-ONLY; The list of supported storage capabilities for this edition - SupportedStorageCapabilities *[]StorageCapability `json:"supportedStorageCapabilities,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for EditionCapability. -func (ec EditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ec.Reason != nil { - objectMap["reason"] = ec.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPool an elastic pool. -type ElasticPool struct { +// DistributedAvailabilityGroup distributed availability group between box and Sql Managed Instance. +type DistributedAvailabilityGroup struct { autorest.Response `json:"-"` - // Sku - The elastic pool SKU. - // - // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or the following command: - // - // ```azurecli - // az sql elastic-pool list-editions -l -o table - // ```` - Sku *Sku `json:"sku,omitempty"` - // Kind - READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ElasticPoolProperties - Resource properties. - *ElasticPoolProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` + // DistributedAvailabilityGroupProperties - Resource properties. + *DistributedAvailabilityGroupProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -5424,26 +5631,17 @@ type ElasticPool struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPool. -func (ep ElasticPool) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for DistributedAvailabilityGroup. +func (dag DistributedAvailabilityGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ep.Sku != nil { - objectMap["sku"] = ep.Sku - } - if ep.ElasticPoolProperties != nil { - objectMap["properties"] = ep.ElasticPoolProperties - } - if ep.Location != nil { - objectMap["location"] = ep.Location - } - if ep.Tags != nil { - objectMap["tags"] = ep.Tags + if dag.DistributedAvailabilityGroupProperties != nil { + objectMap["properties"] = dag.DistributedAvailabilityGroupProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ElasticPool struct. -func (ep *ElasticPool) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for DistributedAvailabilityGroup struct. +func (dag *DistributedAvailabilityGroup) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -5451,68 +5649,32 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "sku": + case "properties": if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) + var distributedAvailabilityGroupProperties DistributedAvailabilityGroupProperties + err = json.Unmarshal(*v, &distributedAvailabilityGroupProperties) if err != nil { return err } - ep.Sku = &sku + dag.DistributedAvailabilityGroupProperties = &distributedAvailabilityGroupProperties } - case "kind": + case "id": if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) + var ID string + err = json.Unmarshal(*v, &ID) if err != nil { return err } - ep.Kind = &kind + dag.ID = &ID } - case "properties": - if v != nil { - var elasticPoolProperties ElasticPoolProperties - err = json.Unmarshal(*v, &elasticPoolProperties) - if err != nil { - return err - } - ep.ElasticPoolProperties = &elasticPoolProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ep.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ep.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": + case "name": if v != nil { var name string err = json.Unmarshal(*v, &name) if err != nil { return err } - ep.Name = &name + dag.Name = &name } case "type": if v != nil { @@ -5521,7 +5683,7 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { if err != nil { return err } - ep.Type = &typeVar + dag.Type = &typeVar } } } @@ -5529,347 +5691,173 @@ func (ep *ElasticPool) UnmarshalJSON(body []byte) error { return nil } -// ElasticPoolActivity represents the activity on an elastic pool. -type ElasticPoolActivity struct { - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ElasticPoolActivityProperties - The properties representing the resource. - *ElasticPoolActivityProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// DistributedAvailabilityGroupProperties the properties of a distributed availability group. +type DistributedAvailabilityGroupProperties struct { + // TargetDatabase - The name of the target database + TargetDatabase *string `json:"targetDatabase,omitempty"` + // SourceEndpoint - The source endpoint + SourceEndpoint *string `json:"sourceEndpoint,omitempty"` + // PrimaryAvailabilityGroupName - The primary availability group name + PrimaryAvailabilityGroupName *string `json:"primaryAvailabilityGroupName,omitempty"` + // SecondaryAvailabilityGroupName - The secondary availability group name + SecondaryAvailabilityGroupName *string `json:"secondaryAvailabilityGroupName,omitempty"` + // ReplicationMode - The replication mode of a distributed availability group. Parameter will be ignored during link creation. Possible values include: 'ReplicationModeAsync', 'ReplicationModeSync' + ReplicationMode ReplicationMode `json:"replicationMode,omitempty"` + // DistributedAvailabilityGroupID - READ-ONLY; The distributed availability group id + DistributedAvailabilityGroupID *uuid.UUID `json:"distributedAvailabilityGroupId,omitempty"` + // SourceReplicaID - READ-ONLY; The source replica id + SourceReplicaID *uuid.UUID `json:"sourceReplicaId,omitempty"` + // TargetReplicaID - READ-ONLY; The target replica id + TargetReplicaID *uuid.UUID `json:"targetReplicaId,omitempty"` + // LinkState - READ-ONLY; The link state + LinkState *string `json:"linkState,omitempty"` + // LastHardenedLsn - READ-ONLY; The last hardened lsn + LastHardenedLsn *string `json:"lastHardenedLsn,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolActivity. -func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for DistributedAvailabilityGroupProperties. +func (dagp DistributedAvailabilityGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if epa.Location != nil { - objectMap["location"] = epa.Location + if dagp.TargetDatabase != nil { + objectMap["targetDatabase"] = dagp.TargetDatabase } - if epa.ElasticPoolActivityProperties != nil { - objectMap["properties"] = epa.ElasticPoolActivityProperties + if dagp.SourceEndpoint != nil { + objectMap["sourceEndpoint"] = dagp.SourceEndpoint + } + if dagp.PrimaryAvailabilityGroupName != nil { + objectMap["primaryAvailabilityGroupName"] = dagp.PrimaryAvailabilityGroupName + } + if dagp.SecondaryAvailabilityGroupName != nil { + objectMap["secondaryAvailabilityGroupName"] = dagp.SecondaryAvailabilityGroupName + } + if dagp.ReplicationMode != "" { + objectMap["replicationMode"] = dagp.ReplicationMode } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ElasticPoolActivity struct. -func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { +// DistributedAvailabilityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type DistributedAvailabilityGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DistributedAvailabilityGroupsClient) (DistributedAvailabilityGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DistributedAvailabilityGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { return err } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - epa.Location = &location - } - case "properties": - if v != nil { - var elasticPoolActivityProperties ElasticPoolActivityProperties - err = json.Unmarshal(*v, &elasticPoolActivityProperties) - if err != nil { - return err - } - epa.ElasticPoolActivityProperties = &elasticPoolActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epa.Type = &typeVar - } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DistributedAvailabilityGroupsCreateOrUpdateFuture.Result. +func (future *DistributedAvailabilityGroupsCreateOrUpdateFuture) result(client DistributedAvailabilityGroupsClient) (dag DistributedAvailabilityGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dag.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.DistributedAvailabilityGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dag.Response.Response, err = future.GetResult(sender); err == nil && dag.Response.Response.StatusCode != http.StatusNoContent { + dag, err = client.CreateOrUpdateResponder(dag.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsCreateOrUpdateFuture", "Result", dag.Response.Response, "Failure responding to request") } } + return +} + +// DistributedAvailabilityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DistributedAvailabilityGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DistributedAvailabilityGroupsClient) (autorest.Response, error) +} +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DistributedAvailabilityGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result return nil } -// ElasticPoolActivityListResult represents the response to a list elastic pool activity request. -type ElasticPoolActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of elastic pool activities. - Value *[]ElasticPoolActivity `json:"value,omitempty"` +// result is the default implementation for DistributedAvailabilityGroupsDeleteFuture.Result. +func (future *DistributedAvailabilityGroupsDeleteFuture) result(client DistributedAvailabilityGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.DistributedAvailabilityGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return } -// ElasticPoolActivityProperties represents the properties of an elastic pool. -type ElasticPoolActivityProperties struct { - // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorCode - READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorMessage - READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty"` - // ErrorSeverity - READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // Operation - READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty"` - // OperationID - READ-ONLY; The unique operation ID. - OperationID *uuid.UUID `json:"operationId,omitempty"` - // PercentComplete - READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // RequestedDatabaseDtuMax - READ-ONLY; The requested max DTU per database if available. - RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` - // RequestedDatabaseDtuMin - READ-ONLY; The requested min DTU per database if available. - RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` - // RequestedDtu - READ-ONLY; The requested DTU for the pool if available. - RequestedDtu *int32 `json:"requestedDtu,omitempty"` - // RequestedElasticPoolName - READ-ONLY; The requested name for the elastic pool if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - // RequestedStorageLimitInGB - READ-ONLY; The requested storage limit for the pool in GB if available. - RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` - // ElasticPoolName - READ-ONLY; The name of the elastic pool. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // ServerName - READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The time the operation started (ISO8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty"` - // RequestedStorageLimitInMB - READ-ONLY; The requested storage limit in MB. - RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` - // RequestedDatabaseDtuGuarantee - READ-ONLY; The requested per database DTU guarantee. - RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` - // RequestedDatabaseDtuCap - READ-ONLY; The requested per database DTU cap. - RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` - // RequestedDtuGuarantee - READ-ONLY; The requested DTU guarantee. - RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` +// DistributedAvailabilityGroupsListResult a list of distributed availability groups in instance. +type DistributedAvailabilityGroupsListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]DistributedAvailabilityGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolActivityProperties. -func (epap ElasticPoolActivityProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for DistributedAvailabilityGroupsListResult. +func (daglr DistributedAvailabilityGroupsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ElasticPoolDatabaseActivity represents the activity on an elastic pool. -type ElasticPoolDatabaseActivity struct { - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ElasticPoolDatabaseActivityProperties - The properties representing the resource. - *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// DistributedAvailabilityGroupsListResultIterator provides access to a complete listing of +// DistributedAvailabilityGroup values. +type DistributedAvailabilityGroupsListResultIterator struct { + i int + page DistributedAvailabilityGroupsListResultPage } -// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivity. -func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epda.Location != nil { - objectMap["location"] = epda.Location +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DistributedAvailabilityGroupsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DistributedAvailabilityGroupsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() } - if epda.ElasticPoolDatabaseActivityProperties != nil { - objectMap["properties"] = epda.ElasticPoolDatabaseActivityProperties + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ElasticPoolDatabaseActivity struct. -func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) + err = iter.page.NextWithContext(ctx) if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - epda.Location = &location - } - case "properties": - if v != nil { - var elasticPoolDatabaseActivityProperties ElasticPoolDatabaseActivityProperties - err = json.Unmarshal(*v, &elasticPoolDatabaseActivityProperties) - if err != nil { - return err - } - epda.ElasticPoolDatabaseActivityProperties = &elasticPoolDatabaseActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epda.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - epda.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - epda.Type = &typeVar - } - } - } - - return nil -} - -// ElasticPoolDatabaseActivityListResult represents the response to a list elastic pool database activity -// request. -type ElasticPoolDatabaseActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of elastic pool database activities. - Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` -} - -// ElasticPoolDatabaseActivityProperties represents the properties of an elastic pool database activity. -type ElasticPoolDatabaseActivityProperties struct { - // DatabaseName - READ-ONLY; The database name. - DatabaseName *string `json:"databaseName,omitempty"` - // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorCode - READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorMessage - READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty"` - // ErrorSeverity - READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // Operation - READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty"` - // OperationID - READ-ONLY; The unique operation ID. - OperationID *uuid.UUID `json:"operationId,omitempty"` - // PercentComplete - READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // RequestedElasticPoolName - READ-ONLY; The name for the elastic pool the database is moving into if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - // CurrentElasticPoolName - READ-ONLY; The name of the current elastic pool the database is in if available. - CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` - // CurrentServiceObjective - READ-ONLY; The name of the current service objective if available. - CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` - // RequestedServiceObjective - READ-ONLY; The name of the requested service objective if available. - RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` - // ServerName - READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The time the operation started (ISO8601 format). - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivityProperties. -func (epdap ElasticPoolDatabaseActivityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolEditionCapability the elastic pool edition capability. -type ElasticPoolEditionCapability struct { - // Name - READ-ONLY; The elastic pool edition name. - Name *string `json:"name,omitempty"` - // SupportedElasticPoolPerformanceLevels - READ-ONLY; The list of supported elastic pool DTU levels for the edition. - SupportedElasticPoolPerformanceLevels *[]ElasticPoolPerformanceLevelCapability `json:"supportedElasticPoolPerformanceLevels,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolEditionCapability. -func (epec ElasticPoolEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epec.Reason != nil { - objectMap["reason"] = epec.Reason - } - return json.Marshal(objectMap) -} - -// ElasticPoolListResult the result of an elastic pool list request. -type ElasticPoolListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ElasticPool `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolListResult. -func (eplr ElasticPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ElasticPoolListResultIterator provides access to a complete listing of ElasticPool values. -type ElasticPoolListResultIterator struct { - i int - page ElasticPoolListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ElasticPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- + iter.i-- return err } iter.i = 0 @@ -5879,67 +5867,67 @@ func (iter *ElasticPoolListResultIterator) NextWithContext(ctx context.Context) // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ElasticPoolListResultIterator) Next() error { +func (iter *DistributedAvailabilityGroupsListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ElasticPoolListResultIterator) NotDone() bool { +func (iter DistributedAvailabilityGroupsListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ElasticPoolListResultIterator) Response() ElasticPoolListResult { +func (iter DistributedAvailabilityGroupsListResultIterator) Response() DistributedAvailabilityGroupsListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ElasticPoolListResultIterator) Value() ElasticPool { +func (iter DistributedAvailabilityGroupsListResultIterator) Value() DistributedAvailabilityGroup { if !iter.page.NotDone() { - return ElasticPool{} + return DistributedAvailabilityGroup{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ElasticPoolListResultIterator type. -func NewElasticPoolListResultIterator(page ElasticPoolListResultPage) ElasticPoolListResultIterator { - return ElasticPoolListResultIterator{page: page} +// Creates a new instance of the DistributedAvailabilityGroupsListResultIterator type. +func NewDistributedAvailabilityGroupsListResultIterator(page DistributedAvailabilityGroupsListResultPage) DistributedAvailabilityGroupsListResultIterator { + return DistributedAvailabilityGroupsListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (eplr ElasticPoolListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 +func (daglr DistributedAvailabilityGroupsListResult) IsEmpty() bool { + return daglr.Value == nil || len(*daglr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (eplr ElasticPoolListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 +func (daglr DistributedAvailabilityGroupsListResult) hasNextLink() bool { + return daglr.NextLink != nil && len(*daglr.NextLink) != 0 } -// elasticPoolListResultPreparer prepares a request to retrieve the next set of results. +// distributedAvailabilityGroupsListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (eplr ElasticPoolListResult) elasticPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { +func (daglr DistributedAvailabilityGroupsListResult) distributedAvailabilityGroupsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !daglr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) + autorest.WithBaseURL(to.String(daglr.NextLink))) } -// ElasticPoolListResultPage contains a page of ElasticPool values. -type ElasticPoolListResultPage struct { - fn func(context.Context, ElasticPoolListResult) (ElasticPoolListResult, error) - eplr ElasticPoolListResult +// DistributedAvailabilityGroupsListResultPage contains a page of DistributedAvailabilityGroup values. +type DistributedAvailabilityGroupsListResultPage struct { + fn func(context.Context, DistributedAvailabilityGroupsListResult) (DistributedAvailabilityGroupsListResult, error) + daglr DistributedAvailabilityGroupsListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ElasticPoolListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *DistributedAvailabilityGroupsListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/DistributedAvailabilityGroupsListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -5949,11 +5937,11 @@ func (page *ElasticPoolListResultPage) NextWithContext(ctx context.Context) (err }() } for { - next, err := page.fn(ctx, page.eplr) + next, err := page.fn(ctx, page.daglr) if err != nil { return err } - page.eplr = next + page.daglr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -5964,83 +5952,225 @@ func (page *ElasticPoolListResultPage) NextWithContext(ctx context.Context) (err // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ElasticPoolListResultPage) Next() error { +func (page *DistributedAvailabilityGroupsListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ElasticPoolListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() +func (page DistributedAvailabilityGroupsListResultPage) NotDone() bool { + return !page.daglr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ElasticPoolListResultPage) Response() ElasticPoolListResult { - return page.eplr +func (page DistributedAvailabilityGroupsListResultPage) Response() DistributedAvailabilityGroupsListResult { + return page.daglr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ElasticPoolListResultPage) Values() []ElasticPool { - if page.eplr.IsEmpty() { +func (page DistributedAvailabilityGroupsListResultPage) Values() []DistributedAvailabilityGroup { + if page.daglr.IsEmpty() { return nil } - return *page.eplr.Value + return *page.daglr.Value } -// Creates a new instance of the ElasticPoolListResultPage type. -func NewElasticPoolListResultPage(cur ElasticPoolListResult, getNextPage func(context.Context, ElasticPoolListResult) (ElasticPoolListResult, error)) ElasticPoolListResultPage { - return ElasticPoolListResultPage{ - fn: getNextPage, - eplr: cur, +// Creates a new instance of the DistributedAvailabilityGroupsListResultPage type. +func NewDistributedAvailabilityGroupsListResultPage(cur DistributedAvailabilityGroupsListResult, getNextPage func(context.Context, DistributedAvailabilityGroupsListResult) (DistributedAvailabilityGroupsListResult, error)) DistributedAvailabilityGroupsListResultPage { + return DistributedAvailabilityGroupsListResultPage{ + fn: getNextPage, + daglr: cur, } } -// ElasticPoolOperation a elastic pool operation. -type ElasticPoolOperation struct { - // ElasticPoolOperationProperties - Resource properties. - *ElasticPoolOperationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// DistributedAvailabilityGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DistributedAvailabilityGroupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DistributedAvailabilityGroupsClient) (DistributedAvailabilityGroup, error) } -// MarshalJSON is the custom marshaler for ElasticPoolOperation. -func (epo ElasticPoolOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epo.ElasticPoolOperationProperties != nil { - objectMap["properties"] = epo.ElasticPoolOperationProperties +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DistributedAvailabilityGroupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - return json.Marshal(objectMap) + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// UnmarshalJSON is the custom unmarshaler for ElasticPoolOperation struct. -func (epo *ElasticPoolOperation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) +// result is the default implementation for DistributedAvailabilityGroupsUpdateFuture.Result. +func (future *DistributedAvailabilityGroupsUpdateFuture) result(client DistributedAvailabilityGroupsClient) (dag DistributedAvailabilityGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) if err != nil { - return err + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsUpdateFuture", "Result", future.Response(), "Polling failure") + return } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var elasticPoolOperationProperties ElasticPoolOperationProperties - err = json.Unmarshal(*v, &elasticPoolOperationProperties) - if err != nil { - return err - } - epo.ElasticPoolOperationProperties = &elasticPoolOperationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - epo.ID = &ID + if !done { + dag.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.DistributedAvailabilityGroupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dag.Response.Response, err = future.GetResult(sender); err == nil && dag.Response.Response.StatusCode != http.StatusNoContent { + dag, err = client.UpdateResponder(dag.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DistributedAvailabilityGroupsUpdateFuture", "Result", dag.Response.Response, "Failure responding to request") + } + } + return +} + +// DNSRefreshConfigurationProperties DNS refresh configuration properties. +type DNSRefreshConfigurationProperties struct { + // Status - READ-ONLY; The status of the DNS refresh operation. Possible values include: 'Status1Succeeded', 'Status1Failed' + Status Status1 `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for DNSRefreshConfigurationProperties. +func (drcp DNSRefreshConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EditionCapability the edition capability. +type EditionCapability struct { + // Name - READ-ONLY; The database edition name. + Name *string `json:"name,omitempty"` + // SupportedServiceLevelObjectives - READ-ONLY; The list of supported service objectives for the edition. + SupportedServiceLevelObjectives *[]ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` + // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // ReadScale - READ-ONLY; The read scale capability for the edition. + ReadScale *ReadScaleCapability `json:"readScale,omitempty"` + // SupportedStorageCapabilities - READ-ONLY; The list of supported storage capabilities for this edition + SupportedStorageCapabilities *[]StorageCapability `json:"supportedStorageCapabilities,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for EditionCapability. +func (ec EditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ec.Reason != nil { + objectMap["reason"] = ec.Reason + } + return json.Marshal(objectMap) +} + +// ElasticPool an elastic pool. +type ElasticPool struct { + autorest.Response `json:"-"` + // Sku - The elastic pool SKU. + // + // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or the following command: + // + // ```azurecli + // az sql elastic-pool list-editions -l -o table + // ```` + Sku *Sku `json:"sku,omitempty"` + // Kind - READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // ElasticPoolProperties - Resource properties. + *ElasticPoolProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPool. +func (ep ElasticPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ep.Sku != nil { + objectMap["sku"] = ep.Sku + } + if ep.ElasticPoolProperties != nil { + objectMap["properties"] = ep.ElasticPoolProperties + } + if ep.Location != nil { + objectMap["location"] = ep.Location + } + if ep.Tags != nil { + objectMap["tags"] = ep.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ElasticPool struct. +func (ep *ElasticPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + ep.Sku = &sku + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ep.Kind = &kind + } + case "properties": + if v != nil { + var elasticPoolProperties ElasticPoolProperties + err = json.Unmarshal(*v, &elasticPoolProperties) + if err != nil { + return err + } + ep.ElasticPoolProperties = &elasticPoolProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ep.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ep.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ep.ID = &ID } case "name": if v != nil { @@ -6049,7 +6179,7 @@ func (epo *ElasticPoolOperation) UnmarshalJSON(body []byte) error { if err != nil { return err } - epo.Name = &name + ep.Name = &name } case "type": if v != nil { @@ -6058,7 +6188,7 @@ func (epo *ElasticPoolOperation) UnmarshalJSON(body []byte) error { if err != nil { return err } - epo.Type = &typeVar + ep.Type = &typeVar } } } @@ -6066,525 +6196,494 @@ func (epo *ElasticPoolOperation) UnmarshalJSON(body []byte) error { return nil } -// ElasticPoolOperationListResult the response to a list elastic pool operations request -type ElasticPoolOperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ElasticPoolOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` +// ElasticPoolActivity represents the activity on an elastic pool. +type ElasticPoolActivity struct { + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ElasticPoolActivityProperties - The properties representing the resource. + *ElasticPoolActivityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolOperationListResult. -func (epolr ElasticPoolOperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ElasticPoolActivity. +func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if epa.Location != nil { + objectMap["location"] = epa.Location + } + if epa.ElasticPoolActivityProperties != nil { + objectMap["properties"] = epa.ElasticPoolActivityProperties + } return json.Marshal(objectMap) } -// ElasticPoolOperationListResultIterator provides access to a complete listing of ElasticPoolOperation -// values. -type ElasticPoolOperationListResultIterator struct { - i int - page ElasticPoolOperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ElasticPoolOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) +// UnmarshalJSON is the custom unmarshaler for ElasticPoolActivity struct. +func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - iter.i-- return err } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ElasticPoolOperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ElasticPoolOperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ElasticPoolOperationListResultIterator) Response() ElasticPoolOperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ElasticPoolOperationListResultIterator) Value() ElasticPoolOperation { - if !iter.page.NotDone() { - return ElasticPoolOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ElasticPoolOperationListResultIterator type. -func NewElasticPoolOperationListResultIterator(page ElasticPoolOperationListResultPage) ElasticPoolOperationListResultIterator { - return ElasticPoolOperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (epolr ElasticPoolOperationListResult) IsEmpty() bool { - return epolr.Value == nil || len(*epolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (epolr ElasticPoolOperationListResult) hasNextLink() bool { - return epolr.NextLink != nil && len(*epolr.NextLink) != 0 -} - -// elasticPoolOperationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (epolr ElasticPoolOperationListResult) elasticPoolOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !epolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(epolr.NextLink))) -} - -// ElasticPoolOperationListResultPage contains a page of ElasticPoolOperation values. -type ElasticPoolOperationListResultPage struct { - fn func(context.Context, ElasticPoolOperationListResult) (ElasticPoolOperationListResult, error) - epolr ElasticPoolOperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ElasticPoolOperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + epa.Location = &location + } + case "properties": + if v != nil { + var elasticPoolActivityProperties ElasticPoolActivityProperties + err = json.Unmarshal(*v, &elasticPoolActivityProperties) + if err != nil { + return err + } + epa.ElasticPoolActivityProperties = &elasticPoolActivityProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + epa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + epa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + epa.Type = &typeVar } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.epolr) - if err != nil { - return err - } - page.epolr = next - if !next.hasNextLink() || !next.IsEmpty() { - break } } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ElasticPoolOperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ElasticPoolOperationListResultPage) NotDone() bool { - return !page.epolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ElasticPoolOperationListResultPage) Response() ElasticPoolOperationListResult { - return page.epolr -} -// Values returns the slice of values for the current page or nil if there are no values. -func (page ElasticPoolOperationListResultPage) Values() []ElasticPoolOperation { - if page.epolr.IsEmpty() { - return nil - } - return *page.epolr.Value + return nil } -// Creates a new instance of the ElasticPoolOperationListResultPage type. -func NewElasticPoolOperationListResultPage(cur ElasticPoolOperationListResult, getNextPage func(context.Context, ElasticPoolOperationListResult) (ElasticPoolOperationListResult, error)) ElasticPoolOperationListResultPage { - return ElasticPoolOperationListResultPage{ - fn: getNextPage, - epolr: cur, - } +// ElasticPoolActivityListResult represents the response to a list elastic pool activity request. +type ElasticPoolActivityListResult struct { + autorest.Response `json:"-"` + // Value - The list of elastic pool activities. + Value *[]ElasticPoolActivity `json:"value,omitempty"` } -// ElasticPoolOperationProperties the properties of a elastic pool operation. -type ElasticPoolOperationProperties struct { - // ElasticPoolName - READ-ONLY; The name of the elastic pool the operation is being performed on. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // Operation - READ-ONLY; The name of operation. +// ElasticPoolActivityProperties represents the properties of an elastic pool. +type ElasticPoolActivityProperties struct { + // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). + EndTime *date.Time `json:"endTime,omitempty"` + // ErrorCode - READ-ONLY; The error code if available. + ErrorCode *int32 `json:"errorCode,omitempty"` + // ErrorMessage - READ-ONLY; The error message if available. + ErrorMessage *string `json:"errorMessage,omitempty"` + // ErrorSeverity - READ-ONLY; The error severity if available. + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + // Operation - READ-ONLY; The operation name. Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. + // OperationID - READ-ONLY; The unique operation ID. + OperationID *uuid.UUID `json:"operationId,omitempty"` + // PercentComplete - READ-ONLY; The percentage complete if available. PercentComplete *int32 `json:"percentComplete,omitempty"` - // ServerName - READ-ONLY; The name of the server. + // RequestedDatabaseDtuMax - READ-ONLY; The requested max DTU per database if available. + RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` + // RequestedDatabaseDtuMin - READ-ONLY; The requested min DTU per database if available. + RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` + // RequestedDtu - READ-ONLY; The requested DTU for the pool if available. + RequestedDtu *int32 `json:"requestedDtu,omitempty"` + // RequestedElasticPoolName - READ-ONLY; The requested name for the elastic pool if available. + RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` + // RequestedStorageLimitInGB - READ-ONLY; The requested storage limit for the pool in GB if available. + RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` + // ElasticPoolName - READ-ONLY; The name of the elastic pool. + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + // ServerName - READ-ONLY; The name of the server the elastic pool is in. ServerName *string `json:"serverName,omitempty"` - // StartTime - READ-ONLY; The operation start time. + // StartTime - READ-ONLY; The time the operation started (ISO8601 format). StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. + // State - READ-ONLY; The current state of the operation. State *string `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` + // RequestedStorageLimitInMB - READ-ONLY; The requested storage limit in MB. + RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` + // RequestedDatabaseDtuGuarantee - READ-ONLY; The requested per database DTU guarantee. + RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` + // RequestedDatabaseDtuCap - READ-ONLY; The requested per database DTU cap. + RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` + // RequestedDtuGuarantee - READ-ONLY; The requested DTU guarantee. + RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolOperationProperties. -func (epop ElasticPoolOperationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ElasticPoolActivityProperties. +func (epap ElasticPoolActivityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ElasticPoolPerDatabaseMaxPerformanceLevelCapability the max per-database performance level capability. -type ElasticPoolPerDatabaseMaxPerformanceLevelCapability struct { - // Limit - READ-ONLY; The maximum performance level per database. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'PerformanceLevelUnitDTU', 'PerformanceLevelUnitVCores' - Unit PerformanceLevelUnit `json:"unit,omitempty"` - // SupportedPerDatabaseMinPerformanceLevels - READ-ONLY; The list of supported min database performance levels. - SupportedPerDatabaseMinPerformanceLevels *[]ElasticPoolPerDatabaseMinPerformanceLevelCapability `json:"supportedPerDatabaseMinPerformanceLevels,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` +// ElasticPoolDatabaseActivity represents the activity on an elastic pool. +type ElasticPoolDatabaseActivity struct { + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ElasticPoolDatabaseActivityProperties - The properties representing the resource. + *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMaxPerformanceLevelCapability. -func (eppdmplc ElasticPoolPerDatabaseMaxPerformanceLevelCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivity. +func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if eppdmplc.Reason != nil { - objectMap["reason"] = eppdmplc.Reason + if epda.Location != nil { + objectMap["location"] = epda.Location } - return json.Marshal(objectMap) -} - -// ElasticPoolPerDatabaseMinPerformanceLevelCapability the minimum per-database performance level -// capability. -type ElasticPoolPerDatabaseMinPerformanceLevelCapability struct { - // Limit - READ-ONLY; The minimum performance level per database. - Limit *float64 `json:"limit,omitempty"` - // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'PerformanceLevelUnitDTU', 'PerformanceLevelUnitVCores' - Unit PerformanceLevelUnit `json:"unit,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMinPerformanceLevelCapability. -func (eppdmplc ElasticPoolPerDatabaseMinPerformanceLevelCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eppdmplc.Reason != nil { - objectMap["reason"] = eppdmplc.Reason + if epda.ElasticPoolDatabaseActivityProperties != nil { + objectMap["properties"] = epda.ElasticPoolDatabaseActivityProperties } return json.Marshal(objectMap) } -// ElasticPoolPerDatabaseSettings per database settings of an elastic pool. -type ElasticPoolPerDatabaseSettings struct { - // MinCapacity - The minimum capacity all databases are guaranteed. - MinCapacity *float64 `json:"minCapacity,omitempty"` - // MaxCapacity - The maximum capacity any one database can consume. - MaxCapacity *float64 `json:"maxCapacity,omitempty"` +// UnmarshalJSON is the custom unmarshaler for ElasticPoolDatabaseActivity struct. +func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + epda.Location = &location + } + case "properties": + if v != nil { + var elasticPoolDatabaseActivityProperties ElasticPoolDatabaseActivityProperties + err = json.Unmarshal(*v, &elasticPoolDatabaseActivityProperties) + if err != nil { + return err + } + epda.ElasticPoolDatabaseActivityProperties = &elasticPoolDatabaseActivityProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + epda.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + epda.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + epda.Type = &typeVar + } + } + } + + return nil } -// ElasticPoolPerformanceLevelCapability the Elastic Pool performance level capability. -type ElasticPoolPerformanceLevelCapability struct { - // PerformanceLevel - READ-ONLY; The performance level for the pool. - PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty"` - // Sku - READ-ONLY; The sku. - Sku *Sku `json:"sku,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // MaxDatabaseCount - READ-ONLY; The maximum number of databases supported. - MaxDatabaseCount *int32 `json:"maxDatabaseCount,omitempty"` - // IncludedMaxSize - READ-ONLY; The included (free) max size for this performance level. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // SupportedMaxSizes - READ-ONLY; The list of supported max sizes. - SupportedMaxSizes *[]MaxSizeRangeCapability `json:"supportedMaxSizes,omitempty"` - // SupportedPerDatabaseMaxSizes - READ-ONLY; The list of supported per database max sizes. - SupportedPerDatabaseMaxSizes *[]MaxSizeRangeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` - // SupportedPerDatabaseMaxPerformanceLevels - READ-ONLY; The list of supported per database max performance levels. - SupportedPerDatabaseMaxPerformanceLevels *[]ElasticPoolPerDatabaseMaxPerformanceLevelCapability `json:"supportedPerDatabaseMaxPerformanceLevels,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the performance level. +// ElasticPoolDatabaseActivityListResult represents the response to a list elastic pool database activity +// request. +type ElasticPoolDatabaseActivityListResult struct { + autorest.Response `json:"-"` + // Value - The list of elastic pool database activities. + Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` +} + +// ElasticPoolDatabaseActivityProperties represents the properties of an elastic pool database activity. +type ElasticPoolDatabaseActivityProperties struct { + // DatabaseName - READ-ONLY; The database name. + DatabaseName *string `json:"databaseName,omitempty"` + // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). + EndTime *date.Time `json:"endTime,omitempty"` + // ErrorCode - READ-ONLY; The error code if available. + ErrorCode *int32 `json:"errorCode,omitempty"` + // ErrorMessage - READ-ONLY; The error message if available. + ErrorMessage *string `json:"errorMessage,omitempty"` + // ErrorSeverity - READ-ONLY; The error severity if available. + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + // Operation - READ-ONLY; The operation name. + Operation *string `json:"operation,omitempty"` + // OperationID - READ-ONLY; The unique operation ID. + OperationID *uuid.UUID `json:"operationId,omitempty"` + // PercentComplete - READ-ONLY; The percentage complete if available. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // RequestedElasticPoolName - READ-ONLY; The name for the elastic pool the database is moving into if available. + RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` + // CurrentElasticPoolName - READ-ONLY; The name of the current elastic pool the database is in if available. + CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` + // CurrentServiceObjective - READ-ONLY; The name of the current service objective if available. + CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` + // RequestedServiceObjective - READ-ONLY; The name of the requested service objective if available. + RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` + // ServerName - READ-ONLY; The name of the server the elastic pool is in. + ServerName *string `json:"serverName,omitempty"` + // StartTime - READ-ONLY; The time the operation started (ISO8601 format). + StartTime *date.Time `json:"startTime,omitempty"` + // State - READ-ONLY; The current state of the operation. + State *string `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivityProperties. +func (epdap ElasticPoolDatabaseActivityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ElasticPoolEditionCapability the elastic pool edition capability. +type ElasticPoolEditionCapability struct { + // Name - READ-ONLY; The elastic pool edition name. + Name *string `json:"name,omitempty"` + // SupportedElasticPoolPerformanceLevels - READ-ONLY; The list of supported elastic pool DTU levels for the edition. + SupportedElasticPoolPerformanceLevels *[]ElasticPoolPerformanceLevelCapability `json:"supportedElasticPoolPerformanceLevels,omitempty"` + // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // SupportedMaintenanceConfigurations - READ-ONLY; List of supported maintenance configurations - SupportedMaintenanceConfigurations *[]MaintenanceConfigurationCapability `json:"supportedMaintenanceConfigurations,omitempty"` // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' Status CapabilityStatus `json:"status,omitempty"` // Reason - The reason for the capability not being available. Reason *string `json:"reason,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolPerformanceLevelCapability. -func (epplc ElasticPoolPerformanceLevelCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ElasticPoolEditionCapability. +func (epec ElasticPoolEditionCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if epplc.Reason != nil { - objectMap["reason"] = epplc.Reason + if epec.Reason != nil { + objectMap["reason"] = epec.Reason } return json.Marshal(objectMap) } -// ElasticPoolProperties properties of an elastic pool -type ElasticPoolProperties struct { - // State - READ-ONLY; The state of the elastic pool. Possible values include: 'ElasticPoolStateCreating', 'ElasticPoolStateReady', 'ElasticPoolStateDisabled' - State ElasticPoolState `json:"state,omitempty"` - // CreationDate - READ-ONLY; The creation date of the elastic pool (ISO8601 format). - CreationDate *date.Time `json:"creationDate,omitempty"` - // MaxSizeBytes - The storage limit for the database elastic pool in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // PerDatabaseSettings - The per database settings for the elastic pool. - PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` - // ZoneRedundant - Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // LicenseType - The license type to apply for this elastic pool. Possible values include: 'ElasticPoolLicenseTypeLicenseIncluded', 'ElasticPoolLicenseTypeBasePrice' - LicenseType ElasticPoolLicenseType `json:"licenseType,omitempty"` - // MaintenanceConfigurationID - Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` +// ElasticPoolListResult the result of an elastic pool list request. +type ElasticPoolListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ElasticPool `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ElasticPoolProperties. -func (epp ElasticPoolProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ElasticPoolListResult. +func (eplr ElasticPoolListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if epp.MaxSizeBytes != nil { - objectMap["maxSizeBytes"] = epp.MaxSizeBytes - } - if epp.PerDatabaseSettings != nil { - objectMap["perDatabaseSettings"] = epp.PerDatabaseSettings - } - if epp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = epp.ZoneRedundant - } - if epp.LicenseType != "" { - objectMap["licenseType"] = epp.LicenseType - } - if epp.MaintenanceConfigurationID != nil { - objectMap["maintenanceConfigurationId"] = epp.MaintenanceConfigurationID - } return json.Marshal(objectMap) } -// ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ElasticPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (ElasticPool, error) +// ElasticPoolListResultIterator provides access to a complete listing of ElasticPool values. +type ElasticPoolListResultIterator struct { + i int + page ElasticPoolListResultPage } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ElasticPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- return err } - future.FutureAPI = &azFuture - future.Result = future.result + iter.i = 0 return nil } -// result is the default implementation for ElasticPoolsCreateOrUpdateFuture.Result. -func (future *ElasticPoolsCreateOrUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.CreateOrUpdateResponder(ep.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") - } - } - return +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ElasticPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) } -// ElasticPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (autorest.Response, error) -} +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ElasticPoolListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// Response returns the raw server response from the last page request. +func (iter ElasticPoolListResultIterator) Response() ElasticPoolListResult { + return iter.page.Response() } -// result is the default implementation for ElasticPoolsDeleteFuture.Result. -func (future *ElasticPoolsDeleteFuture) result(client ElasticPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsDeleteFuture") - return +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ElasticPoolListResultIterator) Value() ElasticPool { + if !iter.page.NotDone() { + return ElasticPool{} } - ar.Response = future.Response() - return + return iter.page.Values()[iter.i] } -// ElasticPoolsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (autorest.Response, error) +// Creates a new instance of the ElasticPoolListResultIterator type. +func NewElasticPoolListResultIterator(page ElasticPoolListResultPage) ElasticPoolListResultIterator { + return ElasticPoolListResultIterator{page: page} } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsFailoverFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// IsEmpty returns true if the ListResult contains no values. +func (eplr ElasticPoolListResult) IsEmpty() bool { + return eplr.Value == nil || len(*eplr.Value) == 0 } -// result is the default implementation for ElasticPoolsFailoverFuture.Result. -func (future *ElasticPoolsFailoverFuture) result(client ElasticPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsFailoverFuture") - return - } - ar.Response = future.Response() - return +// hasNextLink returns true if the NextLink is not empty. +func (eplr ElasticPoolListResult) hasNextLink() bool { + return eplr.NextLink != nil && len(*eplr.NextLink) != 0 } -// ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ElasticPoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ElasticPoolsClient) (ElasticPool, error) +// elasticPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eplr ElasticPoolListResult) elasticPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eplr.NextLink))) } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ElasticPoolsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// ElasticPoolListResultPage contains a page of ElasticPool values. +type ElasticPoolListResultPage struct { + fn func(context.Context, ElasticPoolListResult) (ElasticPoolListResult, error) + eplr ElasticPoolListResult } -// result is the default implementation for ElasticPoolsUpdateFuture.Result. -func (future *ElasticPoolsUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") - return +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ElasticPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { - ep, err = client.UpdateResponder(ep.Response.Response) + for { + next, err := page.fn(ctx, page.eplr) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") + return err + } + page.eplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break } } - return + return nil } -// ElasticPoolUpdate an elastic pool update. -type ElasticPoolUpdate struct { - Sku *Sku `json:"sku,omitempty"` - // ElasticPoolUpdateProperties - Resource properties. - *ElasticPoolUpdateProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ElasticPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) } -// MarshalJSON is the custom marshaler for ElasticPoolUpdate. -func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if epu.Sku != nil { - objectMap["sku"] = epu.Sku +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ElasticPoolListResultPage) NotDone() bool { + return !page.eplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ElasticPoolListResultPage) Response() ElasticPoolListResult { + return page.eplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ElasticPoolListResultPage) Values() []ElasticPool { + if page.eplr.IsEmpty() { + return nil } - if epu.ElasticPoolUpdateProperties != nil { - objectMap["properties"] = epu.ElasticPoolUpdateProperties + return *page.eplr.Value +} + +// Creates a new instance of the ElasticPoolListResultPage type. +func NewElasticPoolListResultPage(cur ElasticPoolListResult, getNextPage func(context.Context, ElasticPoolListResult) (ElasticPoolListResult, error)) ElasticPoolListResultPage { + return ElasticPoolListResultPage{ + fn: getNextPage, + eplr: cur, } - if epu.Tags != nil { - objectMap["tags"] = epu.Tags +} + +// ElasticPoolOperation a elastic pool operation. +type ElasticPoolOperation struct { + // ElasticPoolOperationProperties - Resource properties. + *ElasticPoolOperationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolOperation. +func (epo ElasticPoolOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epo.ElasticPoolOperationProperties != nil { + objectMap["properties"] = epo.ElasticPoolOperationProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. -func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ElasticPoolOperation struct. +func (epo *ElasticPoolOperation) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -6592,32 +6691,41 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "sku": + case "properties": if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) + var elasticPoolOperationProperties ElasticPoolOperationProperties + err = json.Unmarshal(*v, &elasticPoolOperationProperties) if err != nil { return err } - epu.Sku = &sku + epo.ElasticPoolOperationProperties = &elasticPoolOperationProperties } - case "properties": + case "id": if v != nil { - var elasticPoolUpdateProperties ElasticPoolUpdateProperties - err = json.Unmarshal(*v, &elasticPoolUpdateProperties) + var ID string + err = json.Unmarshal(*v, &ID) if err != nil { return err } - epu.ElasticPoolUpdateProperties = &elasticPoolUpdateProperties + epo.ID = &ID } - case "tags": + case "name": if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var name string + err = json.Unmarshal(*v, &name) if err != nil { return err } - epu.Tags = tags + epo.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + epo.Type = &typeVar } } } @@ -6625,142 +6733,33 @@ func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { return nil } -// ElasticPoolUpdateProperties properties of an elastic pool -type ElasticPoolUpdateProperties struct { - // MaxSizeBytes - The storage limit for the database elastic pool in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // PerDatabaseSettings - The per database settings for the elastic pool. - PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` - // ZoneRedundant - Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // LicenseType - The license type to apply for this elastic pool. Possible values include: 'ElasticPoolLicenseTypeLicenseIncluded', 'ElasticPoolLicenseTypeBasePrice' - LicenseType ElasticPoolLicenseType `json:"licenseType,omitempty"` - // MaintenanceConfigurationID - Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` -} - -// EncryptionProtector the server encryption protector. -type EncryptionProtector struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // EncryptionProtectorProperties - Resource properties. - *EncryptionProtectorProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionProtector. -func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.EncryptionProtectorProperties != nil { - objectMap["properties"] = ep.EncryptionProtectorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EncryptionProtector struct. -func (ep *EncryptionProtector) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ep.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ep.Location = &location - } - case "properties": - if v != nil { - var encryptionProtectorProperties EncryptionProtectorProperties - err = json.Unmarshal(*v, &encryptionProtectorProperties) - if err != nil { - return err - } - ep.EncryptionProtectorProperties = &encryptionProtectorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ep.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ep.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ep.Type = &typeVar - } - } - } - - return nil -} - -// EncryptionProtectorListResult a list of server encryption protectors. -type EncryptionProtectorListResult struct { +// ElasticPoolOperationListResult the response to a list elastic pool operations request +type ElasticPoolOperationListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]EncryptionProtector `json:"value,omitempty"` + Value *[]ElasticPoolOperation `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for EncryptionProtectorListResult. -func (eplr EncryptionProtectorListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ElasticPoolOperationListResult. +func (epolr ElasticPoolOperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// EncryptionProtectorListResultIterator provides access to a complete listing of EncryptionProtector +// ElasticPoolOperationListResultIterator provides access to a complete listing of ElasticPoolOperation // values. -type EncryptionProtectorListResultIterator struct { +type ElasticPoolOperationListResultIterator struct { i int - page EncryptionProtectorListResultPage + page ElasticPoolOperationListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *EncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ElasticPoolOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -6785,67 +6784,67 @@ func (iter *EncryptionProtectorListResultIterator) NextWithContext(ctx context.C // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *EncryptionProtectorListResultIterator) Next() error { +func (iter *ElasticPoolOperationListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EncryptionProtectorListResultIterator) NotDone() bool { +func (iter ElasticPoolOperationListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter EncryptionProtectorListResultIterator) Response() EncryptionProtectorListResult { +func (iter ElasticPoolOperationListResultIterator) Response() ElasticPoolOperationListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter EncryptionProtectorListResultIterator) Value() EncryptionProtector { +func (iter ElasticPoolOperationListResultIterator) Value() ElasticPoolOperation { if !iter.page.NotDone() { - return EncryptionProtector{} + return ElasticPoolOperation{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the EncryptionProtectorListResultIterator type. -func NewEncryptionProtectorListResultIterator(page EncryptionProtectorListResultPage) EncryptionProtectorListResultIterator { - return EncryptionProtectorListResultIterator{page: page} +// Creates a new instance of the ElasticPoolOperationListResultIterator type. +func NewElasticPoolOperationListResultIterator(page ElasticPoolOperationListResultPage) ElasticPoolOperationListResultIterator { + return ElasticPoolOperationListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (eplr EncryptionProtectorListResult) IsEmpty() bool { - return eplr.Value == nil || len(*eplr.Value) == 0 +func (epolr ElasticPoolOperationListResult) IsEmpty() bool { + return epolr.Value == nil || len(*epolr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (eplr EncryptionProtectorListResult) hasNextLink() bool { - return eplr.NextLink != nil && len(*eplr.NextLink) != 0 +func (epolr ElasticPoolOperationListResult) hasNextLink() bool { + return epolr.NextLink != nil && len(*epolr.NextLink) != 0 } -// encryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. +// elasticPoolOperationListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (eplr EncryptionProtectorListResult) encryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eplr.hasNextLink() { +func (epolr ElasticPoolOperationListResult) elasticPoolOperationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !epolr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(eplr.NextLink))) + autorest.WithBaseURL(to.String(epolr.NextLink))) } -// EncryptionProtectorListResultPage contains a page of EncryptionProtector values. -type EncryptionProtectorListResultPage struct { - fn func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error) - eplr EncryptionProtectorListResult +// ElasticPoolOperationListResultPage contains a page of ElasticPoolOperation values. +type ElasticPoolOperationListResultPage struct { + fn func(context.Context, ElasticPoolOperationListResult) (ElasticPoolOperationListResult, error) + epolr ElasticPoolOperationListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *EncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ElasticPoolOperationListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ElasticPoolOperationListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -6855,11 +6854,11 @@ func (page *EncryptionProtectorListResultPage) NextWithContext(ctx context.Conte }() } for { - next, err := page.fn(ctx, page.eplr) + next, err := page.fn(ctx, page.epolr) if err != nil { return err } - page.eplr = next + page.epolr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -6870,78 +6869,219 @@ func (page *EncryptionProtectorListResultPage) NextWithContext(ctx context.Conte // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *EncryptionProtectorListResultPage) Next() error { +func (page *ElasticPoolOperationListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EncryptionProtectorListResultPage) NotDone() bool { - return !page.eplr.IsEmpty() +func (page ElasticPoolOperationListResultPage) NotDone() bool { + return !page.epolr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page EncryptionProtectorListResultPage) Response() EncryptionProtectorListResult { - return page.eplr +func (page ElasticPoolOperationListResultPage) Response() ElasticPoolOperationListResult { + return page.epolr } // Values returns the slice of values for the current page or nil if there are no values. -func (page EncryptionProtectorListResultPage) Values() []EncryptionProtector { - if page.eplr.IsEmpty() { +func (page ElasticPoolOperationListResultPage) Values() []ElasticPoolOperation { + if page.epolr.IsEmpty() { return nil } - return *page.eplr.Value + return *page.epolr.Value } -// Creates a new instance of the EncryptionProtectorListResultPage type. -func NewEncryptionProtectorListResultPage(cur EncryptionProtectorListResult, getNextPage func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error)) EncryptionProtectorListResultPage { - return EncryptionProtectorListResultPage{ - fn: getNextPage, - eplr: cur, +// Creates a new instance of the ElasticPoolOperationListResultPage type. +func NewElasticPoolOperationListResultPage(cur ElasticPoolOperationListResult, getNextPage func(context.Context, ElasticPoolOperationListResult) (ElasticPoolOperationListResult, error)) ElasticPoolOperationListResultPage { + return ElasticPoolOperationListResultPage{ + fn: getNextPage, + epolr: cur, } } -// EncryptionProtectorProperties properties for an encryption protector execution. -type EncryptionProtectorProperties struct { - // Subregion - READ-ONLY; Subregion of the encryption protector. - Subregion *string `json:"subregion,omitempty"` - // ServerKeyName - The name of the server key. - ServerKeyName *string `json:"serverKeyName,omitempty"` - // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServerKeyTypeServiceManaged', 'ServerKeyTypeAzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` - // AutoRotationEnabled - Key auto rotation opt-in flag. Either true or false. - AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty"` +// ElasticPoolOperationProperties the properties of a elastic pool operation. +type ElasticPoolOperationProperties struct { + // ElasticPoolName - READ-ONLY; The name of the elastic pool the operation is being performed on. + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + // Operation - READ-ONLY; The name of operation. + Operation *string `json:"operation,omitempty"` + // OperationFriendlyName - READ-ONLY; The friendly name of operation. + OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` + // PercentComplete - READ-ONLY; The percentage of the operation completed. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // ServerName - READ-ONLY; The name of the server. + ServerName *string `json:"serverName,omitempty"` + // StartTime - READ-ONLY; The operation start time. + StartTime *date.Time `json:"startTime,omitempty"` + // State - READ-ONLY; The operation state. + State *string `json:"state,omitempty"` + // ErrorCode - READ-ONLY; The operation error code. + ErrorCode *int32 `json:"errorCode,omitempty"` + // ErrorDescription - READ-ONLY; The operation error description. + ErrorDescription *string `json:"errorDescription,omitempty"` + // ErrorSeverity - READ-ONLY; The operation error severity. + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + // IsUserError - READ-ONLY; Whether or not the error is a user error. + IsUserError *bool `json:"isUserError,omitempty"` + // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. + EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` + // Description - READ-ONLY; The operation description. + Description *string `json:"description,omitempty"` + // IsCancellable - READ-ONLY; Whether the operation can be cancelled. + IsCancellable *bool `json:"isCancellable,omitempty"` } -// MarshalJSON is the custom marshaler for EncryptionProtectorProperties. -func (epp EncryptionProtectorProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ElasticPoolOperationProperties. +func (epop ElasticPoolOperationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if epp.ServerKeyName != nil { - objectMap["serverKeyName"] = epp.ServerKeyName - } - if epp.ServerKeyType != "" { - objectMap["serverKeyType"] = epp.ServerKeyType - } - if epp.AutoRotationEnabled != nil { - objectMap["autoRotationEnabled"] = epp.AutoRotationEnabled - } return json.Marshal(objectMap) } -// EncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EncryptionProtectorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(EncryptionProtectorsClient) (EncryptionProtector, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EncryptionProtectorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +// ElasticPoolPerDatabaseMaxPerformanceLevelCapability the max per-database performance level capability. +type ElasticPoolPerDatabaseMaxPerformanceLevelCapability struct { + // Limit - READ-ONLY; The maximum performance level per database. + Limit *float64 `json:"limit,omitempty"` + // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'PerformanceLevelUnitDTU', 'PerformanceLevelUnitVCores' + Unit PerformanceLevelUnit `json:"unit,omitempty"` + // SupportedPerDatabaseMinPerformanceLevels - READ-ONLY; The list of supported min database performance levels. + SupportedPerDatabaseMinPerformanceLevels *[]ElasticPoolPerDatabaseMinPerformanceLevelCapability `json:"supportedPerDatabaseMinPerformanceLevels,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMaxPerformanceLevelCapability. +func (eppdmplc ElasticPoolPerDatabaseMaxPerformanceLevelCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eppdmplc.Reason != nil { + objectMap["reason"] = eppdmplc.Reason + } + return json.Marshal(objectMap) +} + +// ElasticPoolPerDatabaseMinPerformanceLevelCapability the minimum per-database performance level +// capability. +type ElasticPoolPerDatabaseMinPerformanceLevelCapability struct { + // Limit - READ-ONLY; The minimum performance level per database. + Limit *float64 `json:"limit,omitempty"` + // Unit - READ-ONLY; Unit type used to measure performance level. Possible values include: 'PerformanceLevelUnitDTU', 'PerformanceLevelUnitVCores' + Unit PerformanceLevelUnit `json:"unit,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMinPerformanceLevelCapability. +func (eppdmplc ElasticPoolPerDatabaseMinPerformanceLevelCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eppdmplc.Reason != nil { + objectMap["reason"] = eppdmplc.Reason + } + return json.Marshal(objectMap) +} + +// ElasticPoolPerDatabaseSettings per database settings of an elastic pool. +type ElasticPoolPerDatabaseSettings struct { + // MinCapacity - The minimum capacity all databases are guaranteed. + MinCapacity *float64 `json:"minCapacity,omitempty"` + // MaxCapacity - The maximum capacity any one database can consume. + MaxCapacity *float64 `json:"maxCapacity,omitempty"` +} + +// ElasticPoolPerformanceLevelCapability the Elastic Pool performance level capability. +type ElasticPoolPerformanceLevelCapability struct { + // PerformanceLevel - READ-ONLY; The performance level for the pool. + PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty"` + // Sku - READ-ONLY; The sku. + Sku *Sku `json:"sku,omitempty"` + // SupportedLicenseTypes - READ-ONLY; List of supported license types. + SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` + // MaxDatabaseCount - READ-ONLY; The maximum number of databases supported. + MaxDatabaseCount *int32 `json:"maxDatabaseCount,omitempty"` + // IncludedMaxSize - READ-ONLY; The included (free) max size for this performance level. + IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` + // SupportedMaxSizes - READ-ONLY; The list of supported max sizes. + SupportedMaxSizes *[]MaxSizeRangeCapability `json:"supportedMaxSizes,omitempty"` + // SupportedPerDatabaseMaxSizes - READ-ONLY; The list of supported per database max sizes. + SupportedPerDatabaseMaxSizes *[]MaxSizeRangeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` + // SupportedPerDatabaseMaxPerformanceLevels - READ-ONLY; The list of supported per database max performance levels. + SupportedPerDatabaseMaxPerformanceLevels *[]ElasticPoolPerDatabaseMaxPerformanceLevelCapability `json:"supportedPerDatabaseMaxPerformanceLevels,omitempty"` + // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the performance level. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // SupportedMaintenanceConfigurations - READ-ONLY; List of supported maintenance configurations + SupportedMaintenanceConfigurations *[]MaintenanceConfigurationCapability `json:"supportedMaintenanceConfigurations,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolPerformanceLevelCapability. +func (epplc ElasticPoolPerformanceLevelCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epplc.Reason != nil { + objectMap["reason"] = epplc.Reason + } + return json.Marshal(objectMap) +} + +// ElasticPoolProperties properties of an elastic pool +type ElasticPoolProperties struct { + // State - READ-ONLY; The state of the elastic pool. Possible values include: 'ElasticPoolStateCreating', 'ElasticPoolStateReady', 'ElasticPoolStateDisabled' + State ElasticPoolState `json:"state,omitempty"` + // CreationDate - READ-ONLY; The creation date of the elastic pool (ISO8601 format). + CreationDate *date.Time `json:"creationDate,omitempty"` + // MaxSizeBytes - The storage limit for the database elastic pool in bytes. + MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` + // PerDatabaseSettings - The per database settings for the elastic pool. + PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` + // ZoneRedundant - Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // LicenseType - The license type to apply for this elastic pool. Possible values include: 'ElasticPoolLicenseTypeLicenseIncluded', 'ElasticPoolLicenseTypeBasePrice' + LicenseType ElasticPoolLicenseType `json:"licenseType,omitempty"` + // MaintenanceConfigurationID - Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. + MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + // HighAvailabilityReplicaCount - The number of secondary replicas associated with the elastic pool that are used to provide high availability. + HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolProperties. +func (epp ElasticPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epp.MaxSizeBytes != nil { + objectMap["maxSizeBytes"] = epp.MaxSizeBytes + } + if epp.PerDatabaseSettings != nil { + objectMap["perDatabaseSettings"] = epp.PerDatabaseSettings + } + if epp.ZoneRedundant != nil { + objectMap["zoneRedundant"] = epp.ZoneRedundant + } + if epp.LicenseType != "" { + objectMap["licenseType"] = epp.LicenseType + } + if epp.MaintenanceConfigurationID != nil { + objectMap["maintenanceConfigurationId"] = epp.MaintenanceConfigurationID + } + if epp.HighAvailabilityReplicaCount != nil { + objectMap["highAvailabilityReplicaCount"] = epp.HighAvailabilityReplicaCount + } + return json.Marshal(objectMap) +} + +// ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ElasticPoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ElasticPoolsClient) (ElasticPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ElasticPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -6951,40 +7091,40 @@ func (future *EncryptionProtectorsCreateOrUpdateFuture) UnmarshalJSON(body []byt return nil } -// result is the default implementation for EncryptionProtectorsCreateOrUpdateFuture.Result. -func (future *EncryptionProtectorsCreateOrUpdateFuture) result(client EncryptionProtectorsClient) (ep EncryptionProtector, err error) { +// result is the default implementation for ElasticPoolsCreateOrUpdateFuture.Result. +func (future *ElasticPoolsCreateOrUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { ep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsCreateOrUpdateFuture") + err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { ep, err = client.CreateOrUpdateResponder(ep.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") } } return } -// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EncryptionProtectorsRevalidateFuture struct { +// ElasticPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ElasticPoolsDeleteFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(EncryptionProtectorsClient) (autorest.Response, error) + Result func(ElasticPoolsClient) (autorest.Response, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *EncryptionProtectorsRevalidateFuture) UnmarshalJSON(body []byte) error { +func (future *ElasticPoolsDeleteFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -6994,80 +7134,246 @@ func (future *EncryptionProtectorsRevalidateFuture) UnmarshalJSON(body []byte) e return nil } -// result is the default implementation for EncryptionProtectorsRevalidateFuture.Result. -func (future *EncryptionProtectorsRevalidateFuture) result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { +// result is the default implementation for ElasticPoolsDeleteFuture.Result. +func (future *ElasticPoolsDeleteFuture) result(client ElasticPoolsClient) (ar autorest.Response, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsDeleteFuture", "Result", future.Response(), "Polling failure") return } if !done { ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") + err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsDeleteFuture") return } ar.Response = future.Response() return } -// ExportDatabaseDefinition contains the information necessary to perform export database operation. -type ExportDatabaseDefinition struct { - // StorageKeyType - Storage key type. Possible values include: 'StorageKeyTypeSharedAccessKey', 'StorageKeyTypeStorageAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - Storage key. - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` - // NetworkIsolation - Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` +// ElasticPoolsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ElasticPoolsFailoverFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ElasticPoolsClient) (autorest.Response, error) } -// ExtendedDatabaseBlobAuditingPolicy an extended database blob auditing policy. -type ExtendedDatabaseBlobAuditingPolicy struct { - autorest.Response `json:"-"` - // ExtendedDatabaseBlobAuditingPolicyProperties - Resource properties. - *ExtendedDatabaseBlobAuditingPolicyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ElasticPoolsFailoverFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// MarshalJSON is the custom marshaler for ExtendedDatabaseBlobAuditingPolicy. -func (edbap ExtendedDatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if edbap.ExtendedDatabaseBlobAuditingPolicyProperties != nil { - objectMap["properties"] = edbap.ExtendedDatabaseBlobAuditingPolicyProperties +// result is the default implementation for ElasticPoolsFailoverFuture.Result. +func (future *ElasticPoolsFailoverFuture) result(client ElasticPoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsFailoverFuture", "Result", future.Response(), "Polling failure") + return } - return json.Marshal(objectMap) + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsFailoverFuture") + return + } + ar.Response = future.Response() + return } -// UnmarshalJSON is the custom unmarshaler for ExtendedDatabaseBlobAuditingPolicy struct. -func (edbap *ExtendedDatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { +// ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ElasticPoolsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ElasticPoolsClient) (ElasticPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ElasticPoolsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { return err } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var extendedDatabaseBlobAuditingPolicyProperties ExtendedDatabaseBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &extendedDatabaseBlobAuditingPolicyProperties) + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ElasticPoolsUpdateFuture.Result. +func (future *ElasticPoolsUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ep.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { + ep, err = client.UpdateResponder(ep.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") + } + } + return +} + +// ElasticPoolUpdate an elastic pool update. +type ElasticPoolUpdate struct { + Sku *Sku `json:"sku,omitempty"` + // ElasticPoolUpdateProperties - Resource properties. + *ElasticPoolUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ElasticPoolUpdate. +func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epu.Sku != nil { + objectMap["sku"] = epu.Sku + } + if epu.ElasticPoolUpdateProperties != nil { + objectMap["properties"] = epu.ElasticPoolUpdateProperties + } + if epu.Tags != nil { + objectMap["tags"] = epu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. +func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) if err != nil { return err } - edbap.ExtendedDatabaseBlobAuditingPolicyProperties = &extendedDatabaseBlobAuditingPolicyProperties + epu.Sku = &sku + } + case "properties": + if v != nil { + var elasticPoolUpdateProperties ElasticPoolUpdateProperties + err = json.Unmarshal(*v, &elasticPoolUpdateProperties) + if err != nil { + return err + } + epu.ElasticPoolUpdateProperties = &elasticPoolUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + epu.Tags = tags + } + } + } + + return nil +} + +// ElasticPoolUpdateProperties properties of an elastic pool +type ElasticPoolUpdateProperties struct { + // MaxSizeBytes - The storage limit for the database elastic pool in bytes. + MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` + // PerDatabaseSettings - The per database settings for the elastic pool. + PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` + // ZoneRedundant - Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // LicenseType - The license type to apply for this elastic pool. Possible values include: 'ElasticPoolLicenseTypeLicenseIncluded', 'ElasticPoolLicenseTypeBasePrice' + LicenseType ElasticPoolLicenseType `json:"licenseType,omitempty"` + // MaintenanceConfigurationID - Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. + MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + // HighAvailabilityReplicaCount - The number of secondary replicas associated with the elastic pool that are used to provide high availability. Applicable only to Hyperscale elastic pools. + HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` +} + +// EncryptionProtector the server encryption protector. +type EncryptionProtector struct { + autorest.Response `json:"-"` + // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Resource location. + Location *string `json:"location,omitempty"` + // EncryptionProtectorProperties - Resource properties. + *EncryptionProtectorProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncryptionProtector. +func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ep.EncryptionProtectorProperties != nil { + objectMap["properties"] = ep.EncryptionProtectorProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EncryptionProtector struct. +func (ep *EncryptionProtector) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ep.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ep.Location = &location + } + case "properties": + if v != nil { + var encryptionProtectorProperties EncryptionProtectorProperties + err = json.Unmarshal(*v, &encryptionProtectorProperties) + if err != nil { + return err + } + ep.EncryptionProtectorProperties = &encryptionProtectorProperties } case "id": if v != nil { @@ -7076,7 +7382,7 @@ func (edbap *ExtendedDatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) erro if err != nil { return err } - edbap.ID = &ID + ep.ID = &ID } case "name": if v != nil { @@ -7085,7 +7391,7 @@ func (edbap *ExtendedDatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) erro if err != nil { return err } - edbap.Name = &name + ep.Name = &name } case "type": if v != nil { @@ -7094,7 +7400,7 @@ func (edbap *ExtendedDatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) erro if err != nil { return err } - edbap.Type = &typeVar + ep.Type = &typeVar } } } @@ -7102,33 +7408,33 @@ func (edbap *ExtendedDatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) erro return nil } -// ExtendedDatabaseBlobAuditingPolicyListResult a list of database extended auditing settings. -type ExtendedDatabaseBlobAuditingPolicyListResult struct { +// EncryptionProtectorListResult a list of server encryption protectors. +type EncryptionProtectorListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ExtendedDatabaseBlobAuditingPolicy `json:"value,omitempty"` + Value *[]EncryptionProtector `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ExtendedDatabaseBlobAuditingPolicyListResult. -func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for EncryptionProtectorListResult. +func (eplr EncryptionProtectorListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ExtendedDatabaseBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ExtendedDatabaseBlobAuditingPolicy values. -type ExtendedDatabaseBlobAuditingPolicyListResultIterator struct { +// EncryptionProtectorListResultIterator provides access to a complete listing of EncryptionProtector +// values. +type EncryptionProtectorListResultIterator struct { i int - page ExtendedDatabaseBlobAuditingPolicyListResultPage + page EncryptionProtectorListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ExtendedDatabaseBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *EncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPolicyListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -7153,68 +7459,67 @@ func (iter *ExtendedDatabaseBlobAuditingPolicyListResultIterator) NextWithContex // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ExtendedDatabaseBlobAuditingPolicyListResultIterator) Next() error { +func (iter *EncryptionProtectorListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) NotDone() bool { +func (iter EncryptionProtectorListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) Response() ExtendedDatabaseBlobAuditingPolicyListResult { +func (iter EncryptionProtectorListResultIterator) Response() EncryptionProtectorListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) Value() ExtendedDatabaseBlobAuditingPolicy { +func (iter EncryptionProtectorListResultIterator) Value() EncryptionProtector { if !iter.page.NotDone() { - return ExtendedDatabaseBlobAuditingPolicy{} + return EncryptionProtector{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ExtendedDatabaseBlobAuditingPolicyListResultIterator type. -func NewExtendedDatabaseBlobAuditingPolicyListResultIterator(page ExtendedDatabaseBlobAuditingPolicyListResultPage) ExtendedDatabaseBlobAuditingPolicyListResultIterator { - return ExtendedDatabaseBlobAuditingPolicyListResultIterator{page: page} +// Creates a new instance of the EncryptionProtectorListResultIterator type. +func NewEncryptionProtectorListResultIterator(page EncryptionProtectorListResultPage) EncryptionProtectorListResultIterator { + return EncryptionProtectorListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) IsEmpty() bool { - return edbaplr.Value == nil || len(*edbaplr.Value) == 0 +func (eplr EncryptionProtectorListResult) IsEmpty() bool { + return eplr.Value == nil || len(*eplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) hasNextLink() bool { - return edbaplr.NextLink != nil && len(*edbaplr.NextLink) != 0 +func (eplr EncryptionProtectorListResult) hasNextLink() bool { + return eplr.NextLink != nil && len(*eplr.NextLink) != 0 } -// extendedDatabaseBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. +// encryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) extendedDatabaseBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !edbaplr.hasNextLink() { +func (eplr EncryptionProtectorListResult) encryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(edbaplr.NextLink))) + autorest.WithBaseURL(to.String(eplr.NextLink))) } -// ExtendedDatabaseBlobAuditingPolicyListResultPage contains a page of ExtendedDatabaseBlobAuditingPolicy -// values. -type ExtendedDatabaseBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ExtendedDatabaseBlobAuditingPolicyListResult) (ExtendedDatabaseBlobAuditingPolicyListResult, error) - edbaplr ExtendedDatabaseBlobAuditingPolicyListResult +// EncryptionProtectorListResultPage contains a page of EncryptionProtector values. +type EncryptionProtectorListResultPage struct { + fn func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error) + eplr EncryptionProtectorListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ExtendedDatabaseBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *EncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPolicyListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -7224,11 +7529,11 @@ func (page *ExtendedDatabaseBlobAuditingPolicyListResultPage) NextWithContext(ct }() } for { - next, err := page.fn(ctx, page.edbaplr) + next, err := page.fn(ctx, page.eplr) if err != nil { return err } - page.edbaplr = next + page.eplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -7239,143 +7544,78 @@ func (page *ExtendedDatabaseBlobAuditingPolicyListResultPage) NextWithContext(ct // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ExtendedDatabaseBlobAuditingPolicyListResultPage) Next() error { +func (page *EncryptionProtectorListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.edbaplr.IsEmpty() +func (page EncryptionProtectorListResultPage) NotDone() bool { + return !page.eplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) Response() ExtendedDatabaseBlobAuditingPolicyListResult { - return page.edbaplr -} +func (page EncryptionProtectorListResultPage) Response() EncryptionProtectorListResult { + return page.eplr +} // Values returns the slice of values for the current page or nil if there are no values. -func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) Values() []ExtendedDatabaseBlobAuditingPolicy { - if page.edbaplr.IsEmpty() { +func (page EncryptionProtectorListResultPage) Values() []EncryptionProtector { + if page.eplr.IsEmpty() { return nil } - return *page.edbaplr.Value + return *page.eplr.Value } -// Creates a new instance of the ExtendedDatabaseBlobAuditingPolicyListResultPage type. -func NewExtendedDatabaseBlobAuditingPolicyListResultPage(cur ExtendedDatabaseBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedDatabaseBlobAuditingPolicyListResult) (ExtendedDatabaseBlobAuditingPolicyListResult, error)) ExtendedDatabaseBlobAuditingPolicyListResultPage { - return ExtendedDatabaseBlobAuditingPolicyListResultPage{ - fn: getNextPage, - edbaplr: cur, +// Creates a new instance of the EncryptionProtectorListResultPage type. +func NewEncryptionProtectorListResultPage(cur EncryptionProtectorListResult, getNextPage func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error)) EncryptionProtectorListResultPage { + return EncryptionProtectorListResultPage{ + fn: getNextPage, + eplr: cur, } } -// ExtendedDatabaseBlobAuditingPolicyProperties properties of an extended database blob auditing policy. -type ExtendedDatabaseBlobAuditingPolicyProperties struct { - // PredicateExpression - Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` - // State - Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` +// EncryptionProtectorProperties properties for an encryption protector execution. +type EncryptionProtectorProperties struct { + // Subregion - READ-ONLY; Subregion of the encryption protector. + Subregion *string `json:"subregion,omitempty"` + // ServerKeyName - The name of the server key. + ServerKeyName *string `json:"serverKeyName,omitempty"` + // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServerKeyTypeServiceManaged', 'ServerKeyTypeAzureKeyVault' + ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` + // URI - READ-ONLY; The URI of the server key. + URI *string `json:"uri,omitempty"` + // Thumbprint - READ-ONLY; Thumbprint of the server key. + Thumbprint *string `json:"thumbprint,omitempty"` + // AutoRotationEnabled - Key auto rotation opt-in flag. Either true or false. + AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty"` } -// ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture struct { +// MarshalJSON is the custom marshaler for EncryptionProtectorProperties. +func (epp EncryptionProtectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epp.ServerKeyName != nil { + objectMap["serverKeyName"] = epp.ServerKeyName + } + if epp.ServerKeyType != "" { + objectMap["serverKeyType"] = epp.ServerKeyType + } + if epp.AutoRotationEnabled != nil { + objectMap["autoRotationEnabled"] = epp.AutoRotationEnabled + } + return json.Marshal(objectMap) +} + +// EncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EncryptionProtectorsCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ExtendedServerBlobAuditingPoliciesClient) (ExtendedServerBlobAuditingPolicy, error) + Result func(EncryptionProtectorsClient) (EncryptionProtector, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *EncryptionProtectorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -7385,34 +7625,71 @@ func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) UnmarshalJ return nil } -// result is the default implementation for ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture.Result. -func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) result(client ExtendedServerBlobAuditingPoliciesClient) (esbap ExtendedServerBlobAuditingPolicy, err error) { +// result is the default implementation for EncryptionProtectorsCreateOrUpdateFuture.Result. +func (future *EncryptionProtectorsCreateOrUpdateFuture) result(client EncryptionProtectorsClient) (ep EncryptionProtector, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - esbap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture") + ep.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if esbap.Response.Response, err = future.GetResult(sender); err == nil && esbap.Response.Response.StatusCode != http.StatusNoContent { - esbap, err = client.CreateOrUpdateResponder(esbap.Response.Response) + if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { + ep, err = client.CreateOrUpdateResponder(ep.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", esbap.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") } } return } -// ExtendedServerBlobAuditingPolicy an extended server blob auditing policy. -type ExtendedServerBlobAuditingPolicy struct { +// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EncryptionProtectorsRevalidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EncryptionProtectorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EncryptionProtectorsRevalidateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EncryptionProtectorsRevalidateFuture.Result. +func (future *EncryptionProtectorsRevalidateFuture) result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") + return + } + ar.Response = future.Response() + return +} + +// EndpointCertificate certificate used on an endpoint on the Managed Instance. +type EndpointCertificate struct { autorest.Response `json:"-"` - // ExtendedServerBlobAuditingPolicyProperties - Resource properties. - *ExtendedServerBlobAuditingPolicyProperties `json:"properties,omitempty"` + // EndpointCertificateProperties - Resource properties. + *EndpointCertificateProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -7421,17 +7698,17 @@ type ExtendedServerBlobAuditingPolicy struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicy. -func (esbap ExtendedServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for EndpointCertificate. +func (ec EndpointCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if esbap.ExtendedServerBlobAuditingPolicyProperties != nil { - objectMap["properties"] = esbap.ExtendedServerBlobAuditingPolicyProperties + if ec.EndpointCertificateProperties != nil { + objectMap["properties"] = ec.EndpointCertificateProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ExtendedServerBlobAuditingPolicy struct. -func (esbap *ExtendedServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for EndpointCertificate struct. +func (ec *EndpointCertificate) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -7441,12 +7718,12 @@ func (esbap *ExtendedServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error switch k { case "properties": if v != nil { - var extendedServerBlobAuditingPolicyProperties ExtendedServerBlobAuditingPolicyProperties - err = json.Unmarshal(*v, &extendedServerBlobAuditingPolicyProperties) + var endpointCertificateProperties EndpointCertificateProperties + err = json.Unmarshal(*v, &endpointCertificateProperties) if err != nil { return err } - esbap.ExtendedServerBlobAuditingPolicyProperties = &extendedServerBlobAuditingPolicyProperties + ec.EndpointCertificateProperties = &endpointCertificateProperties } case "id": if v != nil { @@ -7455,7 +7732,7 @@ func (esbap *ExtendedServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error if err != nil { return err } - esbap.ID = &ID + ec.ID = &ID } case "name": if v != nil { @@ -7464,7 +7741,7 @@ func (esbap *ExtendedServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error if err != nil { return err } - esbap.Name = &name + ec.Name = &name } case "type": if v != nil { @@ -7473,7 +7750,7 @@ func (esbap *ExtendedServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error if err != nil { return err } - esbap.Type = &typeVar + ec.Type = &typeVar } } } @@ -7481,33 +7758,33 @@ func (esbap *ExtendedServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error return nil } -// ExtendedServerBlobAuditingPolicyListResult a list of server extended auditing settings. -type ExtendedServerBlobAuditingPolicyListResult struct { +// EndpointCertificateListResult a list of endpoint certificates on the target instance. +type EndpointCertificateListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ExtendedServerBlobAuditingPolicy `json:"value,omitempty"` + Value *[]EndpointCertificate `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicyListResult. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for EndpointCertificateListResult. +func (eclr EndpointCertificateListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ExtendedServerBlobAuditingPolicyListResultIterator provides access to a complete listing of -// ExtendedServerBlobAuditingPolicy values. -type ExtendedServerBlobAuditingPolicyListResultIterator struct { +// EndpointCertificateListResultIterator provides access to a complete listing of EndpointCertificate +// values. +type EndpointCertificateListResultIterator struct { i int - page ExtendedServerBlobAuditingPolicyListResultPage + page EndpointCertificateListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ExtendedServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *EndpointCertificateListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointCertificateListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -7532,68 +7809,67 @@ func (iter *ExtendedServerBlobAuditingPolicyListResultIterator) NextWithContext( // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ExtendedServerBlobAuditingPolicyListResultIterator) Next() error { +func (iter *EndpointCertificateListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExtendedServerBlobAuditingPolicyListResultIterator) NotDone() bool { +func (iter EndpointCertificateListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ExtendedServerBlobAuditingPolicyListResultIterator) Response() ExtendedServerBlobAuditingPolicyListResult { +func (iter EndpointCertificateListResultIterator) Response() EndpointCertificateListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ExtendedServerBlobAuditingPolicyListResultIterator) Value() ExtendedServerBlobAuditingPolicy { +func (iter EndpointCertificateListResultIterator) Value() EndpointCertificate { if !iter.page.NotDone() { - return ExtendedServerBlobAuditingPolicy{} + return EndpointCertificate{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultIterator type. -func NewExtendedServerBlobAuditingPolicyListResultIterator(page ExtendedServerBlobAuditingPolicyListResultPage) ExtendedServerBlobAuditingPolicyListResultIterator { - return ExtendedServerBlobAuditingPolicyListResultIterator{page: page} +// Creates a new instance of the EndpointCertificateListResultIterator type. +func NewEndpointCertificateListResultIterator(page EndpointCertificateListResultPage) EndpointCertificateListResultIterator { + return EndpointCertificateListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) IsEmpty() bool { - return esbaplr.Value == nil || len(*esbaplr.Value) == 0 +func (eclr EndpointCertificateListResult) IsEmpty() bool { + return eclr.Value == nil || len(*eclr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) hasNextLink() bool { - return esbaplr.NextLink != nil && len(*esbaplr.NextLink) != 0 +func (eclr EndpointCertificateListResult) hasNextLink() bool { + return eclr.NextLink != nil && len(*eclr.NextLink) != 0 } -// extendedServerBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. +// endpointCertificateListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (esbaplr ExtendedServerBlobAuditingPolicyListResult) extendedServerBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !esbaplr.hasNextLink() { +func (eclr EndpointCertificateListResult) endpointCertificateListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eclr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(esbaplr.NextLink))) + autorest.WithBaseURL(to.String(eclr.NextLink))) } -// ExtendedServerBlobAuditingPolicyListResultPage contains a page of ExtendedServerBlobAuditingPolicy -// values. -type ExtendedServerBlobAuditingPolicyListResultPage struct { - fn func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error) - esbaplr ExtendedServerBlobAuditingPolicyListResult +// EndpointCertificateListResultPage contains a page of EndpointCertificate values. +type EndpointCertificateListResultPage struct { + fn func(context.Context, EndpointCertificateListResult) (EndpointCertificateListResult, error) + eclr EndpointCertificateListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ExtendedServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *EndpointCertificateListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointCertificateListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -7603,11 +7879,11 @@ func (page *ExtendedServerBlobAuditingPolicyListResultPage) NextWithContext(ctx }() } for { - next, err := page.fn(ctx, page.esbaplr) + next, err := page.fn(ctx, page.eclr) if err != nil { return err } - page.esbaplr = next + page.eclr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -7618,152 +7894,65 @@ func (page *ExtendedServerBlobAuditingPolicyListResultPage) NextWithContext(ctx // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ExtendedServerBlobAuditingPolicyListResultPage) Next() error { +func (page *EndpointCertificateListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExtendedServerBlobAuditingPolicyListResultPage) NotDone() bool { - return !page.esbaplr.IsEmpty() +func (page EndpointCertificateListResultPage) NotDone() bool { + return !page.eclr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ExtendedServerBlobAuditingPolicyListResultPage) Response() ExtendedServerBlobAuditingPolicyListResult { - return page.esbaplr +func (page EndpointCertificateListResultPage) Response() EndpointCertificateListResult { + return page.eclr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ExtendedServerBlobAuditingPolicyListResultPage) Values() []ExtendedServerBlobAuditingPolicy { - if page.esbaplr.IsEmpty() { +func (page EndpointCertificateListResultPage) Values() []EndpointCertificate { + if page.eclr.IsEmpty() { return nil } - return *page.esbaplr.Value + return *page.eclr.Value } -// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultPage type. -func NewExtendedServerBlobAuditingPolicyListResultPage(cur ExtendedServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error)) ExtendedServerBlobAuditingPolicyListResultPage { - return ExtendedServerBlobAuditingPolicyListResultPage{ - fn: getNextPage, - esbaplr: cur, +// Creates a new instance of the EndpointCertificateListResultPage type. +func NewEndpointCertificateListResultPage(cur EndpointCertificateListResult, getNextPage func(context.Context, EndpointCertificateListResult) (EndpointCertificateListResult, error)) EndpointCertificateListResultPage { + return EndpointCertificateListResultPage{ + fn: getNextPage, + eclr: cur, } } -// ExtendedServerBlobAuditingPolicyProperties properties of an extended server blob auditing policy. -type ExtendedServerBlobAuditingPolicyProperties struct { - // IsDevopsAuditEnabled - Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'State' as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true - // - // When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs category on the master database should also be created. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsDevopsAuditEnabled *bool `json:"isDevopsAuditEnabled,omitempty"` - // PredicateExpression - Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` - // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` - // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. - // - // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: - // - // BATCH_COMPLETED_GROUP, - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - // FAILED_DATABASE_AUTHENTICATION_GROUP. - // - // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. - // - // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - // - // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - // BACKUP_RESTORE_GROUP - // DATABASE_LOGOUT_GROUP - // DATABASE_OBJECT_CHANGE_GROUP - // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - // DATABASE_OPERATION_GROUP - // DATABASE_PERMISSION_CHANGE_GROUP - // DATABASE_PRINCIPAL_CHANGE_GROUP - // DATABASE_PRINCIPAL_IMPERSONATION_GROUP - // DATABASE_ROLE_MEMBER_CHANGE_GROUP - // FAILED_DATABASE_AUTHENTICATION_GROUP - // SCHEMA_OBJECT_ACCESS_GROUP - // SCHEMA_OBJECT_CHANGE_GROUP - // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - // USER_CHANGE_PASSWORD_GROUP - // BATCH_STARTED_GROUP - // BATCH_COMPLETED_GROUP - // - // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. - // - // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - // - // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: - // SELECT - // UPDATE - // INSERT - // DELETE - // EXECUTE - // RECEIVE - // REFERENCES - // - // The general form for defining an action to be audited is: - // {action} ON {object} BY {principal} - // - // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - // - // For example: - // SELECT on dbo.myTable by public - // SELECT on DATABASE::myDatabase by public - // SELECT on SCHEMA::mySchema by public - // - // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` - // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. - // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. - // - // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. - // Note that for server level audit you should use the 'master' database as {databaseName}. - // - // Diagnostic Settings URI format: - // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - // - // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) - // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` - // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. - // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` - // State - Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' - State BlobAuditingPolicyState `json:"state,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. - // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. - // Prerequisites for using managed identity authentication: - // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. - // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` +// EndpointCertificateProperties the properties of an endpoint certificate. +type EndpointCertificateProperties struct { + // PublicBlob - The certificate public blob + PublicBlob *string `json:"publicBlob,omitempty"` } -// FailoverGroup a failover group. -type FailoverGroup struct { +// ExportDatabaseDefinition contains the information necessary to perform export database operation. +type ExportDatabaseDefinition struct { + // StorageKeyType - Storage key type. Possible values include: 'StorageKeyTypeSharedAccessKey', 'StorageKeyTypeStorageAccessKey' + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + // StorageKey - Storage key. + StorageKey *string `json:"storageKey,omitempty"` + // StorageURI - Storage Uri. + StorageURI *string `json:"storageUri,omitempty"` + // AdministratorLogin - Administrator login name. + AdministratorLogin *string `json:"administratorLogin,omitempty"` + // AdministratorLoginPassword - Administrator login password. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthenticationType - Authentication type. + AuthenticationType *string `json:"authenticationType,omitempty"` + // NetworkIsolation - Optional resource information to enable network isolation for request. + NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` +} + +// ExtendedDatabaseBlobAuditingPolicy an extended database blob auditing policy. +type ExtendedDatabaseBlobAuditingPolicy struct { autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // FailoverGroupProperties - Resource properties. - *FailoverGroupProperties `json:"properties,omitempty"` + // ExtendedDatabaseBlobAuditingPolicyProperties - Resource properties. + *ExtendedDatabaseBlobAuditingPolicyProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -7772,20 +7961,17 @@ type FailoverGroup struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for FailoverGroup. -func (fg FailoverGroup) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ExtendedDatabaseBlobAuditingPolicy. +func (edbap ExtendedDatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if fg.Tags != nil { - objectMap["tags"] = fg.Tags - } - if fg.FailoverGroupProperties != nil { - objectMap["properties"] = fg.FailoverGroupProperties + if edbap.ExtendedDatabaseBlobAuditingPolicyProperties != nil { + objectMap["properties"] = edbap.ExtendedDatabaseBlobAuditingPolicyProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for FailoverGroup struct. -func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ExtendedDatabaseBlobAuditingPolicy struct. +func (edbap *ExtendedDatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -7793,32 +7979,14 @@ func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - fg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fg.Tags = tags - } case "properties": if v != nil { - var failoverGroupProperties FailoverGroupProperties - err = json.Unmarshal(*v, &failoverGroupProperties) + var extendedDatabaseBlobAuditingPolicyProperties ExtendedDatabaseBlobAuditingPolicyProperties + err = json.Unmarshal(*v, &extendedDatabaseBlobAuditingPolicyProperties) if err != nil { return err } - fg.FailoverGroupProperties = &failoverGroupProperties + edbap.ExtendedDatabaseBlobAuditingPolicyProperties = &extendedDatabaseBlobAuditingPolicyProperties } case "id": if v != nil { @@ -7827,7 +7995,7 @@ func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - fg.ID = &ID + edbap.ID = &ID } case "name": if v != nil { @@ -7836,7 +8004,7 @@ func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - fg.Name = &name + edbap.Name = &name } case "type": if v != nil { @@ -7845,7 +8013,7 @@ func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - fg.Type = &typeVar + edbap.Type = &typeVar } } } @@ -7853,32 +8021,33 @@ func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { return nil } -// FailoverGroupListResult a list of failover groups. -type FailoverGroupListResult struct { +// ExtendedDatabaseBlobAuditingPolicyListResult a list of database extended auditing settings. +type ExtendedDatabaseBlobAuditingPolicyListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]FailoverGroup `json:"value,omitempty"` + Value *[]ExtendedDatabaseBlobAuditingPolicy `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for FailoverGroupListResult. -func (fglr FailoverGroupListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ExtendedDatabaseBlobAuditingPolicyListResult. +func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// FailoverGroupListResultIterator provides access to a complete listing of FailoverGroup values. -type FailoverGroupListResultIterator struct { +// ExtendedDatabaseBlobAuditingPolicyListResultIterator provides access to a complete listing of +// ExtendedDatabaseBlobAuditingPolicy values. +type ExtendedDatabaseBlobAuditingPolicyListResultIterator struct { i int - page FailoverGroupListResultPage + page ExtendedDatabaseBlobAuditingPolicyListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *FailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ExtendedDatabaseBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPolicyListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -7903,67 +8072,68 @@ func (iter *FailoverGroupListResultIterator) NextWithContext(ctx context.Context // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *FailoverGroupListResultIterator) Next() error { +func (iter *ExtendedDatabaseBlobAuditingPolicyListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FailoverGroupListResultIterator) NotDone() bool { +func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter FailoverGroupListResultIterator) Response() FailoverGroupListResult { +func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) Response() ExtendedDatabaseBlobAuditingPolicyListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter FailoverGroupListResultIterator) Value() FailoverGroup { +func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) Value() ExtendedDatabaseBlobAuditingPolicy { if !iter.page.NotDone() { - return FailoverGroup{} + return ExtendedDatabaseBlobAuditingPolicy{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the FailoverGroupListResultIterator type. -func NewFailoverGroupListResultIterator(page FailoverGroupListResultPage) FailoverGroupListResultIterator { - return FailoverGroupListResultIterator{page: page} +// Creates a new instance of the ExtendedDatabaseBlobAuditingPolicyListResultIterator type. +func NewExtendedDatabaseBlobAuditingPolicyListResultIterator(page ExtendedDatabaseBlobAuditingPolicyListResultPage) ExtendedDatabaseBlobAuditingPolicyListResultIterator { + return ExtendedDatabaseBlobAuditingPolicyListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (fglr FailoverGroupListResult) IsEmpty() bool { - return fglr.Value == nil || len(*fglr.Value) == 0 +func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) IsEmpty() bool { + return edbaplr.Value == nil || len(*edbaplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (fglr FailoverGroupListResult) hasNextLink() bool { - return fglr.NextLink != nil && len(*fglr.NextLink) != 0 +func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) hasNextLink() bool { + return edbaplr.NextLink != nil && len(*edbaplr.NextLink) != 0 } -// failoverGroupListResultPreparer prepares a request to retrieve the next set of results. +// extendedDatabaseBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (fglr FailoverGroupListResult) failoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !fglr.hasNextLink() { +func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) extendedDatabaseBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !edbaplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(fglr.NextLink))) -} - -// FailoverGroupListResultPage contains a page of FailoverGroup values. -type FailoverGroupListResultPage struct { - fn func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error) - fglr FailoverGroupListResult + autorest.WithBaseURL(to.String(edbaplr.NextLink))) } -// NextWithContext advances to the next page of values. If there was an error making +// ExtendedDatabaseBlobAuditingPolicyListResultPage contains a page of ExtendedDatabaseBlobAuditingPolicy +// values. +type ExtendedDatabaseBlobAuditingPolicyListResultPage struct { + fn func(context.Context, ExtendedDatabaseBlobAuditingPolicyListResult) (ExtendedDatabaseBlobAuditingPolicyListResult, error) + edbaplr ExtendedDatabaseBlobAuditingPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *FailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ExtendedDatabaseBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPolicyListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -7973,11 +8143,11 @@ func (page *FailoverGroupListResultPage) NextWithContext(ctx context.Context) (e }() } for { - next, err := page.fn(ctx, page.fglr) + next, err := page.fn(ctx, page.edbaplr) if err != nil { return err } - page.fglr = next + page.edbaplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -7988,95 +8158,143 @@ func (page *FailoverGroupListResultPage) NextWithContext(ctx context.Context) (e // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *FailoverGroupListResultPage) Next() error { +func (page *ExtendedDatabaseBlobAuditingPolicyListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FailoverGroupListResultPage) NotDone() bool { - return !page.fglr.IsEmpty() +func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) NotDone() bool { + return !page.edbaplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page FailoverGroupListResultPage) Response() FailoverGroupListResult { - return page.fglr +func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) Response() ExtendedDatabaseBlobAuditingPolicyListResult { + return page.edbaplr } // Values returns the slice of values for the current page or nil if there are no values. -func (page FailoverGroupListResultPage) Values() []FailoverGroup { - if page.fglr.IsEmpty() { +func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) Values() []ExtendedDatabaseBlobAuditingPolicy { + if page.edbaplr.IsEmpty() { return nil } - return *page.fglr.Value -} - -// Creates a new instance of the FailoverGroupListResultPage type. -func NewFailoverGroupListResultPage(cur FailoverGroupListResult, getNextPage func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error)) FailoverGroupListResultPage { - return FailoverGroupListResultPage{ - fn: getNextPage, - fglr: cur, - } -} - -// FailoverGroupProperties properties of a failover group. -type FailoverGroupProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'FailoverGroupReplicationRolePrimary', 'FailoverGroupReplicationRoleSecondary' - ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` - // ReplicationState - READ-ONLY; Replication state of the failover group instance. - ReplicationState *string `json:"replicationState,omitempty"` - // PartnerServers - List of partner server information for the failover group. - PartnerServers *[]PartnerInfo `json:"partnerServers,omitempty"` - // Databases - List of databases in the failover group. - Databases *[]string `json:"databases,omitempty"` + return *page.edbaplr.Value } -// MarshalJSON is the custom marshaler for FailoverGroupProperties. -func (fgp FailoverGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fgp.ReadWriteEndpoint != nil { - objectMap["readWriteEndpoint"] = fgp.ReadWriteEndpoint - } - if fgp.ReadOnlyEndpoint != nil { - objectMap["readOnlyEndpoint"] = fgp.ReadOnlyEndpoint - } - if fgp.PartnerServers != nil { - objectMap["partnerServers"] = fgp.PartnerServers - } - if fgp.Databases != nil { - objectMap["databases"] = fgp.Databases +// Creates a new instance of the ExtendedDatabaseBlobAuditingPolicyListResultPage type. +func NewExtendedDatabaseBlobAuditingPolicyListResultPage(cur ExtendedDatabaseBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedDatabaseBlobAuditingPolicyListResult) (ExtendedDatabaseBlobAuditingPolicyListResult, error)) ExtendedDatabaseBlobAuditingPolicyListResultPage { + return ExtendedDatabaseBlobAuditingPolicyListResultPage{ + fn: getNextPage, + edbaplr: cur, } - return json.Marshal(objectMap) -} - -// FailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. -type FailoverGroupReadOnlyEndpoint struct { - // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' - FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` } -// FailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. -type FailoverGroupReadWriteEndpoint struct { - // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'ReadWriteEndpointFailoverPolicyManual', 'ReadWriteEndpointFailoverPolicyAutomatic' - FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` - // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. - FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` +// ExtendedDatabaseBlobAuditingPolicyProperties properties of an extended database blob auditing policy. +type ExtendedDatabaseBlobAuditingPolicyProperties struct { + // PredicateExpression - Specifies condition of where clause when creating an audit. + PredicateExpression *string `json:"predicateExpression,omitempty"` + // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. + RetentionDays *int32 `json:"retentionDays,omitempty"` + // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. + // + // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + // + // BATCH_COMPLETED_GROUP, + // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + // FAILED_DATABASE_AUTHENTICATION_GROUP. + // + // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + // + // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + // + // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + // BACKUP_RESTORE_GROUP + // DATABASE_LOGOUT_GROUP + // DATABASE_OBJECT_CHANGE_GROUP + // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + // DATABASE_OPERATION_GROUP + // DATABASE_PERMISSION_CHANGE_GROUP + // DATABASE_PRINCIPAL_CHANGE_GROUP + // DATABASE_PRINCIPAL_IMPERSONATION_GROUP + // DATABASE_ROLE_MEMBER_CHANGE_GROUP + // FAILED_DATABASE_AUTHENTICATION_GROUP + // SCHEMA_OBJECT_ACCESS_GROUP + // SCHEMA_OBJECT_CHANGE_GROUP + // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + // USER_CHANGE_PASSWORD_GROUP + // BATCH_STARTED_GROUP + // BATCH_COMPLETED_GROUP + // + // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + // + // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + // + // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + // SELECT + // UPDATE + // INSERT + // DELETE + // EXECUTE + // RECEIVE + // REFERENCES + // + // The general form for defining an action to be audited is: + // {action} ON {object} BY {principal} + // + // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + // + // For example: + // SELECT on dbo.myTable by public + // SELECT on DATABASE::myDatabase by public + // SELECT on SCHEMA::mySchema by public + // + // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` + // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. + IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` + // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. + // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + // + // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + // Note that for server level audit you should use the 'master' database as {databaseName}. + // + // Diagnostic Settings URI format: + // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + // + // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` + // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` + // State - Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' + State BlobAuditingPolicyState `json:"state,omitempty"` + // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + StorageEndpoint *string `json:"storageEndpoint,omitempty"` + // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. + // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. + // Prerequisites for using managed identity authentication: + // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. + // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. + StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` } -// FailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FailoverGroupsCreateOrUpdateFuture struct { +// ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) + Result func(ExtendedServerBlobAuditingPoliciesClient) (ExtendedServerBlobAuditingPolicy, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -8086,300 +8304,68 @@ func (future *FailoverGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) err return nil } -// result is the default implementation for FailoverGroupsCreateOrUpdateFuture.Result. -func (future *FailoverGroupsCreateOrUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { +// result is the default implementation for ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture.Result. +func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) result(client ExtendedServerBlobAuditingPoliciesClient) (esbap ExtendedServerBlobAuditingPolicy, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsCreateOrUpdateFuture") + esbap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.CreateOrUpdateResponder(fg.Response.Response) + if esbap.Response.Response, err = future.GetResult(sender); err == nil && esbap.Response.Response.StatusCode != http.StatusNoContent { + esbap, err = client.CreateOrUpdateResponder(esbap.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", esbap.Response.Response, "Failure responding to request") } } return } -// FailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (autorest.Response, error) +// ExtendedServerBlobAuditingPolicy an extended server blob auditing policy. +type ExtendedServerBlobAuditingPolicy struct { + autorest.Response `json:"-"` + // ExtendedServerBlobAuditingPolicyProperties - Resource properties. + *ExtendedServerBlobAuditingPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicy. +func (esbap ExtendedServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if esbap.ExtendedServerBlobAuditingPolicyProperties != nil { + objectMap["properties"] = esbap.ExtendedServerBlobAuditingPolicyProperties } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return json.Marshal(objectMap) } -// result is the default implementation for FailoverGroupsDeleteFuture.Result. -func (future *FailoverGroupsDeleteFuture) result(client FailoverGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// UnmarshalJSON is the custom unmarshaler for ExtendedServerBlobAuditingPolicy struct. +func (esbap *ExtendedServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// FailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsFailoverFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FailoverGroupsFailoverFuture.Result. -func (future *FailoverGroupsFailoverFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsFailoverFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.FailoverResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type FailoverGroupsForceFailoverAllowDataLossFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsForceFailoverAllowDataLossFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FailoverGroupsForceFailoverAllowDataLossFuture.Result. -func (future *FailoverGroupsForceFailoverAllowDataLossFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsForceFailoverAllowDataLossFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.ForceFailoverAllowDataLossResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FailoverGroupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FailoverGroupsClient) (FailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FailoverGroupsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FailoverGroupsUpdateFuture.Result. -func (future *FailoverGroupsUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { - fg, err = client.UpdateResponder(fg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") - } - } - return -} - -// FailoverGroupUpdate a failover group update request. -type FailoverGroupUpdate struct { - // FailoverGroupUpdateProperties - Resource properties. - *FailoverGroupUpdateProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for FailoverGroupUpdate. -func (fgu FailoverGroupUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fgu.FailoverGroupUpdateProperties != nil { - objectMap["properties"] = fgu.FailoverGroupUpdateProperties - } - if fgu.Tags != nil { - objectMap["tags"] = fgu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FailoverGroupUpdate struct. -func (fgu *FailoverGroupUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var failoverGroupUpdateProperties FailoverGroupUpdateProperties - err = json.Unmarshal(*v, &failoverGroupUpdateProperties) - if err != nil { - return err - } - fgu.FailoverGroupUpdateProperties = &failoverGroupUpdateProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - fgu.Tags = tags - } - } - } - - return nil -} - -// FailoverGroupUpdateProperties properties of a failover group update. -type FailoverGroupUpdateProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // Databases - List of databases in the failover group. - Databases *[]string `json:"databases,omitempty"` -} - -// FirewallRule a server firewall rule. -type FirewallRule struct { - autorest.Response `json:"-"` - // ServerFirewallRuleProperties - Resource properties. - *ServerFirewallRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fr.ServerFirewallRuleProperties != nil { - objectMap["properties"] = fr.ServerFirewallRuleProperties - } - if fr.Name != nil { - objectMap["name"] = fr.Name - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err + return err } for k, v := range m { switch k { case "properties": if v != nil { - var serverFirewallRuleProperties ServerFirewallRuleProperties - err = json.Unmarshal(*v, &serverFirewallRuleProperties) + var extendedServerBlobAuditingPolicyProperties ExtendedServerBlobAuditingPolicyProperties + err = json.Unmarshal(*v, &extendedServerBlobAuditingPolicyProperties) if err != nil { return err } - fr.ServerFirewallRuleProperties = &serverFirewallRuleProperties + esbap.ExtendedServerBlobAuditingPolicyProperties = &extendedServerBlobAuditingPolicyProperties } case "id": if v != nil { @@ -8388,7 +8374,7 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - fr.ID = &ID + esbap.ID = &ID } case "name": if v != nil { @@ -8397,7 +8383,7 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - fr.Name = &name + esbap.Name = &name } case "type": if v != nil { @@ -8406,7 +8392,7 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - fr.Type = &typeVar + esbap.Type = &typeVar } } } @@ -8414,37 +8400,33 @@ func (fr *FirewallRule) UnmarshalJSON(body []byte) error { return nil } -// FirewallRuleList a list of server firewall rules. -type FirewallRuleList struct { - Values *[]FirewallRule `json:"values,omitempty"` -} - -// FirewallRuleListResult the response to a list firewall rules request -type FirewallRuleListResult struct { +// ExtendedServerBlobAuditingPolicyListResult a list of server extended auditing settings. +type ExtendedServerBlobAuditingPolicyListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]FirewallRule `json:"value,omitempty"` + Value *[]ExtendedServerBlobAuditingPolicy `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for FirewallRuleListResult. -func (frlr FirewallRuleListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicyListResult. +func (esbaplr ExtendedServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values. -type FirewallRuleListResultIterator struct { +// ExtendedServerBlobAuditingPolicyListResultIterator provides access to a complete listing of +// ExtendedServerBlobAuditingPolicy values. +type ExtendedServerBlobAuditingPolicyListResultIterator struct { i int - page FirewallRuleListResultPage + page ExtendedServerBlobAuditingPolicyListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ExtendedServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -8469,67 +8451,68 @@ func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *FirewallRuleListResultIterator) Next() error { +func (iter *ExtendedServerBlobAuditingPolicyListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FirewallRuleListResultIterator) NotDone() bool { +func (iter ExtendedServerBlobAuditingPolicyListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult { +func (iter ExtendedServerBlobAuditingPolicyListResultIterator) Response() ExtendedServerBlobAuditingPolicyListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter FirewallRuleListResultIterator) Value() FirewallRule { +func (iter ExtendedServerBlobAuditingPolicyListResultIterator) Value() ExtendedServerBlobAuditingPolicy { if !iter.page.NotDone() { - return FirewallRule{} + return ExtendedServerBlobAuditingPolicy{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the FirewallRuleListResultIterator type. -func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator { - return FirewallRuleListResultIterator{page: page} +// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultIterator type. +func NewExtendedServerBlobAuditingPolicyListResultIterator(page ExtendedServerBlobAuditingPolicyListResultPage) ExtendedServerBlobAuditingPolicyListResultIterator { + return ExtendedServerBlobAuditingPolicyListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (frlr FirewallRuleListResult) IsEmpty() bool { - return frlr.Value == nil || len(*frlr.Value) == 0 +func (esbaplr ExtendedServerBlobAuditingPolicyListResult) IsEmpty() bool { + return esbaplr.Value == nil || len(*esbaplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (frlr FirewallRuleListResult) hasNextLink() bool { - return frlr.NextLink != nil && len(*frlr.NextLink) != 0 +func (esbaplr ExtendedServerBlobAuditingPolicyListResult) hasNextLink() bool { + return esbaplr.NextLink != nil && len(*esbaplr.NextLink) != 0 } -// firewallRuleListResultPreparer prepares a request to retrieve the next set of results. +// extendedServerBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !frlr.hasNextLink() { +func (esbaplr ExtendedServerBlobAuditingPolicyListResult) extendedServerBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !esbaplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(frlr.NextLink))) + autorest.WithBaseURL(to.String(esbaplr.NextLink))) } -// FirewallRuleListResultPage contains a page of FirewallRule values. -type FirewallRuleListResultPage struct { - fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error) - frlr FirewallRuleListResult +// ExtendedServerBlobAuditingPolicyListResultPage contains a page of ExtendedServerBlobAuditingPolicy +// values. +type ExtendedServerBlobAuditingPolicyListResultPage struct { + fn func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error) + esbaplr ExtendedServerBlobAuditingPolicyListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ExtendedServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -8539,11 +8522,11 @@ func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (er }() } for { - next, err := page.fn(ctx, page.frlr) + next, err := page.fn(ctx, page.esbaplr) if err != nil { return err } - page.frlr = next + page.esbaplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -8554,45 +8537,152 @@ func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (er // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *FirewallRuleListResultPage) Next() error { +func (page *ExtendedServerBlobAuditingPolicyListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FirewallRuleListResultPage) NotDone() bool { - return !page.frlr.IsEmpty() +func (page ExtendedServerBlobAuditingPolicyListResultPage) NotDone() bool { + return !page.esbaplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page FirewallRuleListResultPage) Response() FirewallRuleListResult { - return page.frlr +func (page ExtendedServerBlobAuditingPolicyListResultPage) Response() ExtendedServerBlobAuditingPolicyListResult { + return page.esbaplr } // Values returns the slice of values for the current page or nil if there are no values. -func (page FirewallRuleListResultPage) Values() []FirewallRule { - if page.frlr.IsEmpty() { +func (page ExtendedServerBlobAuditingPolicyListResultPage) Values() []ExtendedServerBlobAuditingPolicy { + if page.esbaplr.IsEmpty() { return nil } - return *page.frlr.Value + return *page.esbaplr.Value } -// Creates a new instance of the FirewallRuleListResultPage type. -func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage { - return FirewallRuleListResultPage{ - fn: getNextPage, - frlr: cur, +// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultPage type. +func NewExtendedServerBlobAuditingPolicyListResultPage(cur ExtendedServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error)) ExtendedServerBlobAuditingPolicyListResultPage { + return ExtendedServerBlobAuditingPolicyListResultPage{ + fn: getNextPage, + esbaplr: cur, } } -// GeoBackupPolicy a database geo backup policy. -type GeoBackupPolicy struct { +// ExtendedServerBlobAuditingPolicyProperties properties of an extended server blob auditing policy. +type ExtendedServerBlobAuditingPolicyProperties struct { + // IsDevopsAuditEnabled - Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. + // In order to send the events to Azure Monitor, specify 'State' as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + // + // When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs category on the master database should also be created. + // + // Diagnostic Settings URI format: + // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + // + // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + IsDevopsAuditEnabled *bool `json:"isDevopsAuditEnabled,omitempty"` + // PredicateExpression - Specifies condition of where clause when creating an audit. + PredicateExpression *string `json:"predicateExpression,omitempty"` + // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. + RetentionDays *int32 `json:"retentionDays,omitempty"` + // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. + // + // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: + // + // BATCH_COMPLETED_GROUP, + // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + // FAILED_DATABASE_AUTHENTICATION_GROUP. + // + // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. + // + // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + // + // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + // BACKUP_RESTORE_GROUP + // DATABASE_LOGOUT_GROUP + // DATABASE_OBJECT_CHANGE_GROUP + // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + // DATABASE_OPERATION_GROUP + // DATABASE_PERMISSION_CHANGE_GROUP + // DATABASE_PRINCIPAL_CHANGE_GROUP + // DATABASE_PRINCIPAL_IMPERSONATION_GROUP + // DATABASE_ROLE_MEMBER_CHANGE_GROUP + // FAILED_DATABASE_AUTHENTICATION_GROUP + // SCHEMA_OBJECT_ACCESS_GROUP + // SCHEMA_OBJECT_CHANGE_GROUP + // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + // USER_CHANGE_PASSWORD_GROUP + // BATCH_STARTED_GROUP + // BATCH_COMPLETED_GROUP + // + // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. + // + // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + // + // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: + // SELECT + // UPDATE + // INSERT + // DELETE + // EXECUTE + // RECEIVE + // REFERENCES + // + // The general form for defining an action to be audited is: + // {action} ON {object} BY {principal} + // + // Note that in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + // + // For example: + // SELECT on dbo.myTable by public + // SELECT on DATABASE::myDatabase by public + // SELECT on SCHEMA::mySchema by public + // + // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` + // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. + IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` + // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. + // In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + // + // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. + // Note that for server level audit you should use the 'master' database as {databaseName}. + // + // Diagnostic Settings URI format: + // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + // + // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) + // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` + // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` + // State - Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' + State BlobAuditingPolicyState `json:"state,omitempty"` + // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + StorageEndpoint *string `json:"storageEndpoint,omitempty"` + // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. + // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. + // Prerequisites for using managed identity authentication: + // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. + // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. + StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` +} + +// FailoverGroup a failover group. +type FailoverGroup struct { autorest.Response `json:"-"` - // GeoBackupPolicyProperties - The properties of the geo backup policy. - *GeoBackupPolicyProperties `json:"properties,omitempty"` - // Kind - READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Backup policy location. + // Location - READ-ONLY; Resource location. Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // FailoverGroupProperties - Resource properties. + *FailoverGroupProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -8601,17 +8691,20 @@ type GeoBackupPolicy struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for GeoBackupPolicy. -func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for FailoverGroup. +func (fg FailoverGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if gbp.GeoBackupPolicyProperties != nil { - objectMap["properties"] = gbp.GeoBackupPolicyProperties + if fg.Tags != nil { + objectMap["tags"] = fg.Tags + } + if fg.FailoverGroupProperties != nil { + objectMap["properties"] = fg.FailoverGroupProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. -func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for FailoverGroup struct. +func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -8619,32 +8712,32 @@ func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "properties": + case "location": if v != nil { - var geoBackupPolicyProperties GeoBackupPolicyProperties - err = json.Unmarshal(*v, &geoBackupPolicyProperties) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - gbp.GeoBackupPolicyProperties = &geoBackupPolicyProperties + fg.Location = &location } - case "kind": + case "tags": if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - gbp.Kind = &kind + fg.Tags = tags } - case "location": + case "properties": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var failoverGroupProperties FailoverGroupProperties + err = json.Unmarshal(*v, &failoverGroupProperties) if err != nil { return err } - gbp.Location = &location + fg.FailoverGroupProperties = &failoverGroupProperties } case "id": if v != nil { @@ -8653,7 +8746,7 @@ func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - gbp.ID = &ID + fg.ID = &ID } case "name": if v != nil { @@ -8662,7 +8755,7 @@ func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - gbp.Name = &name + fg.Name = &name } case "type": if v != nil { @@ -8671,7 +8764,7 @@ func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - gbp.Type = &typeVar + fg.Type = &typeVar } } } @@ -8679,76 +8772,32 @@ func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { return nil } -// GeoBackupPolicyListResult the response to a list geo backup policies request. -type GeoBackupPolicyListResult struct { - autorest.Response `json:"-"` - // Value - The list of geo backup policies. - Value *[]GeoBackupPolicy `json:"value,omitempty"` -} - -// GeoBackupPolicyProperties the properties of the geo backup policy. -type GeoBackupPolicyProperties struct { - // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' - State GeoBackupPolicyState `json:"state,omitempty"` - // StorageType - READ-ONLY; The storage type of the geo backup policy. - StorageType *string `json:"storageType,omitempty"` -} - -// MarshalJSON is the custom marshaler for GeoBackupPolicyProperties. -func (gbpp GeoBackupPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gbpp.State != "" { - objectMap["state"] = gbpp.State - } - return json.Marshal(objectMap) -} - -// ImportExistingDatabaseDefinition contains the information necessary to perform import operation for -// existing database. -type ImportExistingDatabaseDefinition struct { - // StorageKeyType - Storage key type. Possible values include: 'StorageKeyTypeSharedAccessKey', 'StorageKeyTypeStorageAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - Storage key. - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` - // NetworkIsolation - Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` -} - -// ImportExportExtensionsOperationListResult import export operation extensions list. -type ImportExportExtensionsOperationListResult struct { +// FailoverGroupListResult a list of failover groups. +type FailoverGroupListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ImportExportExtensionsOperationResult `json:"value,omitempty"` + Value *[]FailoverGroup `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ImportExportExtensionsOperationListResult. -func (ieeolr ImportExportExtensionsOperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for FailoverGroupListResult. +func (fglr FailoverGroupListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ImportExportExtensionsOperationListResultIterator provides access to a complete listing of -// ImportExportExtensionsOperationResult values. -type ImportExportExtensionsOperationListResultIterator struct { +// FailoverGroupListResultIterator provides access to a complete listing of FailoverGroup values. +type FailoverGroupListResultIterator struct { i int - page ImportExportExtensionsOperationListResultPage + page FailoverGroupListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ImportExportExtensionsOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *FailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportExportExtensionsOperationListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -8773,68 +8822,67 @@ func (iter *ImportExportExtensionsOperationListResultIterator) NextWithContext(c // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ImportExportExtensionsOperationListResultIterator) Next() error { +func (iter *FailoverGroupListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ImportExportExtensionsOperationListResultIterator) NotDone() bool { +func (iter FailoverGroupListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ImportExportExtensionsOperationListResultIterator) Response() ImportExportExtensionsOperationListResult { +func (iter FailoverGroupListResultIterator) Response() FailoverGroupListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ImportExportExtensionsOperationListResultIterator) Value() ImportExportExtensionsOperationResult { +func (iter FailoverGroupListResultIterator) Value() FailoverGroup { if !iter.page.NotDone() { - return ImportExportExtensionsOperationResult{} + return FailoverGroup{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ImportExportExtensionsOperationListResultIterator type. -func NewImportExportExtensionsOperationListResultIterator(page ImportExportExtensionsOperationListResultPage) ImportExportExtensionsOperationListResultIterator { - return ImportExportExtensionsOperationListResultIterator{page: page} +// Creates a new instance of the FailoverGroupListResultIterator type. +func NewFailoverGroupListResultIterator(page FailoverGroupListResultPage) FailoverGroupListResultIterator { + return FailoverGroupListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (ieeolr ImportExportExtensionsOperationListResult) IsEmpty() bool { - return ieeolr.Value == nil || len(*ieeolr.Value) == 0 +func (fglr FailoverGroupListResult) IsEmpty() bool { + return fglr.Value == nil || len(*fglr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (ieeolr ImportExportExtensionsOperationListResult) hasNextLink() bool { - return ieeolr.NextLink != nil && len(*ieeolr.NextLink) != 0 +func (fglr FailoverGroupListResult) hasNextLink() bool { + return fglr.NextLink != nil && len(*fglr.NextLink) != 0 } -// importExportExtensionsOperationListResultPreparer prepares a request to retrieve the next set of results. +// failoverGroupListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ieeolr ImportExportExtensionsOperationListResult) importExportExtensionsOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ieeolr.hasNextLink() { +func (fglr FailoverGroupListResult) failoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !fglr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ieeolr.NextLink))) + autorest.WithBaseURL(to.String(fglr.NextLink))) } -// ImportExportExtensionsOperationListResultPage contains a page of ImportExportExtensionsOperationResult -// values. -type ImportExportExtensionsOperationListResultPage struct { - fn func(context.Context, ImportExportExtensionsOperationListResult) (ImportExportExtensionsOperationListResult, error) - ieeolr ImportExportExtensionsOperationListResult +// FailoverGroupListResultPage contains a page of FailoverGroup values. +type FailoverGroupListResultPage struct { + fn func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error) + fglr FailoverGroupListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ImportExportExtensionsOperationListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *FailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ImportExportExtensionsOperationListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -8844,11 +8892,11 @@ func (page *ImportExportExtensionsOperationListResultPage) NextWithContext(ctx c }() } for { - next, err := page.fn(ctx, page.ieeolr) + next, err := page.fn(ctx, page.fglr) if err != nil { return err } - page.ieeolr = next + page.fglr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -8859,304 +8907,398 @@ func (page *ImportExportExtensionsOperationListResultPage) NextWithContext(ctx c // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ImportExportExtensionsOperationListResultPage) Next() error { +func (page *FailoverGroupListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ImportExportExtensionsOperationListResultPage) NotDone() bool { - return !page.ieeolr.IsEmpty() +func (page FailoverGroupListResultPage) NotDone() bool { + return !page.fglr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ImportExportExtensionsOperationListResultPage) Response() ImportExportExtensionsOperationListResult { - return page.ieeolr +func (page FailoverGroupListResultPage) Response() FailoverGroupListResult { + return page.fglr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ImportExportExtensionsOperationListResultPage) Values() []ImportExportExtensionsOperationResult { - if page.ieeolr.IsEmpty() { +func (page FailoverGroupListResultPage) Values() []FailoverGroup { + if page.fglr.IsEmpty() { return nil } - return *page.ieeolr.Value + return *page.fglr.Value } -// Creates a new instance of the ImportExportExtensionsOperationListResultPage type. -func NewImportExportExtensionsOperationListResultPage(cur ImportExportExtensionsOperationListResult, getNextPage func(context.Context, ImportExportExtensionsOperationListResult) (ImportExportExtensionsOperationListResult, error)) ImportExportExtensionsOperationListResultPage { - return ImportExportExtensionsOperationListResultPage{ - fn: getNextPage, - ieeolr: cur, +// Creates a new instance of the FailoverGroupListResultPage type. +func NewFailoverGroupListResultPage(cur FailoverGroupListResult, getNextPage func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error)) FailoverGroupListResultPage { + return FailoverGroupListResultPage{ + fn: getNextPage, + fglr: cur, } } -// ImportExportExtensionsOperationResult an Extension operation result resource. -type ImportExportExtensionsOperationResult struct { - autorest.Response `json:"-"` - // ImportExportExtensionsOperationResultProperties - Resource properties. - *ImportExportExtensionsOperationResultProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// FailoverGroupProperties properties of a failover group. +type FailoverGroupProperties struct { + // ReadWriteEndpoint - Read-write endpoint of the failover group instance. + ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` + // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. + ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` + // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'FailoverGroupReplicationRolePrimary', 'FailoverGroupReplicationRoleSecondary' + ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` + // ReplicationState - READ-ONLY; Replication state of the failover group instance. + ReplicationState *string `json:"replicationState,omitempty"` + // PartnerServers - List of partner server information for the failover group. + PartnerServers *[]PartnerInfo `json:"partnerServers,omitempty"` + // Databases - List of databases in the failover group. + Databases *[]string `json:"databases,omitempty"` } -// MarshalJSON is the custom marshaler for ImportExportExtensionsOperationResult. -func (ieeor ImportExportExtensionsOperationResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for FailoverGroupProperties. +func (fgp FailoverGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ieeor.ImportExportExtensionsOperationResultProperties != nil { - objectMap["properties"] = ieeor.ImportExportExtensionsOperationResultProperties + if fgp.ReadWriteEndpoint != nil { + objectMap["readWriteEndpoint"] = fgp.ReadWriteEndpoint } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImportExportExtensionsOperationResult struct. -func (ieeor *ImportExportExtensionsOperationResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err + if fgp.ReadOnlyEndpoint != nil { + objectMap["readOnlyEndpoint"] = fgp.ReadOnlyEndpoint } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var importExportExtensionsOperationResultProperties ImportExportExtensionsOperationResultProperties - err = json.Unmarshal(*v, &importExportExtensionsOperationResultProperties) - if err != nil { - return err - } - ieeor.ImportExportExtensionsOperationResultProperties = &importExportExtensionsOperationResultProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ieeor.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ieeor.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ieeor.Type = &typeVar - } - } + if fgp.PartnerServers != nil { + objectMap["partnerServers"] = fgp.PartnerServers } - - return nil + if fgp.Databases != nil { + objectMap["databases"] = fgp.Databases + } + return json.Marshal(objectMap) } -// ImportExportExtensionsOperationResultProperties contains the operation result properties for -// import/export operation. -type ImportExportExtensionsOperationResultProperties struct { - // RequestID - READ-ONLY; Request Id. - RequestID *uuid.UUID `json:"requestId,omitempty"` - // RequestType - READ-ONLY; Request type. - RequestType *string `json:"requestType,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified time. - LastModifiedTime *string `json:"lastModifiedTime,omitempty"` - // ServerName - READ-ONLY; Server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; Database name. - DatabaseName *string `json:"databaseName,omitempty"` - // Status - READ-ONLY; Operation status. - Status *string `json:"status,omitempty"` - // ErrorMessage - READ-ONLY; Error message. - ErrorMessage *string `json:"errorMessage,omitempty"` +// FailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. +type FailoverGroupReadOnlyEndpoint struct { + // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' + FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` } -// MarshalJSON is the custom marshaler for ImportExportExtensionsOperationResultProperties. -func (ieeorp ImportExportExtensionsOperationResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) +// FailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. +type FailoverGroupReadWriteEndpoint struct { + // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'ReadWriteEndpointFailoverPolicyManual', 'ReadWriteEndpointFailoverPolicyAutomatic' + FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` + // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` } -// ImportExportOperationResult an ImportExport operation result resource. -type ImportExportOperationResult struct { - autorest.Response `json:"-"` - // ImportExportOperationResultProperties - Resource properties. - *ImportExportOperationResultProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// FailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FailoverGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FailoverGroupsClient) (FailoverGroup, error) } -// MarshalJSON is the custom marshaler for ImportExportOperationResult. -func (ieor ImportExportOperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ieor.ImportExportOperationResultProperties != nil { - objectMap["properties"] = ieor.ImportExportOperationResultProperties +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FailoverGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - return json.Marshal(objectMap) + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// UnmarshalJSON is the custom unmarshaler for ImportExportOperationResult struct. -func (ieor *ImportExportOperationResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) +// result is the default implementation for FailoverGroupsCreateOrUpdateFuture.Result. +func (future *FailoverGroupsCreateOrUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) if err != nil { - return err + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var importExportOperationResultProperties ImportExportOperationResultProperties - err = json.Unmarshal(*v, &importExportOperationResultProperties) - if err != nil { - return err - } - ieor.ImportExportOperationResultProperties = &importExportOperationResultProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ieor.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ieor.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ieor.Type = &typeVar - } + if !done { + fg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { + fg, err = client.CreateOrUpdateResponder(fg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") } } - - return nil + return } -// ImportExportOperationResultProperties contains the operation result properties for import/export +// FailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running // operation. -type ImportExportOperationResultProperties struct { - // RequestID - READ-ONLY; Request Id. - RequestID *uuid.UUID `json:"requestId,omitempty"` - // RequestType - READ-ONLY; Request type. - RequestType *string `json:"requestType,omitempty"` - // QueuedTime - READ-ONLY; Queued time. - QueuedTime *string `json:"queuedTime,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified time. - LastModifiedTime *string `json:"lastModifiedTime,omitempty"` - // BlobURI - READ-ONLY; Blob Uri. - BlobURI *string `json:"blobUri,omitempty"` - // ServerName - READ-ONLY; Server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; Database name. - DatabaseName *string `json:"databaseName,omitempty"` - // Status - READ-ONLY; Operation status. - Status *string `json:"status,omitempty"` - // ErrorMessage - READ-ONLY; Error message. - ErrorMessage *string `json:"errorMessage,omitempty"` - // PrivateEndpointConnections - READ-ONLY; Gets the status of private endpoints associated with this request. - PrivateEndpointConnections *[]PrivateEndpointConnectionRequestStatus `json:"privateEndpointConnections,omitempty"` +type FailoverGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FailoverGroupsClient) (autorest.Response, error) } -// MarshalJSON is the custom marshaler for ImportExportOperationResultProperties. -func (ieorp ImportExportOperationResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FailoverGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// ImportNewDatabaseDefinition contains the information necessary to perform import operation for new -// database. -type ImportNewDatabaseDefinition struct { - // DatabaseName - Name of the import database. - DatabaseName *string `json:"databaseName,omitempty"` - // Edition - Edition of the import database. - Edition *string `json:"edition,omitempty"` - // ServiceObjectiveName - Service level objective name of the import database. - ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` - // MaxSizeBytes - Max size in bytes for the import database. - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - // StorageKeyType - Storage key type. Possible values include: 'StorageKeyTypeSharedAccessKey', 'StorageKeyTypeStorageAccessKey' - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - // StorageKey - Storage key. - StorageKey *string `json:"storageKey,omitempty"` - // StorageURI - Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` - // AdministratorLogin - Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // AuthenticationType - Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` - // NetworkIsolation - Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` +// result is the default implementation for FailoverGroupsDeleteFuture.Result. +func (future *FailoverGroupsDeleteFuture) result(client FailoverGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return } -// InstanceFailoverGroup an instance failover group. -type InstanceFailoverGroup struct { - autorest.Response `json:"-"` - // InstanceFailoverGroupProperties - Resource properties. - *InstanceFailoverGroupProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// FailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FailoverGroupsFailoverFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FailoverGroupsClient) (FailoverGroup, error) } -// MarshalJSON is the custom marshaler for InstanceFailoverGroup. -func (ifg InstanceFailoverGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ifg.InstanceFailoverGroupProperties != nil { - objectMap["properties"] = ifg.InstanceFailoverGroupProperties +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FailoverGroupsFailoverFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - return json.Marshal(objectMap) + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// UnmarshalJSON is the custom unmarshaler for InstanceFailoverGroup struct. -func (ifg *InstanceFailoverGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) +// result is the default implementation for FailoverGroupsFailoverFuture.Result. +func (future *FailoverGroupsFailoverFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) if err != nil { + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsFailoverFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { + fg, err = client.FailoverResponder(fg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", fg.Response.Response, "Failure responding to request") + } + } + return +} + +// FailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type FailoverGroupsForceFailoverAllowDataLossFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FailoverGroupsClient) (FailoverGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FailoverGroupsForceFailoverAllowDataLossFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { return err } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var instanceFailoverGroupProperties InstanceFailoverGroupProperties - err = json.Unmarshal(*v, &instanceFailoverGroupProperties) - if err != nil { - return err - } - ifg.InstanceFailoverGroupProperties = &instanceFailoverGroupProperties + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FailoverGroupsForceFailoverAllowDataLossFuture.Result. +func (future *FailoverGroupsForceFailoverAllowDataLossFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsForceFailoverAllowDataLossFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { + fg, err = client.ForceFailoverAllowDataLossResponder(fg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", fg.Response.Response, "Failure responding to request") + } + } + return +} + +// FailoverGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FailoverGroupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FailoverGroupsClient) (FailoverGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FailoverGroupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FailoverGroupsUpdateFuture.Result. +func (future *FailoverGroupsUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { + fg, err = client.UpdateResponder(fg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") + } + } + return +} + +// FailoverGroupUpdate a failover group update request. +type FailoverGroupUpdate struct { + // FailoverGroupUpdateProperties - Resource properties. + *FailoverGroupUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for FailoverGroupUpdate. +func (fgu FailoverGroupUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fgu.FailoverGroupUpdateProperties != nil { + objectMap["properties"] = fgu.FailoverGroupUpdateProperties + } + if fgu.Tags != nil { + objectMap["tags"] = fgu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FailoverGroupUpdate struct. +func (fgu *FailoverGroupUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var failoverGroupUpdateProperties FailoverGroupUpdateProperties + err = json.Unmarshal(*v, &failoverGroupUpdateProperties) + if err != nil { + return err + } + fgu.FailoverGroupUpdateProperties = &failoverGroupUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + fgu.Tags = tags + } + } + } + + return nil +} + +// FailoverGroupUpdateProperties properties of a failover group update. +type FailoverGroupUpdateProperties struct { + // ReadWriteEndpoint - Read-write endpoint of the failover group instance. + ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` + // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. + ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` + // Databases - List of databases in the failover group. + Databases *[]string `json:"databases,omitempty"` +} + +// FirewallRule a server firewall rule. +type FirewallRule struct { + autorest.Response `json:"-"` + // ServerFirewallRuleProperties - Resource properties. + *ServerFirewallRuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallRule. +func (fr FirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fr.ServerFirewallRuleProperties != nil { + objectMap["properties"] = fr.ServerFirewallRuleProperties + } + if fr.Name != nil { + objectMap["name"] = fr.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. +func (fr *FirewallRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serverFirewallRuleProperties ServerFirewallRuleProperties + err = json.Unmarshal(*v, &serverFirewallRuleProperties) + if err != nil { + return err + } + fr.ServerFirewallRuleProperties = &serverFirewallRuleProperties } case "id": if v != nil { @@ -9165,7 +9307,7 @@ func (ifg *InstanceFailoverGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - ifg.ID = &ID + fr.ID = &ID } case "name": if v != nil { @@ -9174,7 +9316,7 @@ func (ifg *InstanceFailoverGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - ifg.Name = &name + fr.Name = &name } case "type": if v != nil { @@ -9183,7 +9325,7 @@ func (ifg *InstanceFailoverGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - ifg.Type = &typeVar + fr.Type = &typeVar } } } @@ -9191,33 +9333,37 @@ func (ifg *InstanceFailoverGroup) UnmarshalJSON(body []byte) error { return nil } -// InstanceFailoverGroupListResult a list of instance failover groups. -type InstanceFailoverGroupListResult struct { +// FirewallRuleList a list of server firewall rules. +type FirewallRuleList struct { + Values *[]FirewallRule `json:"values,omitempty"` +} + +// FirewallRuleListResult the response to a list firewall rules request +type FirewallRuleListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]InstanceFailoverGroup `json:"value,omitempty"` + Value *[]FirewallRule `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for InstanceFailoverGroupListResult. -func (ifglr InstanceFailoverGroupListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for FirewallRuleListResult. +func (frlr FirewallRuleListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// InstanceFailoverGroupListResultIterator provides access to a complete listing of InstanceFailoverGroup -// values. -type InstanceFailoverGroupListResultIterator struct { +// FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values. +type FirewallRuleListResultIterator struct { i int - page InstanceFailoverGroupListResultPage + page FirewallRuleListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *InstanceFailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -9242,67 +9388,67 @@ func (iter *InstanceFailoverGroupListResultIterator) NextWithContext(ctx context // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *InstanceFailoverGroupListResultIterator) Next() error { +func (iter *FirewallRuleListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InstanceFailoverGroupListResultIterator) NotDone() bool { +func (iter FirewallRuleListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter InstanceFailoverGroupListResultIterator) Response() InstanceFailoverGroupListResult { +func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter InstanceFailoverGroupListResultIterator) Value() InstanceFailoverGroup { +func (iter FirewallRuleListResultIterator) Value() FirewallRule { if !iter.page.NotDone() { - return InstanceFailoverGroup{} + return FirewallRule{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the InstanceFailoverGroupListResultIterator type. -func NewInstanceFailoverGroupListResultIterator(page InstanceFailoverGroupListResultPage) InstanceFailoverGroupListResultIterator { - return InstanceFailoverGroupListResultIterator{page: page} +// Creates a new instance of the FirewallRuleListResultIterator type. +func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator { + return FirewallRuleListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (ifglr InstanceFailoverGroupListResult) IsEmpty() bool { - return ifglr.Value == nil || len(*ifglr.Value) == 0 +func (frlr FirewallRuleListResult) IsEmpty() bool { + return frlr.Value == nil || len(*frlr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (ifglr InstanceFailoverGroupListResult) hasNextLink() bool { - return ifglr.NextLink != nil && len(*ifglr.NextLink) != 0 +func (frlr FirewallRuleListResult) hasNextLink() bool { + return frlr.NextLink != nil && len(*frlr.NextLink) != 0 } -// instanceFailoverGroupListResultPreparer prepares a request to retrieve the next set of results. +// firewallRuleListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ifglr InstanceFailoverGroupListResult) instanceFailoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ifglr.hasNextLink() { +func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !frlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ifglr.NextLink))) + autorest.WithBaseURL(to.String(frlr.NextLink))) } -// InstanceFailoverGroupListResultPage contains a page of InstanceFailoverGroup values. -type InstanceFailoverGroupListResultPage struct { - fn func(context.Context, InstanceFailoverGroupListResult) (InstanceFailoverGroupListResult, error) - ifglr InstanceFailoverGroupListResult +// FirewallRuleListResultPage contains a page of FirewallRule values. +type FirewallRuleListResultPage struct { + fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error) + frlr FirewallRuleListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *InstanceFailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -9312,11 +9458,11 @@ func (page *InstanceFailoverGroupListResultPage) NextWithContext(ctx context.Con }() } for { - next, err := page.fn(ctx, page.ifglr) + next, err := page.fn(ctx, page.frlr) if err != nil { return err } - page.ifglr = next + page.frlr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -9327,435 +9473,201 @@ func (page *InstanceFailoverGroupListResultPage) NextWithContext(ctx context.Con // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *InstanceFailoverGroupListResultPage) Next() error { +func (page *FirewallRuleListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InstanceFailoverGroupListResultPage) NotDone() bool { - return !page.ifglr.IsEmpty() +func (page FirewallRuleListResultPage) NotDone() bool { + return !page.frlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page InstanceFailoverGroupListResultPage) Response() InstanceFailoverGroupListResult { - return page.ifglr +func (page FirewallRuleListResultPage) Response() FirewallRuleListResult { + return page.frlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page InstanceFailoverGroupListResultPage) Values() []InstanceFailoverGroup { - if page.ifglr.IsEmpty() { +func (page FirewallRuleListResultPage) Values() []FirewallRule { + if page.frlr.IsEmpty() { return nil } - return *page.ifglr.Value + return *page.frlr.Value } -// Creates a new instance of the InstanceFailoverGroupListResultPage type. -func NewInstanceFailoverGroupListResultPage(cur InstanceFailoverGroupListResult, getNextPage func(context.Context, InstanceFailoverGroupListResult) (InstanceFailoverGroupListResult, error)) InstanceFailoverGroupListResultPage { - return InstanceFailoverGroupListResultPage{ - fn: getNextPage, - ifglr: cur, +// Creates a new instance of the FirewallRuleListResultPage type. +func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage { + return FirewallRuleListResultPage{ + fn: getNextPage, + frlr: cur, } } -// InstanceFailoverGroupProperties properties of a instance failover group. -type InstanceFailoverGroupProperties struct { - // ReadWriteEndpoint - Read-write endpoint of the failover group instance. - ReadWriteEndpoint *InstanceFailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` - // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *InstanceFailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` - // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'InstanceFailoverGroupReplicationRolePrimary', 'InstanceFailoverGroupReplicationRoleSecondary' - ReplicationRole InstanceFailoverGroupReplicationRole `json:"replicationRole,omitempty"` - // ReplicationState - READ-ONLY; Replication state of the failover group instance. - ReplicationState *string `json:"replicationState,omitempty"` - // PartnerRegions - Partner region information for the failover group. - PartnerRegions *[]PartnerRegionInfo `json:"partnerRegions,omitempty"` - // ManagedInstancePairs - List of managed instance pairs in the failover group. - ManagedInstancePairs *[]ManagedInstancePairInfo `json:"managedInstancePairs,omitempty"` +// GeoBackupPolicy a database geo backup policy. +type GeoBackupPolicy struct { + autorest.Response `json:"-"` + // GeoBackupPolicyProperties - The properties of the geo backup policy. + *GeoBackupPolicyProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Backup policy location. + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for InstanceFailoverGroupProperties. -func (ifgp InstanceFailoverGroupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for GeoBackupPolicy. +func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ifgp.ReadWriteEndpoint != nil { - objectMap["readWriteEndpoint"] = ifgp.ReadWriteEndpoint - } - if ifgp.ReadOnlyEndpoint != nil { - objectMap["readOnlyEndpoint"] = ifgp.ReadOnlyEndpoint - } - if ifgp.PartnerRegions != nil { - objectMap["partnerRegions"] = ifgp.PartnerRegions - } - if ifgp.ManagedInstancePairs != nil { - objectMap["managedInstancePairs"] = ifgp.ManagedInstancePairs + if gbp.GeoBackupPolicyProperties != nil { + objectMap["properties"] = gbp.GeoBackupPolicyProperties } return json.Marshal(objectMap) } -// InstanceFailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. -type InstanceFailoverGroupReadOnlyEndpoint struct { - // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' - FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` -} - -// InstanceFailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. -type InstanceFailoverGroupReadWriteEndpoint struct { - // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'ReadWriteEndpointFailoverPolicyManual', 'ReadWriteEndpointFailoverPolicyAutomatic' - FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` - // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. - FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` -} - -// InstanceFailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InstanceFailoverGroupsCreateOrUpdateFuture.Result. -func (future *InstanceFailoverGroupsCreateOrUpdateFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. +func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsCreateOrUpdateFuture") - return + return err } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.CreateOrUpdateResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsCreateOrUpdateFuture", "Result", ifg.Response.Response, "Failure responding to request") + for k, v := range m { + switch k { + case "properties": + if v != nil { + var geoBackupPolicyProperties GeoBackupPolicyProperties + err = json.Unmarshal(*v, &geoBackupPolicyProperties) + if err != nil { + return err + } + gbp.GeoBackupPolicyProperties = &geoBackupPolicyProperties + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + gbp.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + gbp.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gbp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gbp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gbp.Type = &typeVar + } } } - return -} - -// InstanceFailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (autorest.Response, error) -} -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result return nil } -// result is the default implementation for InstanceFailoverGroupsDeleteFuture.Result. -func (future *InstanceFailoverGroupsDeleteFuture) result(client InstanceFailoverGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return +// GeoBackupPolicyListResult the response to a list geo backup policies request. +type GeoBackupPolicyListResult struct { + autorest.Response `json:"-"` + // Value - The list of geo backup policies. + Value *[]GeoBackupPolicy `json:"value,omitempty"` } -// InstanceFailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstanceFailoverGroupsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) +// GeoBackupPolicyProperties the properties of the geo backup policy. +type GeoBackupPolicyProperties struct { + // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' + State GeoBackupPolicyState `json:"state,omitempty"` + // StorageType - READ-ONLY; The storage type of the geo backup policy. + StorageType *string `json:"storageType,omitempty"` } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsFailoverFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// MarshalJSON is the custom marshaler for GeoBackupPolicyProperties. +func (gbpp GeoBackupPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gbpp.State != "" { + objectMap["state"] = gbpp.State } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return json.Marshal(objectMap) } -// result is the default implementation for InstanceFailoverGroupsFailoverFuture.Result. -func (future *InstanceFailoverGroupsFailoverFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsFailoverFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.FailoverResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsFailoverFuture", "Result", ifg.Response.Response, "Failure responding to request") - } - } - return -} - -// InstanceFailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type InstanceFailoverGroupsForceFailoverAllowDataLossFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for InstanceFailoverGroupsForceFailoverAllowDataLossFuture.Result. -func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ifg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { - ifg, err = client.ForceFailoverAllowDataLossResponder(ifg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture", "Result", ifg.Response.Response, "Failure responding to request") - } - } - return -} - -// InstancePool an Azure SQL instance pool. -type InstancePool struct { - autorest.Response `json:"-"` - // Sku - The name and tier of the SKU. - Sku *Sku `json:"sku,omitempty"` - // InstancePoolProperties - Resource properties. - *InstancePoolProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstancePool. -func (IP InstancePool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.Sku != nil { - objectMap["sku"] = IP.Sku - } - if IP.InstancePoolProperties != nil { - objectMap["properties"] = IP.InstancePoolProperties - } - if IP.Location != nil { - objectMap["location"] = IP.Location - } - if IP.Tags != nil { - objectMap["tags"] = IP.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InstancePool struct. -func (IP *InstancePool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - IP.Sku = &sku - } - case "properties": - if v != nil { - var instancePoolProperties InstancePoolProperties - err = json.Unmarshal(*v, &instancePoolProperties) - if err != nil { - return err - } - IP.InstancePoolProperties = &instancePoolProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - IP.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - IP.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - IP.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - IP.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - IP.Type = &typeVar - } - } - } - - return nil -} - -// InstancePoolEditionCapability the instance pool capability -type InstancePoolEditionCapability struct { - // Name - READ-ONLY; The instance pool version name. - Name *string `json:"name,omitempty"` - // SupportedFamilies - READ-ONLY; The supported families. - SupportedFamilies *[]InstancePoolFamilyCapability `json:"supportedFamilies,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstancePoolEditionCapability. -func (ipec InstancePoolEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipec.Reason != nil { - objectMap["reason"] = ipec.Reason - } - return json.Marshal(objectMap) -} - -// InstancePoolFamilyCapability the instance pool family capability. -type InstancePoolFamilyCapability struct { - // Name - READ-ONLY; Family name. - Name *string `json:"name,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // SupportedVcoresValues - READ-ONLY; List of supported virtual cores values. - SupportedVcoresValues *[]InstancePoolVcoresCapability `json:"supportedVcoresValues,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstancePoolFamilyCapability. -func (ipfc InstancePoolFamilyCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipfc.Reason != nil { - objectMap["reason"] = ipfc.Reason - } - return json.Marshal(objectMap) +// ImportExistingDatabaseDefinition contains the information necessary to perform import operation for +// existing database. +type ImportExistingDatabaseDefinition struct { + // StorageKeyType - Storage key type. Possible values include: 'StorageKeyTypeSharedAccessKey', 'StorageKeyTypeStorageAccessKey' + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + // StorageKey - Storage key. + StorageKey *string `json:"storageKey,omitempty"` + // StorageURI - Storage Uri. + StorageURI *string `json:"storageUri,omitempty"` + // AdministratorLogin - Administrator login name. + AdministratorLogin *string `json:"administratorLogin,omitempty"` + // AdministratorLoginPassword - Administrator login password. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthenticationType - Authentication type. + AuthenticationType *string `json:"authenticationType,omitempty"` + // NetworkIsolation - Optional resource information to enable network isolation for request. + NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` } -// InstancePoolListResult a list of Azure SQL instance pools. -type InstancePoolListResult struct { +// ImportExportExtensionsOperationListResult import export operation extensions list. +type ImportExportExtensionsOperationListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]InstancePool `json:"value,omitempty"` + Value *[]ImportExportExtensionsOperationResult `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for InstancePoolListResult. -func (iplr InstancePoolListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ImportExportExtensionsOperationListResult. +func (ieeolr ImportExportExtensionsOperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// InstancePoolListResultIterator provides access to a complete listing of InstancePool values. -type InstancePoolListResultIterator struct { +// ImportExportExtensionsOperationListResultIterator provides access to a complete listing of +// ImportExportExtensionsOperationResult values. +type ImportExportExtensionsOperationListResultIterator struct { i int - page InstancePoolListResultPage + page ImportExportExtensionsOperationListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *InstancePoolListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ImportExportExtensionsOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ImportExportExtensionsOperationListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -9780,67 +9692,68 @@ func (iter *InstancePoolListResultIterator) NextWithContext(ctx context.Context) // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *InstancePoolListResultIterator) Next() error { +func (iter *ImportExportExtensionsOperationListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter InstancePoolListResultIterator) NotDone() bool { +func (iter ImportExportExtensionsOperationListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter InstancePoolListResultIterator) Response() InstancePoolListResult { +func (iter ImportExportExtensionsOperationListResultIterator) Response() ImportExportExtensionsOperationListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter InstancePoolListResultIterator) Value() InstancePool { +func (iter ImportExportExtensionsOperationListResultIterator) Value() ImportExportExtensionsOperationResult { if !iter.page.NotDone() { - return InstancePool{} + return ImportExportExtensionsOperationResult{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the InstancePoolListResultIterator type. -func NewInstancePoolListResultIterator(page InstancePoolListResultPage) InstancePoolListResultIterator { - return InstancePoolListResultIterator{page: page} +// Creates a new instance of the ImportExportExtensionsOperationListResultIterator type. +func NewImportExportExtensionsOperationListResultIterator(page ImportExportExtensionsOperationListResultPage) ImportExportExtensionsOperationListResultIterator { + return ImportExportExtensionsOperationListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (iplr InstancePoolListResult) IsEmpty() bool { - return iplr.Value == nil || len(*iplr.Value) == 0 +func (ieeolr ImportExportExtensionsOperationListResult) IsEmpty() bool { + return ieeolr.Value == nil || len(*ieeolr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (iplr InstancePoolListResult) hasNextLink() bool { - return iplr.NextLink != nil && len(*iplr.NextLink) != 0 +func (ieeolr ImportExportExtensionsOperationListResult) hasNextLink() bool { + return ieeolr.NextLink != nil && len(*ieeolr.NextLink) != 0 } -// instancePoolListResultPreparer prepares a request to retrieve the next set of results. +// importExportExtensionsOperationListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (iplr InstancePoolListResult) instancePoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !iplr.hasNextLink() { +func (ieeolr ImportExportExtensionsOperationListResult) importExportExtensionsOperationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ieeolr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(iplr.NextLink))) + autorest.WithBaseURL(to.String(ieeolr.NextLink))) } -// InstancePoolListResultPage contains a page of InstancePool values. -type InstancePoolListResultPage struct { - fn func(context.Context, InstancePoolListResult) (InstancePoolListResult, error) - iplr InstancePoolListResult +// ImportExportExtensionsOperationListResultPage contains a page of ImportExportExtensionsOperationResult +// values. +type ImportExportExtensionsOperationListResultPage struct { + fn func(context.Context, ImportExportExtensionsOperationListResult) (ImportExportExtensionsOperationListResult, error) + ieeolr ImportExportExtensionsOperationListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *InstancePoolListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ImportExportExtensionsOperationListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ImportExportExtensionsOperationListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -9850,11 +9763,11 @@ func (page *InstancePoolListResultPage) NextWithContext(ctx context.Context) (er }() } for { - next, err := page.fn(ctx, page.iplr) + next, err := page.fn(ctx, page.ieeolr) if err != nil { return err } - page.iplr = next + page.ieeolr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -9865,231 +9778,158 @@ func (page *InstancePoolListResultPage) NextWithContext(ctx context.Context) (er // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *InstancePoolListResultPage) Next() error { +func (page *ImportExportExtensionsOperationListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page InstancePoolListResultPage) NotDone() bool { - return !page.iplr.IsEmpty() +func (page ImportExportExtensionsOperationListResultPage) NotDone() bool { + return !page.ieeolr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page InstancePoolListResultPage) Response() InstancePoolListResult { - return page.iplr +func (page ImportExportExtensionsOperationListResultPage) Response() ImportExportExtensionsOperationListResult { + return page.ieeolr } // Values returns the slice of values for the current page or nil if there are no values. -func (page InstancePoolListResultPage) Values() []InstancePool { - if page.iplr.IsEmpty() { +func (page ImportExportExtensionsOperationListResultPage) Values() []ImportExportExtensionsOperationResult { + if page.ieeolr.IsEmpty() { return nil } - return *page.iplr.Value + return *page.ieeolr.Value } -// Creates a new instance of the InstancePoolListResultPage type. -func NewInstancePoolListResultPage(cur InstancePoolListResult, getNextPage func(context.Context, InstancePoolListResult) (InstancePoolListResult, error)) InstancePoolListResultPage { - return InstancePoolListResultPage{ - fn: getNextPage, - iplr: cur, +// Creates a new instance of the ImportExportExtensionsOperationListResultPage type. +func NewImportExportExtensionsOperationListResultPage(cur ImportExportExtensionsOperationListResult, getNextPage func(context.Context, ImportExportExtensionsOperationListResult) (ImportExportExtensionsOperationListResult, error)) ImportExportExtensionsOperationListResultPage { + return ImportExportExtensionsOperationListResultPage{ + fn: getNextPage, + ieeolr: cur, } } -// InstancePoolProperties properties of an instance pool. -type InstancePoolProperties struct { - // SubnetID - Resource ID of the subnet to place this instance pool in. - SubnetID *string `json:"subnetId,omitempty"` - // VCores - Count of vCores belonging to this instance pool. - VCores *int32 `json:"vCores,omitempty"` - // LicenseType - The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'InstancePoolLicenseTypeLicenseIncluded', 'InstancePoolLicenseTypeBasePrice' - LicenseType InstancePoolLicenseType `json:"licenseType,omitempty"` -} - -// InstancePoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InstancePoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstancePoolsClient) (InstancePool, error) +// ImportExportExtensionsOperationResult an Extension operation result resource. +type ImportExportExtensionsOperationResult struct { + autorest.Response `json:"-"` + // ImportExportExtensionsOperationResultProperties - Resource properties. + *ImportExportExtensionsOperationResultProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstancePoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// MarshalJSON is the custom marshaler for ImportExportExtensionsOperationResult. +func (ieeor ImportExportExtensionsOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ieeor.ImportExportExtensionsOperationResultProperties != nil { + objectMap["properties"] = ieeor.ImportExportExtensionsOperationResultProperties } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return json.Marshal(objectMap) } -// result is the default implementation for InstancePoolsCreateOrUpdateFuture.Result. -func (future *InstancePoolsCreateOrUpdateFuture) result(client InstancePoolsClient) (IP InstancePool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// UnmarshalJSON is the custom unmarshaler for ImportExportExtensionsOperationResult struct. +func (ieeor *ImportExportExtensionsOperationResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - IP.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsCreateOrUpdateFuture") - return + return err } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { - IP, err = client.CreateOrUpdateResponder(IP.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", IP.Response.Response, "Failure responding to request") + for k, v := range m { + switch k { + case "properties": + if v != nil { + var importExportExtensionsOperationResultProperties ImportExportExtensionsOperationResultProperties + err = json.Unmarshal(*v, &importExportExtensionsOperationResultProperties) + if err != nil { + return err + } + ieeor.ImportExportExtensionsOperationResultProperties = &importExportExtensionsOperationResultProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ieeor.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ieeor.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ieeor.Type = &typeVar + } } } - return -} -// InstancePoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type InstancePoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstancePoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstancePoolsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result return nil } -// result is the default implementation for InstancePoolsDeleteFuture.Result. -func (future *InstancePoolsDeleteFuture) result(client InstancePoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsDeleteFuture") - return - } - ar.Response = future.Response() - return +// ImportExportExtensionsOperationResultProperties contains the operation result properties for +// import/export operation. +type ImportExportExtensionsOperationResultProperties struct { + // RequestID - READ-ONLY; Request Id. + RequestID *uuid.UUID `json:"requestId,omitempty"` + // RequestType - READ-ONLY; Request type. + RequestType *string `json:"requestType,omitempty"` + // LastModifiedTime - READ-ONLY; Last modified time. + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + // ServerName - READ-ONLY; Server name. + ServerName *string `json:"serverName,omitempty"` + // DatabaseName - READ-ONLY; Database name. + DatabaseName *string `json:"databaseName,omitempty"` + // Status - READ-ONLY; Operation status. + Status *string `json:"status,omitempty"` + // ErrorMessage - READ-ONLY; Error message. + ErrorMessage *string `json:"errorMessage,omitempty"` } -// InstancePoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type InstancePoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(InstancePoolsClient) (InstancePool, error) +// MarshalJSON is the custom marshaler for ImportExportExtensionsOperationResultProperties. +func (ieeorp ImportExportExtensionsOperationResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *InstancePoolsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// ImportExportOperationResult an ImportExport operation result resource. +type ImportExportOperationResult struct { + autorest.Response `json:"-"` + // ImportExportOperationResultProperties - Resource properties. + *ImportExportOperationResultProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// result is the default implementation for InstancePoolsUpdateFuture.Result. -func (future *InstancePoolsUpdateFuture) result(client InstancePoolsClient) (IP InstancePool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - IP.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { - IP, err = client.UpdateResponder(IP.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", IP.Response.Response, "Failure responding to request") - } - } - return -} - -// InstancePoolUpdate an update to an Instance pool. -type InstancePoolUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for InstancePoolUpdate. -func (ipu InstancePoolUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipu.Tags != nil { - objectMap["tags"] = ipu.Tags - } - return json.Marshal(objectMap) -} - -// InstancePoolVcoresCapability the managed instance virtual cores capability. -type InstancePoolVcoresCapability struct { - // Name - READ-ONLY; The virtual cores identifier. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; The virtual cores value. - Value *int32 `json:"value,omitempty"` - // StorageLimit - READ-ONLY; Storage limit. - StorageLimit *MaxSizeCapability `json:"storageLimit,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for InstancePoolVcoresCapability. -func (ipvc InstancePoolVcoresCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipvc.Reason != nil { - objectMap["reason"] = ipvc.Reason - } - return json.Marshal(objectMap) -} - -// Job a job. -type Job struct { - autorest.Response `json:"-"` - // JobProperties - Resource properties. - *JobProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Job. -func (j Job) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ImportExportOperationResult. +func (ieor ImportExportOperationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if j.JobProperties != nil { - objectMap["properties"] = j.JobProperties + if ieor.ImportExportOperationResultProperties != nil { + objectMap["properties"] = ieor.ImportExportOperationResultProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Job struct. -func (j *Job) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ImportExportOperationResult struct. +func (ieor *ImportExportOperationResult) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -10099,12 +9939,12 @@ func (j *Job) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var jobProperties JobProperties - err = json.Unmarshal(*v, &jobProperties) + var importExportOperationResultProperties ImportExportOperationResultProperties + err = json.Unmarshal(*v, &importExportOperationResultProperties) if err != nil { return err } - j.JobProperties = &jobProperties + ieor.ImportExportOperationResultProperties = &importExportOperationResultProperties } case "id": if v != nil { @@ -10113,7 +9953,7 @@ func (j *Job) UnmarshalJSON(body []byte) error { if err != nil { return err } - j.ID = &ID + ieor.ID = &ID } case "name": if v != nil { @@ -10122,7 +9962,7 @@ func (j *Job) UnmarshalJSON(body []byte) error { if err != nil { return err } - j.Name = &name + ieor.Name = &name } case "type": if v != nil { @@ -10131,7 +9971,7 @@ func (j *Job) UnmarshalJSON(body []byte) error { if err != nil { return err } - j.Type = &typeVar + ieor.Type = &typeVar } } } @@ -10139,17 +9979,69 @@ func (j *Job) UnmarshalJSON(body []byte) error { return nil } -// JobAgent an Azure SQL job agent. -type JobAgent struct { +// ImportExportOperationResultProperties contains the operation result properties for import/export +// operation. +type ImportExportOperationResultProperties struct { + // RequestID - READ-ONLY; Request Id. + RequestID *uuid.UUID `json:"requestId,omitempty"` + // RequestType - READ-ONLY; Request type. + RequestType *string `json:"requestType,omitempty"` + // QueuedTime - READ-ONLY; Queued time. + QueuedTime *string `json:"queuedTime,omitempty"` + // LastModifiedTime - READ-ONLY; Last modified time. + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + // BlobURI - READ-ONLY; Blob Uri. + BlobURI *string `json:"blobUri,omitempty"` + // ServerName - READ-ONLY; Server name. + ServerName *string `json:"serverName,omitempty"` + // DatabaseName - READ-ONLY; Database name. + DatabaseName *string `json:"databaseName,omitempty"` + // Status - READ-ONLY; Operation status. + Status *string `json:"status,omitempty"` + // ErrorMessage - READ-ONLY; Error message. + ErrorMessage *string `json:"errorMessage,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Gets the status of private endpoints associated with this request. + PrivateEndpointConnections *[]PrivateEndpointConnectionRequestStatus `json:"privateEndpointConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImportExportOperationResultProperties. +func (ieorp ImportExportOperationResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ImportNewDatabaseDefinition contains the information necessary to perform import operation for new +// database. +type ImportNewDatabaseDefinition struct { + // DatabaseName - Name of the import database. + DatabaseName *string `json:"databaseName,omitempty"` + // Edition - Edition of the import database. + Edition *string `json:"edition,omitempty"` + // ServiceObjectiveName - Service level objective name of the import database. + ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` + // MaxSizeBytes - Max size in bytes for the import database. + MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` + // StorageKeyType - Storage key type. Possible values include: 'StorageKeyTypeSharedAccessKey', 'StorageKeyTypeStorageAccessKey' + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + // StorageKey - Storage key. + StorageKey *string `json:"storageKey,omitempty"` + // StorageURI - Storage Uri. + StorageURI *string `json:"storageUri,omitempty"` + // AdministratorLogin - Administrator login name. + AdministratorLogin *string `json:"administratorLogin,omitempty"` + // AdministratorLoginPassword - Administrator login password. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthenticationType - Authentication type. + AuthenticationType *string `json:"authenticationType,omitempty"` + // NetworkIsolation - Optional resource information to enable network isolation for request. + NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` +} + +// InstanceFailoverGroup an instance failover group. +type InstanceFailoverGroup struct { autorest.Response `json:"-"` - // Sku - The name and tier of the SKU. - Sku *Sku `json:"sku,omitempty"` - // JobAgentProperties - Resource properties. - *JobAgentProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` + // InstanceFailoverGroupProperties - Resource properties. + *InstanceFailoverGroupProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -10158,26 +10050,17 @@ type JobAgent struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for JobAgent. -func (ja JobAgent) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for InstanceFailoverGroup. +func (ifg InstanceFailoverGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ja.Sku != nil { - objectMap["sku"] = ja.Sku - } - if ja.JobAgentProperties != nil { - objectMap["properties"] = ja.JobAgentProperties - } - if ja.Location != nil { - objectMap["location"] = ja.Location - } - if ja.Tags != nil { - objectMap["tags"] = ja.Tags + if ifg.InstanceFailoverGroupProperties != nil { + objectMap["properties"] = ifg.InstanceFailoverGroupProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for JobAgent struct. -func (ja *JobAgent) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for InstanceFailoverGroup struct. +func (ifg *InstanceFailoverGroup) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -10185,41 +10068,14 @@ func (ja *JobAgent) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ja.Sku = &sku - } case "properties": if v != nil { - var jobAgentProperties JobAgentProperties - err = json.Unmarshal(*v, &jobAgentProperties) - if err != nil { - return err - } - ja.JobAgentProperties = &jobAgentProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ja.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var instanceFailoverGroupProperties InstanceFailoverGroupProperties + err = json.Unmarshal(*v, &instanceFailoverGroupProperties) if err != nil { return err } - ja.Tags = tags + ifg.InstanceFailoverGroupProperties = &instanceFailoverGroupProperties } case "id": if v != nil { @@ -10228,7 +10084,7 @@ func (ja *JobAgent) UnmarshalJSON(body []byte) error { if err != nil { return err } - ja.ID = &ID + ifg.ID = &ID } case "name": if v != nil { @@ -10237,7 +10093,7 @@ func (ja *JobAgent) UnmarshalJSON(body []byte) error { if err != nil { return err } - ja.Name = &name + ifg.Name = &name } case "type": if v != nil { @@ -10246,7 +10102,7 @@ func (ja *JobAgent) UnmarshalJSON(body []byte) error { if err != nil { return err } - ja.Type = &typeVar + ifg.Type = &typeVar } } } @@ -10254,32 +10110,33 @@ func (ja *JobAgent) UnmarshalJSON(body []byte) error { return nil } -// JobAgentListResult a list of Azure SQL job agents. -type JobAgentListResult struct { +// InstanceFailoverGroupListResult a list of instance failover groups. +type InstanceFailoverGroupListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]JobAgent `json:"value,omitempty"` + Value *[]InstanceFailoverGroup `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for JobAgentListResult. -func (jalr JobAgentListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for InstanceFailoverGroupListResult. +func (ifglr InstanceFailoverGroupListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// JobAgentListResultIterator provides access to a complete listing of JobAgent values. -type JobAgentListResultIterator struct { +// InstanceFailoverGroupListResultIterator provides access to a complete listing of InstanceFailoverGroup +// values. +type InstanceFailoverGroupListResultIterator struct { i int - page JobAgentListResultPage + page InstanceFailoverGroupListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *JobAgentListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *InstanceFailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -10304,67 +10161,67 @@ func (iter *JobAgentListResultIterator) NextWithContext(ctx context.Context) (er // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *JobAgentListResultIterator) Next() error { +func (iter *InstanceFailoverGroupListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobAgentListResultIterator) NotDone() bool { +func (iter InstanceFailoverGroupListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter JobAgentListResultIterator) Response() JobAgentListResult { +func (iter InstanceFailoverGroupListResultIterator) Response() InstanceFailoverGroupListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter JobAgentListResultIterator) Value() JobAgent { +func (iter InstanceFailoverGroupListResultIterator) Value() InstanceFailoverGroup { if !iter.page.NotDone() { - return JobAgent{} + return InstanceFailoverGroup{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the JobAgentListResultIterator type. -func NewJobAgentListResultIterator(page JobAgentListResultPage) JobAgentListResultIterator { - return JobAgentListResultIterator{page: page} +// Creates a new instance of the InstanceFailoverGroupListResultIterator type. +func NewInstanceFailoverGroupListResultIterator(page InstanceFailoverGroupListResultPage) InstanceFailoverGroupListResultIterator { + return InstanceFailoverGroupListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (jalr JobAgentListResult) IsEmpty() bool { - return jalr.Value == nil || len(*jalr.Value) == 0 +func (ifglr InstanceFailoverGroupListResult) IsEmpty() bool { + return ifglr.Value == nil || len(*ifglr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (jalr JobAgentListResult) hasNextLink() bool { - return jalr.NextLink != nil && len(*jalr.NextLink) != 0 +func (ifglr InstanceFailoverGroupListResult) hasNextLink() bool { + return ifglr.NextLink != nil && len(*ifglr.NextLink) != 0 } -// jobAgentListResultPreparer prepares a request to retrieve the next set of results. +// instanceFailoverGroupListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (jalr JobAgentListResult) jobAgentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jalr.hasNextLink() { +func (ifglr InstanceFailoverGroupListResult) instanceFailoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ifglr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(jalr.NextLink))) + autorest.WithBaseURL(to.String(ifglr.NextLink))) } -// JobAgentListResultPage contains a page of JobAgent values. -type JobAgentListResultPage struct { - fn func(context.Context, JobAgentListResult) (JobAgentListResult, error) - jalr JobAgentListResult +// InstanceFailoverGroupListResultPage contains a page of InstanceFailoverGroup values. +type InstanceFailoverGroupListResultPage struct { + fn func(context.Context, InstanceFailoverGroupListResult) (InstanceFailoverGroupListResult, error) + ifglr InstanceFailoverGroupListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *JobAgentListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *InstanceFailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/InstanceFailoverGroupListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -10374,11 +10231,11 @@ func (page *JobAgentListResultPage) NextWithContext(ctx context.Context) (err er }() } for { - next, err := page.fn(ctx, page.jalr) + next, err := page.fn(ctx, page.ifglr) if err != nil { return err } - page.jalr = next + page.ifglr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -10389,64 +10246,95 @@ func (page *JobAgentListResultPage) NextWithContext(ctx context.Context) (err er // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *JobAgentListResultPage) Next() error { +func (page *InstanceFailoverGroupListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobAgentListResultPage) NotDone() bool { - return !page.jalr.IsEmpty() +func (page InstanceFailoverGroupListResultPage) NotDone() bool { + return !page.ifglr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page JobAgentListResultPage) Response() JobAgentListResult { - return page.jalr +func (page InstanceFailoverGroupListResultPage) Response() InstanceFailoverGroupListResult { + return page.ifglr } // Values returns the slice of values for the current page or nil if there are no values. -func (page JobAgentListResultPage) Values() []JobAgent { - if page.jalr.IsEmpty() { +func (page InstanceFailoverGroupListResultPage) Values() []InstanceFailoverGroup { + if page.ifglr.IsEmpty() { return nil } - return *page.jalr.Value + return *page.ifglr.Value } -// Creates a new instance of the JobAgentListResultPage type. -func NewJobAgentListResultPage(cur JobAgentListResult, getNextPage func(context.Context, JobAgentListResult) (JobAgentListResult, error)) JobAgentListResultPage { - return JobAgentListResultPage{ - fn: getNextPage, - jalr: cur, +// Creates a new instance of the InstanceFailoverGroupListResultPage type. +func NewInstanceFailoverGroupListResultPage(cur InstanceFailoverGroupListResult, getNextPage func(context.Context, InstanceFailoverGroupListResult) (InstanceFailoverGroupListResult, error)) InstanceFailoverGroupListResultPage { + return InstanceFailoverGroupListResultPage{ + fn: getNextPage, + ifglr: cur, } } -// JobAgentProperties properties of a job agent. -type JobAgentProperties struct { - // DatabaseID - Resource ID of the database to store job metadata in. - DatabaseID *string `json:"databaseId,omitempty"` - // State - READ-ONLY; The state of the job agent. Possible values include: 'JobAgentStateCreating', 'JobAgentStateReady', 'JobAgentStateUpdating', 'JobAgentStateDeleting', 'JobAgentStateDisabled' - State JobAgentState `json:"state,omitempty"` +// InstanceFailoverGroupProperties properties of a instance failover group. +type InstanceFailoverGroupProperties struct { + // ReadWriteEndpoint - Read-write endpoint of the failover group instance. + ReadWriteEndpoint *InstanceFailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` + // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. + ReadOnlyEndpoint *InstanceFailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` + // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'InstanceFailoverGroupReplicationRolePrimary', 'InstanceFailoverGroupReplicationRoleSecondary' + ReplicationRole InstanceFailoverGroupReplicationRole `json:"replicationRole,omitempty"` + // ReplicationState - READ-ONLY; Replication state of the failover group instance. + ReplicationState *string `json:"replicationState,omitempty"` + // PartnerRegions - Partner region information for the failover group. + PartnerRegions *[]PartnerRegionInfo `json:"partnerRegions,omitempty"` + // ManagedInstancePairs - List of managed instance pairs in the failover group. + ManagedInstancePairs *[]ManagedInstancePairInfo `json:"managedInstancePairs,omitempty"` } -// MarshalJSON is the custom marshaler for JobAgentProperties. -func (jap JobAgentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for InstanceFailoverGroupProperties. +func (ifgp InstanceFailoverGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if jap.DatabaseID != nil { - objectMap["databaseId"] = jap.DatabaseID + if ifgp.ReadWriteEndpoint != nil { + objectMap["readWriteEndpoint"] = ifgp.ReadWriteEndpoint + } + if ifgp.ReadOnlyEndpoint != nil { + objectMap["readOnlyEndpoint"] = ifgp.ReadOnlyEndpoint + } + if ifgp.PartnerRegions != nil { + objectMap["partnerRegions"] = ifgp.PartnerRegions + } + if ifgp.ManagedInstancePairs != nil { + objectMap["managedInstancePairs"] = ifgp.ManagedInstancePairs } return json.Marshal(objectMap) } -// JobAgentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type JobAgentsCreateOrUpdateFuture struct { +// InstanceFailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. +type InstanceFailoverGroupReadOnlyEndpoint struct { + // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' + FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` +} + +// InstanceFailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. +type InstanceFailoverGroupReadWriteEndpoint struct { + // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'ReadWriteEndpointFailoverPolicyManual', 'ReadWriteEndpointFailoverPolicyAutomatic' + FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` + // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` +} + +// InstanceFailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InstanceFailoverGroupsCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(JobAgentsClient) (JobAgent, error) + Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobAgentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *InstanceFailoverGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -10456,40 +10344,40 @@ func (future *JobAgentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { return nil } -// result is the default implementation for JobAgentsCreateOrUpdateFuture.Result. -func (future *JobAgentsCreateOrUpdateFuture) result(client JobAgentsClient) (ja JobAgent, err error) { +// result is the default implementation for InstanceFailoverGroupsCreateOrUpdateFuture.Result. +func (future *InstanceFailoverGroupsCreateOrUpdateFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - ja.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobAgentsCreateOrUpdateFuture") + ifg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ja.Response.Response, err = future.GetResult(sender); err == nil && ja.Response.Response.StatusCode != http.StatusNoContent { - ja, err = client.CreateOrUpdateResponder(ja.Response.Response) + if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { + ifg, err = client.CreateOrUpdateResponder(ifg.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsCreateOrUpdateFuture", "Result", ja.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsCreateOrUpdateFuture", "Result", ifg.Response.Response, "Failure responding to request") } } return } -// JobAgentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type JobAgentsDeleteFuture struct { +// InstanceFailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InstanceFailoverGroupsDeleteFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(JobAgentsClient) (autorest.Response, error) + Result func(InstanceFailoverGroupsClient) (autorest.Response, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobAgentsDeleteFuture) UnmarshalJSON(body []byte) error { +func (future *InstanceFailoverGroupsDeleteFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -10499,34 +10387,34 @@ func (future *JobAgentsDeleteFuture) UnmarshalJSON(body []byte) error { return nil } -// result is the default implementation for JobAgentsDeleteFuture.Result. -func (future *JobAgentsDeleteFuture) result(client JobAgentsClient) (ar autorest.Response, err error) { +// result is the default implementation for InstanceFailoverGroupsDeleteFuture.Result. +func (future *InstanceFailoverGroupsDeleteFuture) result(client InstanceFailoverGroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsDeleteFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") return } if !done { ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobAgentsDeleteFuture") + err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsDeleteFuture") return } ar.Response = future.Response() return } -// JobAgentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type JobAgentsUpdateFuture struct { +// InstanceFailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InstanceFailoverGroupsFailoverFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(JobAgentsClient) (JobAgent, error) + Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobAgentsUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *InstanceFailoverGroupsFailoverFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -10536,49 +10424,83 @@ func (future *JobAgentsUpdateFuture) UnmarshalJSON(body []byte) error { return nil } -// result is the default implementation for JobAgentsUpdateFuture.Result. -func (future *JobAgentsUpdateFuture) result(client JobAgentsClient) (ja JobAgent, err error) { +// result is the default implementation for InstanceFailoverGroupsFailoverFuture.Result. +func (future *InstanceFailoverGroupsFailoverFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") return } if !done { - ja.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobAgentsUpdateFuture") + ifg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsFailoverFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ja.Response.Response, err = future.GetResult(sender); err == nil && ja.Response.Response.StatusCode != http.StatusNoContent { - ja, err = client.UpdateResponder(ja.Response.Response) + if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { + ifg, err = client.FailoverResponder(ifg.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobAgentsUpdateFuture", "Result", ja.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsFailoverFuture", "Result", ifg.Response.Response, "Failure responding to request") } } return } -// JobAgentUpdate an update to an Azure SQL job agent. -type JobAgentUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` +// InstanceFailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type InstanceFailoverGroupsForceFailoverAllowDataLossFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InstanceFailoverGroupsClient) (InstanceFailoverGroup, error) } -// MarshalJSON is the custom marshaler for JobAgentUpdate. -func (jau JobAgentUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jau.Tags != nil { - objectMap["tags"] = jau.Tags +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - return json.Marshal(objectMap) + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// JobCredential a stored credential that can be used by a job to connect to target databases. -type JobCredential struct { +// result is the default implementation for InstanceFailoverGroupsForceFailoverAllowDataLossFuture.Result. +func (future *InstanceFailoverGroupsForceFailoverAllowDataLossFuture) result(client InstanceFailoverGroupsClient) (ifg InstanceFailoverGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ifg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ifg.Response.Response, err = future.GetResult(sender); err == nil && ifg.Response.Response.StatusCode != http.StatusNoContent { + ifg, err = client.ForceFailoverAllowDataLossResponder(ifg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InstanceFailoverGroupsForceFailoverAllowDataLossFuture", "Result", ifg.Response.Response, "Failure responding to request") + } + } + return +} + +// InstancePool an Azure SQL instance pool. +type InstancePool struct { autorest.Response `json:"-"` - // JobCredentialProperties - Resource properties. - *JobCredentialProperties `json:"properties,omitempty"` + // Sku - The name and tier of the SKU. + Sku *Sku `json:"sku,omitempty"` + // InstancePoolProperties - Resource properties. + *InstancePoolProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -10587,17 +10509,26 @@ type JobCredential struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for JobCredential. -func (jc JobCredential) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for InstancePool. +func (IP InstancePool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if jc.JobCredentialProperties != nil { - objectMap["properties"] = jc.JobCredentialProperties + if IP.Sku != nil { + objectMap["sku"] = IP.Sku + } + if IP.InstancePoolProperties != nil { + objectMap["properties"] = IP.InstancePoolProperties + } + if IP.Location != nil { + objectMap["location"] = IP.Location + } + if IP.Tags != nil { + objectMap["tags"] = IP.Tags } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for JobCredential struct. -func (jc *JobCredential) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for InstancePool struct. +func (IP *InstancePool) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -10605,14 +10536,41 @@ func (jc *JobCredential) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + IP.Sku = &sku + } case "properties": if v != nil { - var jobCredentialProperties JobCredentialProperties - err = json.Unmarshal(*v, &jobCredentialProperties) + var instancePoolProperties InstancePoolProperties + err = json.Unmarshal(*v, &instancePoolProperties) if err != nil { return err } - jc.JobCredentialProperties = &jobCredentialProperties + IP.InstancePoolProperties = &instancePoolProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + IP.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + IP.Tags = tags } case "id": if v != nil { @@ -10621,7 +10579,7 @@ func (jc *JobCredential) UnmarshalJSON(body []byte) error { if err != nil { return err } - jc.ID = &ID + IP.ID = &ID } case "name": if v != nil { @@ -10630,7 +10588,7 @@ func (jc *JobCredential) UnmarshalJSON(body []byte) error { if err != nil { return err } - jc.Name = &name + IP.Name = &name } case "type": if v != nil { @@ -10639,7 +10597,7 @@ func (jc *JobCredential) UnmarshalJSON(body []byte) error { if err != nil { return err } - jc.Type = &typeVar + IP.Type = &typeVar } } } @@ -10647,32 +10605,76 @@ func (jc *JobCredential) UnmarshalJSON(body []byte) error { return nil } -// JobCredentialListResult a list of job credentials. -type JobCredentialListResult struct { +// InstancePoolEditionCapability the instance pool capability +type InstancePoolEditionCapability struct { + // Name - READ-ONLY; The instance pool version name. + Name *string `json:"name,omitempty"` + // SupportedFamilies - READ-ONLY; The supported families. + SupportedFamilies *[]InstancePoolFamilyCapability `json:"supportedFamilies,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for InstancePoolEditionCapability. +func (ipec InstancePoolEditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipec.Reason != nil { + objectMap["reason"] = ipec.Reason + } + return json.Marshal(objectMap) +} + +// InstancePoolFamilyCapability the instance pool family capability. +type InstancePoolFamilyCapability struct { + // Name - READ-ONLY; Family name. + Name *string `json:"name,omitempty"` + // SupportedLicenseTypes - READ-ONLY; List of supported license types. + SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` + // SupportedVcoresValues - READ-ONLY; List of supported virtual cores values. + SupportedVcoresValues *[]InstancePoolVcoresCapability `json:"supportedVcoresValues,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for InstancePoolFamilyCapability. +func (ipfc InstancePoolFamilyCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipfc.Reason != nil { + objectMap["reason"] = ipfc.Reason + } + return json.Marshal(objectMap) +} + +// InstancePoolListResult a list of Azure SQL instance pools. +type InstancePoolListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]JobCredential `json:"value,omitempty"` + Value *[]InstancePool `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for JobCredentialListResult. -func (jclr JobCredentialListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for InstancePoolListResult. +func (iplr InstancePoolListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// JobCredentialListResultIterator provides access to a complete listing of JobCredential values. -type JobCredentialListResultIterator struct { +// InstancePoolListResultIterator provides access to a complete listing of InstancePool values. +type InstancePoolListResultIterator struct { i int - page JobCredentialListResultPage + page InstancePoolListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *JobCredentialListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *InstancePoolListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -10697,67 +10699,67 @@ func (iter *JobCredentialListResultIterator) NextWithContext(ctx context.Context // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *JobCredentialListResultIterator) Next() error { +func (iter *InstancePoolListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobCredentialListResultIterator) NotDone() bool { +func (iter InstancePoolListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter JobCredentialListResultIterator) Response() JobCredentialListResult { +func (iter InstancePoolListResultIterator) Response() InstancePoolListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter JobCredentialListResultIterator) Value() JobCredential { +func (iter InstancePoolListResultIterator) Value() InstancePool { if !iter.page.NotDone() { - return JobCredential{} + return InstancePool{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the JobCredentialListResultIterator type. -func NewJobCredentialListResultIterator(page JobCredentialListResultPage) JobCredentialListResultIterator { - return JobCredentialListResultIterator{page: page} +// Creates a new instance of the InstancePoolListResultIterator type. +func NewInstancePoolListResultIterator(page InstancePoolListResultPage) InstancePoolListResultIterator { + return InstancePoolListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (jclr JobCredentialListResult) IsEmpty() bool { - return jclr.Value == nil || len(*jclr.Value) == 0 +func (iplr InstancePoolListResult) IsEmpty() bool { + return iplr.Value == nil || len(*iplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (jclr JobCredentialListResult) hasNextLink() bool { - return jclr.NextLink != nil && len(*jclr.NextLink) != 0 +func (iplr InstancePoolListResult) hasNextLink() bool { + return iplr.NextLink != nil && len(*iplr.NextLink) != 0 } -// jobCredentialListResultPreparer prepares a request to retrieve the next set of results. +// instancePoolListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (jclr JobCredentialListResult) jobCredentialListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jclr.hasNextLink() { +func (iplr InstancePoolListResult) instancePoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !iplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(jclr.NextLink))) + autorest.WithBaseURL(to.String(iplr.NextLink))) } -// JobCredentialListResultPage contains a page of JobCredential values. -type JobCredentialListResultPage struct { - fn func(context.Context, JobCredentialListResult) (JobCredentialListResult, error) - jclr JobCredentialListResult +// InstancePoolListResultPage contains a page of InstancePool values. +type InstancePoolListResultPage struct { + fn func(context.Context, InstancePoolListResult) (InstancePoolListResult, error) + iplr InstancePoolListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *JobCredentialListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *InstancePoolListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -10767,11 +10769,11 @@ func (page *JobCredentialListResultPage) NextWithContext(ctx context.Context) (e }() } for { - next, err := page.fn(ctx, page.jclr) + next, err := page.fn(ctx, page.iplr) if err != nil { return err } - page.jclr = next + page.iplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -10782,83 +10784,249 @@ func (page *JobCredentialListResultPage) NextWithContext(ctx context.Context) (e // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *JobCredentialListResultPage) Next() error { +func (page *InstancePoolListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobCredentialListResultPage) NotDone() bool { - return !page.jclr.IsEmpty() +func (page InstancePoolListResultPage) NotDone() bool { + return !page.iplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page JobCredentialListResultPage) Response() JobCredentialListResult { - return page.jclr +func (page InstancePoolListResultPage) Response() InstancePoolListResult { + return page.iplr } // Values returns the slice of values for the current page or nil if there are no values. -func (page JobCredentialListResultPage) Values() []JobCredential { - if page.jclr.IsEmpty() { +func (page InstancePoolListResultPage) Values() []InstancePool { + if page.iplr.IsEmpty() { return nil } - return *page.jclr.Value + return *page.iplr.Value } -// Creates a new instance of the JobCredentialListResultPage type. -func NewJobCredentialListResultPage(cur JobCredentialListResult, getNextPage func(context.Context, JobCredentialListResult) (JobCredentialListResult, error)) JobCredentialListResultPage { - return JobCredentialListResultPage{ +// Creates a new instance of the InstancePoolListResultPage type. +func NewInstancePoolListResultPage(cur InstancePoolListResult, getNextPage func(context.Context, InstancePoolListResult) (InstancePoolListResult, error)) InstancePoolListResultPage { + return InstancePoolListResultPage{ fn: getNextPage, - jclr: cur, + iplr: cur, } } -// JobCredentialProperties properties of a job credential. -type JobCredentialProperties struct { - // Username - The credential user name. - Username *string `json:"username,omitempty"` - // Password - The credential password. - Password *string `json:"password,omitempty"` +// InstancePoolProperties properties of an instance pool. +type InstancePoolProperties struct { + // SubnetID - Resource ID of the subnet to place this instance pool in. + SubnetID *string `json:"subnetId,omitempty"` + // VCores - Count of vCores belonging to this instance pool. + VCores *int32 `json:"vCores,omitempty"` + // LicenseType - The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'InstancePoolLicenseTypeLicenseIncluded', 'InstancePoolLicenseTypeBasePrice' + LicenseType InstancePoolLicenseType `json:"licenseType,omitempty"` } -// JobExecution an execution of a job -type JobExecution struct { - autorest.Response `json:"-"` - // JobExecutionProperties - Resource properties. - *JobExecutionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// InstancePoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InstancePoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InstancePoolsClient) (InstancePool, error) } -// MarshalJSON is the custom marshaler for JobExecution. -func (je JobExecution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if je.JobExecutionProperties != nil { - objectMap["properties"] = je.JobExecutionProperties +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InstancePoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - return json.Marshal(objectMap) + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// UnmarshalJSON is the custom unmarshaler for JobExecution struct. -func (je *JobExecution) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) +// result is the default implementation for InstancePoolsCreateOrUpdateFuture.Result. +func (future *InstancePoolsCreateOrUpdateFuture) result(client InstancePoolsClient) (IP InstancePool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) if err != nil { - return err + err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var jobExecutionProperties JobExecutionProperties - err = json.Unmarshal(*v, &jobExecutionProperties) - if err != nil { + if !done { + IP.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { + IP, err = client.CreateOrUpdateResponder(IP.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", IP.Response.Response, "Failure responding to request") + } + } + return +} + +// InstancePoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type InstancePoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InstancePoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InstancePoolsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InstancePoolsDeleteFuture.Result. +func (future *InstancePoolsDeleteFuture) result(client InstancePoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InstancePoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// InstancePoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type InstancePoolsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InstancePoolsClient) (InstancePool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InstancePoolsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InstancePoolsUpdateFuture.Result. +func (future *InstancePoolsUpdateFuture) result(client InstancePoolsClient) (IP InstancePool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + IP.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { + IP, err = client.UpdateResponder(IP.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", IP.Response.Response, "Failure responding to request") + } + } + return +} + +// InstancePoolUpdate an update to an Instance pool. +type InstancePoolUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for InstancePoolUpdate. +func (ipu InstancePoolUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipu.Tags != nil { + objectMap["tags"] = ipu.Tags + } + return json.Marshal(objectMap) +} + +// InstancePoolVcoresCapability the managed instance virtual cores capability. +type InstancePoolVcoresCapability struct { + // Name - READ-ONLY; The virtual cores identifier. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; The virtual cores value. + Value *int32 `json:"value,omitempty"` + // StorageLimit - READ-ONLY; Storage limit. + StorageLimit *MaxSizeCapability `json:"storageLimit,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for InstancePoolVcoresCapability. +func (ipvc InstancePoolVcoresCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipvc.Reason != nil { + objectMap["reason"] = ipvc.Reason + } + return json.Marshal(objectMap) +} + +// IPv6FirewallRule an IPv6 server firewall rule. +type IPv6FirewallRule struct { + autorest.Response `json:"-"` + // IPv6ServerFirewallRuleProperties - Resource properties. + *IPv6ServerFirewallRuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPv6FirewallRule. +func (ip6fr IPv6FirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ip6fr.IPv6ServerFirewallRuleProperties != nil { + objectMap["properties"] = ip6fr.IPv6ServerFirewallRuleProperties + } + if ip6fr.Name != nil { + objectMap["name"] = ip6fr.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPv6FirewallRule struct. +func (ip6fr *IPv6FirewallRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var iPv6ServerFirewallRuleProperties IPv6ServerFirewallRuleProperties + err = json.Unmarshal(*v, &iPv6ServerFirewallRuleProperties) + if err != nil { return err } - je.JobExecutionProperties = &jobExecutionProperties + ip6fr.IPv6ServerFirewallRuleProperties = &iPv6ServerFirewallRuleProperties } case "id": if v != nil { @@ -10867,7 +11035,7 @@ func (je *JobExecution) UnmarshalJSON(body []byte) error { if err != nil { return err } - je.ID = &ID + ip6fr.ID = &ID } case "name": if v != nil { @@ -10876,7 +11044,7 @@ func (je *JobExecution) UnmarshalJSON(body []byte) error { if err != nil { return err } - je.Name = &name + ip6fr.Name = &name } case "type": if v != nil { @@ -10885,7 +11053,7 @@ func (je *JobExecution) UnmarshalJSON(body []byte) error { if err != nil { return err } - je.Type = &typeVar + ip6fr.Type = &typeVar } } } @@ -10893,32 +11061,32 @@ func (je *JobExecution) UnmarshalJSON(body []byte) error { return nil } -// JobExecutionListResult a list of job executions. -type JobExecutionListResult struct { +// IPv6FirewallRuleListResult the response to a list IPv6 firewall rules request +type IPv6FirewallRuleListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]JobExecution `json:"value,omitempty"` + Value *[]IPv6FirewallRule `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for JobExecutionListResult. -func (jelr JobExecutionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for IPv6FirewallRuleListResult. +func (ip6frlr IPv6FirewallRuleListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// JobExecutionListResultIterator provides access to a complete listing of JobExecution values. -type JobExecutionListResultIterator struct { +// IPv6FirewallRuleListResultIterator provides access to a complete listing of IPv6FirewallRule values. +type IPv6FirewallRuleListResultIterator struct { i int - page JobExecutionListResultPage + page IPv6FirewallRuleListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *JobExecutionListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *IPv6FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/IPv6FirewallRuleListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -10943,67 +11111,67 @@ func (iter *JobExecutionListResultIterator) NextWithContext(ctx context.Context) // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *JobExecutionListResultIterator) Next() error { +func (iter *IPv6FirewallRuleListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobExecutionListResultIterator) NotDone() bool { +func (iter IPv6FirewallRuleListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter JobExecutionListResultIterator) Response() JobExecutionListResult { +func (iter IPv6FirewallRuleListResultIterator) Response() IPv6FirewallRuleListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter JobExecutionListResultIterator) Value() JobExecution { +func (iter IPv6FirewallRuleListResultIterator) Value() IPv6FirewallRule { if !iter.page.NotDone() { - return JobExecution{} + return IPv6FirewallRule{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the JobExecutionListResultIterator type. -func NewJobExecutionListResultIterator(page JobExecutionListResultPage) JobExecutionListResultIterator { - return JobExecutionListResultIterator{page: page} +// Creates a new instance of the IPv6FirewallRuleListResultIterator type. +func NewIPv6FirewallRuleListResultIterator(page IPv6FirewallRuleListResultPage) IPv6FirewallRuleListResultIterator { + return IPv6FirewallRuleListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (jelr JobExecutionListResult) IsEmpty() bool { - return jelr.Value == nil || len(*jelr.Value) == 0 +func (ip6frlr IPv6FirewallRuleListResult) IsEmpty() bool { + return ip6frlr.Value == nil || len(*ip6frlr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (jelr JobExecutionListResult) hasNextLink() bool { - return jelr.NextLink != nil && len(*jelr.NextLink) != 0 +func (ip6frlr IPv6FirewallRuleListResult) hasNextLink() bool { + return ip6frlr.NextLink != nil && len(*ip6frlr.NextLink) != 0 } -// jobExecutionListResultPreparer prepares a request to retrieve the next set of results. +// iPv6FirewallRuleListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (jelr JobExecutionListResult) jobExecutionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jelr.hasNextLink() { +func (ip6frlr IPv6FirewallRuleListResult) iPv6FirewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ip6frlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(jelr.NextLink))) + autorest.WithBaseURL(to.String(ip6frlr.NextLink))) } -// JobExecutionListResultPage contains a page of JobExecution values. -type JobExecutionListResultPage struct { - fn func(context.Context, JobExecutionListResult) (JobExecutionListResult, error) - jelr JobExecutionListResult +// IPv6FirewallRuleListResultPage contains a page of IPv6FirewallRule values. +type IPv6FirewallRuleListResultPage struct { + fn func(context.Context, IPv6FirewallRuleListResult) (IPv6FirewallRuleListResult, error) + ip6frlr IPv6FirewallRuleListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *JobExecutionListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *IPv6FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/IPv6FirewallRuleListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -11013,11 +11181,11 @@ func (page *JobExecutionListResultPage) NextWithContext(ctx context.Context) (er }() } for { - next, err := page.fn(ctx, page.jelr) + next, err := page.fn(ctx, page.ip6frlr) if err != nil { return err } - page.jelr = next + page.ip6frlr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -11028,203 +11196,258 @@ func (page *JobExecutionListResultPage) NextWithContext(ctx context.Context) (er // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *JobExecutionListResultPage) Next() error { +func (page *IPv6FirewallRuleListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobExecutionListResultPage) NotDone() bool { - return !page.jelr.IsEmpty() +func (page IPv6FirewallRuleListResultPage) NotDone() bool { + return !page.ip6frlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page JobExecutionListResultPage) Response() JobExecutionListResult { - return page.jelr +func (page IPv6FirewallRuleListResultPage) Response() IPv6FirewallRuleListResult { + return page.ip6frlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page JobExecutionListResultPage) Values() []JobExecution { - if page.jelr.IsEmpty() { +func (page IPv6FirewallRuleListResultPage) Values() []IPv6FirewallRule { + if page.ip6frlr.IsEmpty() { return nil } - return *page.jelr.Value + return *page.ip6frlr.Value } -// Creates a new instance of the JobExecutionListResultPage type. -func NewJobExecutionListResultPage(cur JobExecutionListResult, getNextPage func(context.Context, JobExecutionListResult) (JobExecutionListResult, error)) JobExecutionListResultPage { - return JobExecutionListResultPage{ - fn: getNextPage, - jelr: cur, +// Creates a new instance of the IPv6FirewallRuleListResultPage type. +func NewIPv6FirewallRuleListResultPage(cur IPv6FirewallRuleListResult, getNextPage func(context.Context, IPv6FirewallRuleListResult) (IPv6FirewallRuleListResult, error)) IPv6FirewallRuleListResultPage { + return IPv6FirewallRuleListResultPage{ + fn: getNextPage, + ip6frlr: cur, } } -// JobExecutionProperties properties for an Azure SQL Database Elastic job execution. -type JobExecutionProperties struct { - // JobVersion - READ-ONLY; The job version number. - JobVersion *int32 `json:"jobVersion,omitempty"` - // StepName - READ-ONLY; The job step name. - StepName *string `json:"stepName,omitempty"` - // StepID - READ-ONLY; The job step id. - StepID *int32 `json:"stepId,omitempty"` - // JobExecutionID - READ-ONLY; The unique identifier of the job execution. - JobExecutionID *uuid.UUID `json:"jobExecutionId,omitempty"` - // Lifecycle - READ-ONLY; The detailed state of the job execution. Possible values include: 'JobExecutionLifecycleCreated', 'JobExecutionLifecycleInProgress', 'JobExecutionLifecycleWaitingForChildJobExecutions', 'JobExecutionLifecycleWaitingForRetry', 'JobExecutionLifecycleSucceeded', 'JobExecutionLifecycleSucceededWithSkipped', 'JobExecutionLifecycleFailed', 'JobExecutionLifecycleTimedOut', 'JobExecutionLifecycleCanceled', 'JobExecutionLifecycleSkipped' - Lifecycle JobExecutionLifecycle `json:"lifecycle,omitempty"` - // ProvisioningState - READ-ONLY; The ARM provisioning state of the job execution. Possible values include: 'ProvisioningStateCreated', 'ProvisioningStateInProgress', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CreateTime - READ-ONLY; The time that the job execution was created. - CreateTime *date.Time `json:"createTime,omitempty"` - // StartTime - READ-ONLY; The time that the job execution started. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The time that the job execution completed. - EndTime *date.Time `json:"endTime,omitempty"` - // CurrentAttempts - Number of times the job execution has been attempted. - CurrentAttempts *int32 `json:"currentAttempts,omitempty"` - // CurrentAttemptStartTime - READ-ONLY; Start time of the current attempt. - CurrentAttemptStartTime *date.Time `json:"currentAttemptStartTime,omitempty"` - // LastMessage - READ-ONLY; The last status or error message. - LastMessage *string `json:"lastMessage,omitempty"` - // Target - READ-ONLY; The target that this execution is executed on. - Target *JobExecutionTarget `json:"target,omitempty"` +// IPv6ServerFirewallRuleProperties the properties of an IPv6 server firewall rule. +type IPv6ServerFirewallRuleProperties struct { + // StartIPv6Address - The start IP address of the firewall rule. Must be IPv6 format. + StartIPv6Address *string `json:"startIPv6Address,omitempty"` + // EndIPv6Address - The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to startIpAddress. + EndIPv6Address *string `json:"endIPv6Address,omitempty"` } -// MarshalJSON is the custom marshaler for JobExecutionProperties. -func (jep JobExecutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jep.CurrentAttempts != nil { - objectMap["currentAttempts"] = jep.CurrentAttempts - } - return json.Marshal(objectMap) +// Job a job. +type Job struct { + autorest.Response `json:"-"` + // JobProperties - Resource properties. + *JobProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// JobExecutionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type JobExecutionsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(JobExecutionsClient) (JobExecution, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobExecutionsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// MarshalJSON is the custom marshaler for Job. +func (j Job) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if j.JobProperties != nil { + objectMap["properties"] = j.JobProperties } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return json.Marshal(objectMap) } -// result is the default implementation for JobExecutionsCreateFuture.Result. -func (future *JobExecutionsCreateFuture) result(client JobExecutionsClient) (je JobExecution, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// UnmarshalJSON is the custom unmarshaler for Job struct. +func (j *Job) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - je.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobExecutionsCreateFuture") - return + return err } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if je.Response.Response, err = future.GetResult(sender); err == nil && je.Response.Response.StatusCode != http.StatusNoContent { - je, err = client.CreateResponder(je.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateFuture", "Result", je.Response.Response, "Failure responding to request") + for k, v := range m { + switch k { + case "properties": + if v != nil { + var jobProperties JobProperties + err = json.Unmarshal(*v, &jobProperties) + if err != nil { + return err + } + j.JobProperties = &jobProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + j.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + j.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + j.Type = &typeVar + } } } - return + + return nil } -// JobExecutionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type JobExecutionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(JobExecutionsClient) (JobExecution, error) +// JobAgent an Azure SQL job agent. +type JobAgent struct { + autorest.Response `json:"-"` + // Sku - The name and tier of the SKU. + Sku *Sku `json:"sku,omitempty"` + // JobAgentProperties - Resource properties. + *JobAgentProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *JobExecutionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// MarshalJSON is the custom marshaler for JobAgent. +func (ja JobAgent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ja.Sku != nil { + objectMap["sku"] = ja.Sku } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + if ja.JobAgentProperties != nil { + objectMap["properties"] = ja.JobAgentProperties + } + if ja.Location != nil { + objectMap["location"] = ja.Location + } + if ja.Tags != nil { + objectMap["tags"] = ja.Tags + } + return json.Marshal(objectMap) } -// result is the default implementation for JobExecutionsCreateOrUpdateFuture.Result. -func (future *JobExecutionsCreateOrUpdateFuture) result(client JobExecutionsClient) (je JobExecution, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// UnmarshalJSON is the custom unmarshaler for JobAgent struct. +func (ja *JobAgent) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - je.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.JobExecutionsCreateOrUpdateFuture") - return + return err } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if je.Response.Response, err = future.GetResult(sender); err == nil && je.Response.Response.StatusCode != http.StatusNoContent { - je, err = client.CreateOrUpdateResponder(je.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateOrUpdateFuture", "Result", je.Response.Response, "Failure responding to request") + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + ja.Sku = &sku + } + case "properties": + if v != nil { + var jobAgentProperties JobAgentProperties + err = json.Unmarshal(*v, &jobAgentProperties) + if err != nil { + return err + } + ja.JobAgentProperties = &jobAgentProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ja.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ja.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ja.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ja.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ja.Type = &typeVar + } } } - return -} - -// JobExecutionTarget the target that a job execution is executed on. -type JobExecutionTarget struct { - // Type - READ-ONLY; The type of the target. Possible values include: 'JobTargetTypeTargetGroup', 'JobTargetTypeSQLDatabase', 'JobTargetTypeSQLElasticPool', 'JobTargetTypeSQLShardMap', 'JobTargetTypeSQLServer' - Type JobTargetType `json:"type,omitempty"` - // ServerName - READ-ONLY; The server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - READ-ONLY; The database name. - DatabaseName *string `json:"databaseName,omitempty"` -} -// MarshalJSON is the custom marshaler for JobExecutionTarget. -func (jet JobExecutionTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) + return nil } -// JobListResult a list of jobs. -type JobListResult struct { +// JobAgentListResult a list of Azure SQL job agents. +type JobAgentListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]Job `json:"value,omitempty"` + Value *[]JobAgent `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for JobListResult. -func (jlr JobListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobAgentListResult. +func (jalr JobAgentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// JobListResultIterator provides access to a complete listing of Job values. -type JobListResultIterator struct { +// JobAgentListResultIterator provides access to a complete listing of JobAgent values. +type JobAgentListResultIterator struct { i int - page JobListResultPage + page JobAgentListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *JobListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *JobAgentListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -11249,67 +11472,67 @@ func (iter *JobListResultIterator) NextWithContext(ctx context.Context) (err err // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *JobListResultIterator) Next() error { +func (iter *JobAgentListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobListResultIterator) NotDone() bool { +func (iter JobAgentListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter JobListResultIterator) Response() JobListResult { +func (iter JobAgentListResultIterator) Response() JobAgentListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter JobListResultIterator) Value() Job { +func (iter JobAgentListResultIterator) Value() JobAgent { if !iter.page.NotDone() { - return Job{} + return JobAgent{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the JobListResultIterator type. -func NewJobListResultIterator(page JobListResultPage) JobListResultIterator { - return JobListResultIterator{page: page} +// Creates a new instance of the JobAgentListResultIterator type. +func NewJobAgentListResultIterator(page JobAgentListResultPage) JobAgentListResultIterator { + return JobAgentListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (jlr JobListResult) IsEmpty() bool { - return jlr.Value == nil || len(*jlr.Value) == 0 +func (jalr JobAgentListResult) IsEmpty() bool { + return jalr.Value == nil || len(*jalr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (jlr JobListResult) hasNextLink() bool { - return jlr.NextLink != nil && len(*jlr.NextLink) != 0 +func (jalr JobAgentListResult) hasNextLink() bool { + return jalr.NextLink != nil && len(*jalr.NextLink) != 0 } -// jobListResultPreparer prepares a request to retrieve the next set of results. +// jobAgentListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (jlr JobListResult) jobListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jlr.hasNextLink() { +func (jalr JobAgentListResult) jobAgentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !jalr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(jlr.NextLink))) + autorest.WithBaseURL(to.String(jalr.NextLink))) } -// JobListResultPage contains a page of Job values. -type JobListResultPage struct { - fn func(context.Context, JobListResult) (JobListResult, error) - jlr JobListResult +// JobAgentListResultPage contains a page of JobAgent values. +type JobAgentListResultPage struct { + fn func(context.Context, JobAgentListResult) (JobAgentListResult, error) + jalr JobAgentListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *JobListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *JobAgentListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -11319,11 +11542,11 @@ func (page *JobListResultPage) NextWithContext(ctx context.Context) (err error) }() } for { - next, err := page.fn(ctx, page.jlr) + next, err := page.fn(ctx, page.jalr) if err != nil { return err } - page.jlr = next + page.jalr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -11334,195 +11557,290 @@ func (page *JobListResultPage) NextWithContext(ctx context.Context) (err error) // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *JobListResultPage) Next() error { +func (page *JobAgentListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobListResultPage) NotDone() bool { - return !page.jlr.IsEmpty() +func (page JobAgentListResultPage) NotDone() bool { + return !page.jalr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page JobListResultPage) Response() JobListResult { - return page.jlr +func (page JobAgentListResultPage) Response() JobAgentListResult { + return page.jalr } // Values returns the slice of values for the current page or nil if there are no values. -func (page JobListResultPage) Values() []Job { - if page.jlr.IsEmpty() { +func (page JobAgentListResultPage) Values() []JobAgent { + if page.jalr.IsEmpty() { return nil } - return *page.jlr.Value + return *page.jalr.Value } -// Creates a new instance of the JobListResultPage type. -func NewJobListResultPage(cur JobListResult, getNextPage func(context.Context, JobListResult) (JobListResult, error)) JobListResultPage { - return JobListResultPage{ - fn: getNextPage, - jlr: cur, +// Creates a new instance of the JobAgentListResultPage type. +func NewJobAgentListResultPage(cur JobAgentListResult, getNextPage func(context.Context, JobAgentListResult) (JobAgentListResult, error)) JobAgentListResultPage { + return JobAgentListResultPage{ + fn: getNextPage, + jalr: cur, } } -// JobProperties properties of a job. -type JobProperties struct { - // Description - User-defined description of the job. - Description *string `json:"description,omitempty"` - // Version - READ-ONLY; The job version number. - Version *int32 `json:"version,omitempty"` - // Schedule - Schedule properties of the job. - Schedule *JobSchedule `json:"schedule,omitempty"` +// JobAgentProperties properties of a job agent. +type JobAgentProperties struct { + // DatabaseID - Resource ID of the database to store job metadata in. + DatabaseID *string `json:"databaseId,omitempty"` + // State - READ-ONLY; The state of the job agent. Possible values include: 'JobAgentStateCreating', 'JobAgentStateReady', 'JobAgentStateUpdating', 'JobAgentStateDeleting', 'JobAgentStateDisabled' + State JobAgentState `json:"state,omitempty"` } -// MarshalJSON is the custom marshaler for JobProperties. -func (jp JobProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobAgentProperties. +func (jap JobAgentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if jp.Description != nil { - objectMap["description"] = jp.Description - } - if jp.Schedule != nil { - objectMap["schedule"] = jp.Schedule + if jap.DatabaseID != nil { + objectMap["databaseId"] = jap.DatabaseID } return json.Marshal(objectMap) } -// JobSchedule scheduling properties of a job. -type JobSchedule struct { - // StartTime - Schedule start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Schedule end time. - EndTime *date.Time `json:"endTime,omitempty"` - // Type - Schedule interval type. Possible values include: 'JobScheduleTypeOnce', 'JobScheduleTypeRecurring' - Type JobScheduleType `json:"type,omitempty"` - // Enabled - Whether or not the schedule is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Interval - Value of the schedule's recurring interval, if the ScheduleType is recurring. ISO8601 duration format. - Interval *string `json:"interval,omitempty"` -} - -// JobStep a job step. -type JobStep struct { - autorest.Response `json:"-"` - // JobStepProperties - Resource properties. - *JobStepProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// JobAgentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type JobAgentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(JobAgentsClient) (JobAgent, error) } -// MarshalJSON is the custom marshaler for JobStep. -func (js JobStep) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if js.JobStepProperties != nil { - objectMap["properties"] = js.JobStepProperties +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *JobAgentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - return json.Marshal(objectMap) + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// UnmarshalJSON is the custom unmarshaler for JobStep struct. -func (js *JobStep) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) +// result is the default implementation for JobAgentsCreateOrUpdateFuture.Result. +func (future *JobAgentsCreateOrUpdateFuture) result(client JobAgentsClient) (ja JobAgent, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) if err != nil { - return err + err = autorest.NewErrorWithError(err, "sql.JobAgentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var jobStepProperties JobStepProperties - err = json.Unmarshal(*v, &jobStepProperties) - if err != nil { - return err - } - js.JobStepProperties = &jobStepProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - js.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - js.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - js.Type = &typeVar - } + if !done { + ja.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.JobAgentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ja.Response.Response, err = future.GetResult(sender); err == nil && ja.Response.Response.StatusCode != http.StatusNoContent { + ja, err = client.CreateOrUpdateResponder(ja.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.JobAgentsCreateOrUpdateFuture", "Result", ja.Response.Response, "Failure responding to request") } } - - return nil -} - -// JobStepAction the action to be executed by a job step. -type JobStepAction struct { - // Type - Type of action being executed by the job step. Possible values include: 'JobStepActionTypeTSQL' - Type JobStepActionType `json:"type,omitempty"` - // Source - The source of the action to execute. Possible values include: 'JobStepActionSourceInline' - Source JobStepActionSource `json:"source,omitempty"` - // Value - The action value, for example the text of the T-SQL script to execute. - Value *string `json:"value,omitempty"` + return } -// JobStepExecutionOptions the execution options of a job step. -type JobStepExecutionOptions struct { - // TimeoutSeconds - Execution timeout for the job step. - TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` - // RetryAttempts - Maximum number of times the job step will be reattempted if the first attempt fails. - RetryAttempts *int32 `json:"retryAttempts,omitempty"` - // InitialRetryIntervalSeconds - Initial delay between retries for job step execution. - InitialRetryIntervalSeconds *int32 `json:"initialRetryIntervalSeconds,omitempty"` - // MaximumRetryIntervalSeconds - The maximum amount of time to wait between retries for job step execution. - MaximumRetryIntervalSeconds *int32 `json:"maximumRetryIntervalSeconds,omitempty"` - // RetryIntervalBackoffMultiplier - The backoff multiplier for the time between retries. - RetryIntervalBackoffMultiplier *float64 `json:"retryIntervalBackoffMultiplier,omitempty"` +// JobAgentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type JobAgentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(JobAgentsClient) (autorest.Response, error) } -// JobStepListResult a list of job steps. -type JobStepListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]JobStep `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *JobAgentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// MarshalJSON is the custom marshaler for JobStepListResult. -func (jslr JobStepListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} +// result is the default implementation for JobAgentsDeleteFuture.Result. +func (future *JobAgentsDeleteFuture) result(client JobAgentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.JobAgentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.JobAgentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} -// JobStepListResultIterator provides access to a complete listing of JobStep values. -type JobStepListResultIterator struct { +// JobAgentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type JobAgentsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(JobAgentsClient) (JobAgent, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *JobAgentsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for JobAgentsUpdateFuture.Result. +func (future *JobAgentsUpdateFuture) result(client JobAgentsClient) (ja JobAgent, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.JobAgentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ja.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.JobAgentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ja.Response.Response, err = future.GetResult(sender); err == nil && ja.Response.Response.StatusCode != http.StatusNoContent { + ja, err = client.UpdateResponder(ja.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.JobAgentsUpdateFuture", "Result", ja.Response.Response, "Failure responding to request") + } + } + return +} + +// JobAgentUpdate an update to an Azure SQL job agent. +type JobAgentUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for JobAgentUpdate. +func (jau JobAgentUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if jau.Tags != nil { + objectMap["tags"] = jau.Tags + } + return json.Marshal(objectMap) +} + +// JobCredential a stored credential that can be used by a job to connect to target databases. +type JobCredential struct { + autorest.Response `json:"-"` + // JobCredentialProperties - Resource properties. + *JobCredentialProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobCredential. +func (jc JobCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if jc.JobCredentialProperties != nil { + objectMap["properties"] = jc.JobCredentialProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for JobCredential struct. +func (jc *JobCredential) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var jobCredentialProperties JobCredentialProperties + err = json.Unmarshal(*v, &jobCredentialProperties) + if err != nil { + return err + } + jc.JobCredentialProperties = &jobCredentialProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + jc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + jc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + jc.Type = &typeVar + } + } + } + + return nil +} + +// JobCredentialListResult a list of job credentials. +type JobCredentialListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]JobCredential `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobCredentialListResult. +func (jclr JobCredentialListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// JobCredentialListResultIterator provides access to a complete listing of JobCredential values. +type JobCredentialListResultIterator struct { i int - page JobStepListResultPage + page JobCredentialListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *JobStepListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *JobCredentialListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -11547,67 +11865,67 @@ func (iter *JobStepListResultIterator) NextWithContext(ctx context.Context) (err // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *JobStepListResultIterator) Next() error { +func (iter *JobCredentialListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobStepListResultIterator) NotDone() bool { +func (iter JobCredentialListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter JobStepListResultIterator) Response() JobStepListResult { +func (iter JobCredentialListResultIterator) Response() JobCredentialListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter JobStepListResultIterator) Value() JobStep { +func (iter JobCredentialListResultIterator) Value() JobCredential { if !iter.page.NotDone() { - return JobStep{} + return JobCredential{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the JobStepListResultIterator type. -func NewJobStepListResultIterator(page JobStepListResultPage) JobStepListResultIterator { - return JobStepListResultIterator{page: page} +// Creates a new instance of the JobCredentialListResultIterator type. +func NewJobCredentialListResultIterator(page JobCredentialListResultPage) JobCredentialListResultIterator { + return JobCredentialListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (jslr JobStepListResult) IsEmpty() bool { - return jslr.Value == nil || len(*jslr.Value) == 0 +func (jclr JobCredentialListResult) IsEmpty() bool { + return jclr.Value == nil || len(*jclr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (jslr JobStepListResult) hasNextLink() bool { - return jslr.NextLink != nil && len(*jslr.NextLink) != 0 +func (jclr JobCredentialListResult) hasNextLink() bool { + return jclr.NextLink != nil && len(*jclr.NextLink) != 0 } -// jobStepListResultPreparer prepares a request to retrieve the next set of results. +// jobCredentialListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (jslr JobStepListResult) jobStepListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jslr.hasNextLink() { +func (jclr JobCredentialListResult) jobCredentialListResultPreparer(ctx context.Context) (*http.Request, error) { + if !jclr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(jslr.NextLink))) + autorest.WithBaseURL(to.String(jclr.NextLink))) } -// JobStepListResultPage contains a page of JobStep values. -type JobStepListResultPage struct { - fn func(context.Context, JobStepListResult) (JobStepListResult, error) - jslr JobStepListResult +// JobCredentialListResultPage contains a page of JobCredential values. +type JobCredentialListResultPage struct { + fn func(context.Context, JobCredentialListResult) (JobCredentialListResult, error) + jclr JobCredentialListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *JobStepListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *JobCredentialListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobStepListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -11617,11 +11935,11 @@ func (page *JobStepListResultPage) NextWithContext(ctx context.Context) (err err }() } for { - next, err := page.fn(ctx, page.jslr) + next, err := page.fn(ctx, page.jclr) if err != nil { return err } - page.jslr = next + page.jclr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -11632,96 +11950,49 @@ func (page *JobStepListResultPage) NextWithContext(ctx context.Context) (err err // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *JobStepListResultPage) Next() error { +func (page *JobCredentialListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobStepListResultPage) NotDone() bool { - return !page.jslr.IsEmpty() +func (page JobCredentialListResultPage) NotDone() bool { + return !page.jclr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page JobStepListResultPage) Response() JobStepListResult { - return page.jslr +func (page JobCredentialListResultPage) Response() JobCredentialListResult { + return page.jclr } // Values returns the slice of values for the current page or nil if there are no values. -func (page JobStepListResultPage) Values() []JobStep { - if page.jslr.IsEmpty() { +func (page JobCredentialListResultPage) Values() []JobCredential { + if page.jclr.IsEmpty() { return nil } - return *page.jslr.Value + return *page.jclr.Value } -// Creates a new instance of the JobStepListResultPage type. -func NewJobStepListResultPage(cur JobStepListResult, getNextPage func(context.Context, JobStepListResult) (JobStepListResult, error)) JobStepListResultPage { - return JobStepListResultPage{ +// Creates a new instance of the JobCredentialListResultPage type. +func NewJobCredentialListResultPage(cur JobCredentialListResult, getNextPage func(context.Context, JobCredentialListResult) (JobCredentialListResult, error)) JobCredentialListResultPage { + return JobCredentialListResultPage{ fn: getNextPage, - jslr: cur, + jclr: cur, } } -// JobStepOutput the output configuration of a job step. -type JobStepOutput struct { - // Type - The output destination type. Possible values include: 'JobStepOutputTypeSQLDatabase' - Type JobStepOutputType `json:"type,omitempty"` - // SubscriptionID - The output destination subscription id. - SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` - // ResourceGroupName - The output destination resource group. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // ServerName - The output destination server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - The output destination database. - DatabaseName *string `json:"databaseName,omitempty"` - // SchemaName - The output destination schema. - SchemaName *string `json:"schemaName,omitempty"` - // TableName - The output destination table. - TableName *string `json:"tableName,omitempty"` - // Credential - The resource ID of the credential to use to connect to the output destination. - Credential *string `json:"credential,omitempty"` -} - -// JobStepProperties properties of a job step. -type JobStepProperties struct { - // StepID - The job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified. - StepID *int32 `json:"stepId,omitempty"` - // TargetGroup - The resource ID of the target group that the job step will be executed on. - TargetGroup *string `json:"targetGroup,omitempty"` - // Credential - The resource ID of the job credential that will be used to connect to the targets. - Credential *string `json:"credential,omitempty"` - // Action - The action payload of the job step. - Action *JobStepAction `json:"action,omitempty"` - // Output - Output destination properties of the job step. - Output *JobStepOutput `json:"output,omitempty"` - // ExecutionOptions - Execution options for the job step. - ExecutionOptions *JobStepExecutionOptions `json:"executionOptions,omitempty"` -} - -// JobTarget a job target, for example a specific database or a container of databases that is evaluated -// during job execution. -type JobTarget struct { - // MembershipType - Whether the target is included or excluded from the group. Possible values include: 'JobTargetGroupMembershipTypeInclude', 'JobTargetGroupMembershipTypeExclude' - MembershipType JobTargetGroupMembershipType `json:"membershipType,omitempty"` - // Type - The target type. Possible values include: 'JobTargetTypeTargetGroup', 'JobTargetTypeSQLDatabase', 'JobTargetTypeSQLElasticPool', 'JobTargetTypeSQLShardMap', 'JobTargetTypeSQLServer' - Type JobTargetType `json:"type,omitempty"` - // ServerName - The target server name. - ServerName *string `json:"serverName,omitempty"` - // DatabaseName - The target database name. - DatabaseName *string `json:"databaseName,omitempty"` - // ElasticPoolName - The target elastic pool name. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - // ShardMapName - The target shard map. - ShardMapName *string `json:"shardMapName,omitempty"` - // RefreshCredential - The resource ID of the credential that is used during job execution to connect to the target and determine the list of databases inside the target. - RefreshCredential *string `json:"refreshCredential,omitempty"` +// JobCredentialProperties properties of a job credential. +type JobCredentialProperties struct { + // Username - The credential user name. + Username *string `json:"username,omitempty"` + // Password - The credential password. + Password *string `json:"password,omitempty"` } -// JobTargetGroup a group of job targets. -type JobTargetGroup struct { +// JobExecution an execution of a job +type JobExecution struct { autorest.Response `json:"-"` - // JobTargetGroupProperties - Resource properties. - *JobTargetGroupProperties `json:"properties,omitempty"` + // JobExecutionProperties - Resource properties. + *JobExecutionProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -11730,17 +12001,17 @@ type JobTargetGroup struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for JobTargetGroup. -func (jtg JobTargetGroup) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobExecution. +func (je JobExecution) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if jtg.JobTargetGroupProperties != nil { - objectMap["properties"] = jtg.JobTargetGroupProperties + if je.JobExecutionProperties != nil { + objectMap["properties"] = je.JobExecutionProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for JobTargetGroup struct. -func (jtg *JobTargetGroup) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for JobExecution struct. +func (je *JobExecution) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -11750,12 +12021,12 @@ func (jtg *JobTargetGroup) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var jobTargetGroupProperties JobTargetGroupProperties - err = json.Unmarshal(*v, &jobTargetGroupProperties) + var jobExecutionProperties JobExecutionProperties + err = json.Unmarshal(*v, &jobExecutionProperties) if err != nil { return err } - jtg.JobTargetGroupProperties = &jobTargetGroupProperties + je.JobExecutionProperties = &jobExecutionProperties } case "id": if v != nil { @@ -11764,7 +12035,7 @@ func (jtg *JobTargetGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - jtg.ID = &ID + je.ID = &ID } case "name": if v != nil { @@ -11773,7 +12044,7 @@ func (jtg *JobTargetGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - jtg.Name = &name + je.Name = &name } case "type": if v != nil { @@ -11782,7 +12053,7 @@ func (jtg *JobTargetGroup) UnmarshalJSON(body []byte) error { if err != nil { return err } - jtg.Type = &typeVar + je.Type = &typeVar } } } @@ -11790,32 +12061,32 @@ func (jtg *JobTargetGroup) UnmarshalJSON(body []byte) error { return nil } -// JobTargetGroupListResult a list of target groups. -type JobTargetGroupListResult struct { +// JobExecutionListResult a list of job executions. +type JobExecutionListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]JobTargetGroup `json:"value,omitempty"` + Value *[]JobExecution `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for JobTargetGroupListResult. -func (jtglr JobTargetGroupListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobExecutionListResult. +func (jelr JobExecutionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// JobTargetGroupListResultIterator provides access to a complete listing of JobTargetGroup values. -type JobTargetGroupListResultIterator struct { +// JobExecutionListResultIterator provides access to a complete listing of JobExecution values. +type JobExecutionListResultIterator struct { i int - page JobTargetGroupListResultPage + page JobExecutionListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *JobTargetGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *JobExecutionListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -11840,67 +12111,67 @@ func (iter *JobTargetGroupListResultIterator) NextWithContext(ctx context.Contex // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *JobTargetGroupListResultIterator) Next() error { +func (iter *JobExecutionListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobTargetGroupListResultIterator) NotDone() bool { +func (iter JobExecutionListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter JobTargetGroupListResultIterator) Response() JobTargetGroupListResult { +func (iter JobExecutionListResultIterator) Response() JobExecutionListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter JobTargetGroupListResultIterator) Value() JobTargetGroup { +func (iter JobExecutionListResultIterator) Value() JobExecution { if !iter.page.NotDone() { - return JobTargetGroup{} + return JobExecution{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the JobTargetGroupListResultIterator type. -func NewJobTargetGroupListResultIterator(page JobTargetGroupListResultPage) JobTargetGroupListResultIterator { - return JobTargetGroupListResultIterator{page: page} +// Creates a new instance of the JobExecutionListResultIterator type. +func NewJobExecutionListResultIterator(page JobExecutionListResultPage) JobExecutionListResultIterator { + return JobExecutionListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (jtglr JobTargetGroupListResult) IsEmpty() bool { - return jtglr.Value == nil || len(*jtglr.Value) == 0 +func (jelr JobExecutionListResult) IsEmpty() bool { + return jelr.Value == nil || len(*jelr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (jtglr JobTargetGroupListResult) hasNextLink() bool { - return jtglr.NextLink != nil && len(*jtglr.NextLink) != 0 +func (jelr JobExecutionListResult) hasNextLink() bool { + return jelr.NextLink != nil && len(*jelr.NextLink) != 0 } -// jobTargetGroupListResultPreparer prepares a request to retrieve the next set of results. +// jobExecutionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (jtglr JobTargetGroupListResult) jobTargetGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jtglr.hasNextLink() { +func (jelr JobExecutionListResult) jobExecutionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !jelr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(jtglr.NextLink))) + autorest.WithBaseURL(to.String(jelr.NextLink))) } -// JobTargetGroupListResultPage contains a page of JobTargetGroup values. -type JobTargetGroupListResultPage struct { - fn func(context.Context, JobTargetGroupListResult) (JobTargetGroupListResult, error) - jtglr JobTargetGroupListResult +// JobExecutionListResultPage contains a page of JobExecution values. +type JobExecutionListResultPage struct { + fn func(context.Context, JobExecutionListResult) (JobExecutionListResult, error) + jelr JobExecutionListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *JobTargetGroupListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *JobExecutionListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -11910,11 +12181,11 @@ func (page *JobTargetGroupListResultPage) NextWithContext(ctx context.Context) ( }() } for { - next, err := page.fn(ctx, page.jtglr) + next, err := page.fn(ctx, page.jelr) if err != nil { return err } - page.jtglr = next + page.jelr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -11925,85 +12196,203 @@ func (page *JobTargetGroupListResultPage) NextWithContext(ctx context.Context) ( // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *JobTargetGroupListResultPage) Next() error { +func (page *JobExecutionListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobTargetGroupListResultPage) NotDone() bool { - return !page.jtglr.IsEmpty() +func (page JobExecutionListResultPage) NotDone() bool { + return !page.jelr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page JobTargetGroupListResultPage) Response() JobTargetGroupListResult { - return page.jtglr +func (page JobExecutionListResultPage) Response() JobExecutionListResult { + return page.jelr } // Values returns the slice of values for the current page or nil if there are no values. -func (page JobTargetGroupListResultPage) Values() []JobTargetGroup { - if page.jtglr.IsEmpty() { +func (page JobExecutionListResultPage) Values() []JobExecution { + if page.jelr.IsEmpty() { return nil } - return *page.jtglr.Value + return *page.jelr.Value } -// Creates a new instance of the JobTargetGroupListResultPage type. -func NewJobTargetGroupListResultPage(cur JobTargetGroupListResult, getNextPage func(context.Context, JobTargetGroupListResult) (JobTargetGroupListResult, error)) JobTargetGroupListResultPage { - return JobTargetGroupListResultPage{ - fn: getNextPage, - jtglr: cur, +// Creates a new instance of the JobExecutionListResultPage type. +func NewJobExecutionListResultPage(cur JobExecutionListResult, getNextPage func(context.Context, JobExecutionListResult) (JobExecutionListResult, error)) JobExecutionListResultPage { + return JobExecutionListResultPage{ + fn: getNextPage, + jelr: cur, } } -// JobTargetGroupProperties properties of job target group. -type JobTargetGroupProperties struct { - // Members - Members of the target group. - Members *[]JobTarget `json:"members,omitempty"` -} - -// JobVersion a job version. -type JobVersion struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// JobExecutionProperties properties for an Azure SQL Database Elastic job execution. +type JobExecutionProperties struct { + // JobVersion - READ-ONLY; The job version number. + JobVersion *int32 `json:"jobVersion,omitempty"` + // StepName - READ-ONLY; The job step name. + StepName *string `json:"stepName,omitempty"` + // StepID - READ-ONLY; The job step id. + StepID *int32 `json:"stepId,omitempty"` + // JobExecutionID - READ-ONLY; The unique identifier of the job execution. + JobExecutionID *uuid.UUID `json:"jobExecutionId,omitempty"` + // Lifecycle - READ-ONLY; The detailed state of the job execution. Possible values include: 'JobExecutionLifecycleCreated', 'JobExecutionLifecycleInProgress', 'JobExecutionLifecycleWaitingForChildJobExecutions', 'JobExecutionLifecycleWaitingForRetry', 'JobExecutionLifecycleSucceeded', 'JobExecutionLifecycleSucceededWithSkipped', 'JobExecutionLifecycleFailed', 'JobExecutionLifecycleTimedOut', 'JobExecutionLifecycleCanceled', 'JobExecutionLifecycleSkipped' + Lifecycle JobExecutionLifecycle `json:"lifecycle,omitempty"` + // ProvisioningState - READ-ONLY; The ARM provisioning state of the job execution. Possible values include: 'ProvisioningStateCreated', 'ProvisioningStateInProgress', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // CreateTime - READ-ONLY; The time that the job execution was created. + CreateTime *date.Time `json:"createTime,omitempty"` + // StartTime - READ-ONLY; The time that the job execution started. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - READ-ONLY; The time that the job execution completed. + EndTime *date.Time `json:"endTime,omitempty"` + // CurrentAttempts - Number of times the job execution has been attempted. + CurrentAttempts *int32 `json:"currentAttempts,omitempty"` + // CurrentAttemptStartTime - READ-ONLY; Start time of the current attempt. + CurrentAttemptStartTime *date.Time `json:"currentAttemptStartTime,omitempty"` + // LastMessage - READ-ONLY; The last status or error message. + LastMessage *string `json:"lastMessage,omitempty"` + // Target - READ-ONLY; The target that this execution is executed on. + Target *JobExecutionTarget `json:"target,omitempty"` } -// MarshalJSON is the custom marshaler for JobVersion. -func (jv JobVersion) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobExecutionProperties. +func (jep JobExecutionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if jep.CurrentAttempts != nil { + objectMap["currentAttempts"] = jep.CurrentAttempts + } return json.Marshal(objectMap) } -// JobVersionListResult a list of job versions. -type JobVersionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]JobVersion `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobVersionListResult. -func (jvlr JobVersionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) +// JobExecutionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type JobExecutionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(JobExecutionsClient) (JobExecution, error) } -// JobVersionListResultIterator provides access to a complete listing of JobVersion values. -type JobVersionListResultIterator struct { - i int - page JobVersionListResultPage +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *JobExecutionsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for JobExecutionsCreateFuture.Result. +func (future *JobExecutionsCreateFuture) result(client JobExecutionsClient) (je JobExecution, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + je.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.JobExecutionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if je.Response.Response, err = future.GetResult(sender); err == nil && je.Response.Response.StatusCode != http.StatusNoContent { + je, err = client.CreateResponder(je.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateFuture", "Result", je.Response.Response, "Failure responding to request") + } + } + return +} + +// JobExecutionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type JobExecutionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(JobExecutionsClient) (JobExecution, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *JobExecutionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for JobExecutionsCreateOrUpdateFuture.Result. +func (future *JobExecutionsCreateOrUpdateFuture) result(client JobExecutionsClient) (je JobExecution, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + je.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.JobExecutionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if je.Response.Response, err = future.GetResult(sender); err == nil && je.Response.Response.StatusCode != http.StatusNoContent { + je, err = client.CreateOrUpdateResponder(je.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateOrUpdateFuture", "Result", je.Response.Response, "Failure responding to request") + } + } + return +} + +// JobExecutionTarget the target that a job execution is executed on. +type JobExecutionTarget struct { + // Type - READ-ONLY; The type of the target. Possible values include: 'JobTargetTypeTargetGroup', 'JobTargetTypeSQLDatabase', 'JobTargetTypeSQLElasticPool', 'JobTargetTypeSQLShardMap', 'JobTargetTypeSQLServer' + Type JobTargetType `json:"type,omitempty"` + // ServerName - READ-ONLY; The server name. + ServerName *string `json:"serverName,omitempty"` + // DatabaseName - READ-ONLY; The database name. + DatabaseName *string `json:"databaseName,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobExecutionTarget. +func (jet JobExecutionTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// JobListResult a list of jobs. +type JobListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]Job `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobListResult. +func (jlr JobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// JobListResultIterator provides access to a complete listing of Job values. +type JobListResultIterator struct { + i int + page JobListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *JobVersionListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *JobListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -12028,67 +12417,67 @@ func (iter *JobVersionListResultIterator) NextWithContext(ctx context.Context) ( // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *JobVersionListResultIterator) Next() error { +func (iter *JobListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JobVersionListResultIterator) NotDone() bool { +func (iter JobListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter JobVersionListResultIterator) Response() JobVersionListResult { +func (iter JobListResultIterator) Response() JobListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter JobVersionListResultIterator) Value() JobVersion { +func (iter JobListResultIterator) Value() Job { if !iter.page.NotDone() { - return JobVersion{} + return Job{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the JobVersionListResultIterator type. -func NewJobVersionListResultIterator(page JobVersionListResultPage) JobVersionListResultIterator { - return JobVersionListResultIterator{page: page} +// Creates a new instance of the JobListResultIterator type. +func NewJobListResultIterator(page JobListResultPage) JobListResultIterator { + return JobListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (jvlr JobVersionListResult) IsEmpty() bool { - return jvlr.Value == nil || len(*jvlr.Value) == 0 +func (jlr JobListResult) IsEmpty() bool { + return jlr.Value == nil || len(*jlr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (jvlr JobVersionListResult) hasNextLink() bool { - return jvlr.NextLink != nil && len(*jvlr.NextLink) != 0 +func (jlr JobListResult) hasNextLink() bool { + return jlr.NextLink != nil && len(*jlr.NextLink) != 0 } -// jobVersionListResultPreparer prepares a request to retrieve the next set of results. +// jobListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (jvlr JobVersionListResult) jobVersionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !jvlr.hasNextLink() { +func (jlr JobListResult) jobListResultPreparer(ctx context.Context) (*http.Request, error) { + if !jlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(jvlr.NextLink))) + autorest.WithBaseURL(to.String(jlr.NextLink))) } -// JobVersionListResultPage contains a page of JobVersion values. -type JobVersionListResultPage struct { - fn func(context.Context, JobVersionListResult) (JobVersionListResult, error) - jvlr JobVersionListResult +// JobListResultPage contains a page of Job values. +type JobListResultPage struct { + fn func(context.Context, JobListResult) (JobListResult, error) + jlr JobListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *JobVersionListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *JobListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -12098,11 +12487,11 @@ func (page *JobVersionListResultPage) NextWithContext(ctx context.Context) (err }() } for { - next, err := page.fn(ctx, page.jvlr) + next, err := page.fn(ctx, page.jlr) if err != nil { return err } - page.jvlr = next + page.jlr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -12113,41 +12502,77 @@ func (page *JobVersionListResultPage) NextWithContext(ctx context.Context) (err // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *JobVersionListResultPage) Next() error { +func (page *JobListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JobVersionListResultPage) NotDone() bool { - return !page.jvlr.IsEmpty() +func (page JobListResultPage) NotDone() bool { + return !page.jlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page JobVersionListResultPage) Response() JobVersionListResult { - return page.jvlr +func (page JobListResultPage) Response() JobListResult { + return page.jlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page JobVersionListResultPage) Values() []JobVersion { - if page.jvlr.IsEmpty() { +func (page JobListResultPage) Values() []Job { + if page.jlr.IsEmpty() { return nil } - return *page.jvlr.Value + return *page.jlr.Value } -// Creates a new instance of the JobVersionListResultPage type. -func NewJobVersionListResultPage(cur JobVersionListResult, getNextPage func(context.Context, JobVersionListResult) (JobVersionListResult, error)) JobVersionListResultPage { - return JobVersionListResultPage{ - fn: getNextPage, - jvlr: cur, +// Creates a new instance of the JobListResultPage type. +func NewJobListResultPage(cur JobListResult, getNextPage func(context.Context, JobListResult) (JobListResult, error)) JobListResultPage { + return JobListResultPage{ + fn: getNextPage, + jlr: cur, } } -// LedgerDigestUploads azure SQL Database ledger digest upload settings. -type LedgerDigestUploads struct { +// JobProperties properties of a job. +type JobProperties struct { + // Description - User-defined description of the job. + Description *string `json:"description,omitempty"` + // Version - READ-ONLY; The job version number. + Version *int32 `json:"version,omitempty"` + // Schedule - Schedule properties of the job. + Schedule *JobSchedule `json:"schedule,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobProperties. +func (jp JobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if jp.Description != nil { + objectMap["description"] = jp.Description + } + if jp.Schedule != nil { + objectMap["schedule"] = jp.Schedule + } + return json.Marshal(objectMap) +} + +// JobSchedule scheduling properties of a job. +type JobSchedule struct { + // StartTime - Schedule start time. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - Schedule end time. + EndTime *date.Time `json:"endTime,omitempty"` + // Type - Schedule interval type. Possible values include: 'JobScheduleTypeOnce', 'JobScheduleTypeRecurring' + Type JobScheduleType `json:"type,omitempty"` + // Enabled - Whether or not the schedule is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Interval - Value of the schedule's recurring interval, if the ScheduleType is recurring. ISO8601 duration format. + Interval *string `json:"interval,omitempty"` +} + +// JobStep a job step. +type JobStep struct { autorest.Response `json:"-"` - // LedgerDigestUploadsProperties - Resource properties. - *LedgerDigestUploadsProperties `json:"properties,omitempty"` + // JobStepProperties - Resource properties. + *JobStepProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -12156,17 +12581,17 @@ type LedgerDigestUploads struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for LedgerDigestUploads. -func (ldu LedgerDigestUploads) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobStep. +func (js JobStep) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ldu.LedgerDigestUploadsProperties != nil { - objectMap["properties"] = ldu.LedgerDigestUploadsProperties + if js.JobStepProperties != nil { + objectMap["properties"] = js.JobStepProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for LedgerDigestUploads struct. -func (ldu *LedgerDigestUploads) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for JobStep struct. +func (js *JobStep) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -12176,12 +12601,12 @@ func (ldu *LedgerDigestUploads) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var ledgerDigestUploadsProperties LedgerDigestUploadsProperties - err = json.Unmarshal(*v, &ledgerDigestUploadsProperties) + var jobStepProperties JobStepProperties + err = json.Unmarshal(*v, &jobStepProperties) if err != nil { return err } - ldu.LedgerDigestUploadsProperties = &ledgerDigestUploadsProperties + js.JobStepProperties = &jobStepProperties } case "id": if v != nil { @@ -12190,7 +12615,7 @@ func (ldu *LedgerDigestUploads) UnmarshalJSON(body []byte) error { if err != nil { return err } - ldu.ID = &ID + js.ID = &ID } case "name": if v != nil { @@ -12199,7 +12624,7 @@ func (ldu *LedgerDigestUploads) UnmarshalJSON(body []byte) error { if err != nil { return err } - ldu.Name = &name + js.Name = &name } case "type": if v != nil { @@ -12208,7 +12633,7 @@ func (ldu *LedgerDigestUploads) UnmarshalJSON(body []byte) error { if err != nil { return err } - ldu.Type = &typeVar + js.Type = &typeVar } } } @@ -12216,33 +12641,56 @@ func (ldu *LedgerDigestUploads) UnmarshalJSON(body []byte) error { return nil } -// LedgerDigestUploadsListResult a list of ledger digest upload settings. -type LedgerDigestUploadsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]LedgerDigestUploads `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` +// JobStepAction the action to be executed by a job step. +type JobStepAction struct { + // Type - Type of action being executed by the job step. Possible values include: 'JobStepActionTypeTSQL' + Type JobStepActionType `json:"type,omitempty"` + // Source - The source of the action to execute. Possible values include: 'JobStepActionSourceInline' + Source JobStepActionSource `json:"source,omitempty"` + // Value - The action value, for example the text of the T-SQL script to execute. + Value *string `json:"value,omitempty"` } -// MarshalJSON is the custom marshaler for LedgerDigestUploadsListResult. -func (ldulr LedgerDigestUploadsListResult) MarshalJSON() ([]byte, error) { +// JobStepExecutionOptions the execution options of a job step. +type JobStepExecutionOptions struct { + // TimeoutSeconds - Execution timeout for the job step. + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + // RetryAttempts - Maximum number of times the job step will be reattempted if the first attempt fails. + RetryAttempts *int32 `json:"retryAttempts,omitempty"` + // InitialRetryIntervalSeconds - Initial delay between retries for job step execution. + InitialRetryIntervalSeconds *int32 `json:"initialRetryIntervalSeconds,omitempty"` + // MaximumRetryIntervalSeconds - The maximum amount of time to wait between retries for job step execution. + MaximumRetryIntervalSeconds *int32 `json:"maximumRetryIntervalSeconds,omitempty"` + // RetryIntervalBackoffMultiplier - The backoff multiplier for the time between retries. + RetryIntervalBackoffMultiplier *float64 `json:"retryIntervalBackoffMultiplier,omitempty"` +} + +// JobStepListResult a list of job steps. +type JobStepListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]JobStep `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobStepListResult. +func (jslr JobStepListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// LedgerDigestUploadsListResultIterator provides access to a complete listing of LedgerDigestUploads -// values. -type LedgerDigestUploadsListResultIterator struct { +// JobStepListResultIterator provides access to a complete listing of JobStep values. +type JobStepListResultIterator struct { i int - page LedgerDigestUploadsListResultPage + page JobStepListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *LedgerDigestUploadsListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *JobStepListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LedgerDigestUploadsListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobStepListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -12267,67 +12715,67 @@ func (iter *LedgerDigestUploadsListResultIterator) NextWithContext(ctx context.C // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *LedgerDigestUploadsListResultIterator) Next() error { +func (iter *JobStepListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LedgerDigestUploadsListResultIterator) NotDone() bool { +func (iter JobStepListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter LedgerDigestUploadsListResultIterator) Response() LedgerDigestUploadsListResult { +func (iter JobStepListResultIterator) Response() JobStepListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter LedgerDigestUploadsListResultIterator) Value() LedgerDigestUploads { +func (iter JobStepListResultIterator) Value() JobStep { if !iter.page.NotDone() { - return LedgerDigestUploads{} + return JobStep{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the LedgerDigestUploadsListResultIterator type. -func NewLedgerDigestUploadsListResultIterator(page LedgerDigestUploadsListResultPage) LedgerDigestUploadsListResultIterator { - return LedgerDigestUploadsListResultIterator{page: page} +// Creates a new instance of the JobStepListResultIterator type. +func NewJobStepListResultIterator(page JobStepListResultPage) JobStepListResultIterator { + return JobStepListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (ldulr LedgerDigestUploadsListResult) IsEmpty() bool { - return ldulr.Value == nil || len(*ldulr.Value) == 0 +func (jslr JobStepListResult) IsEmpty() bool { + return jslr.Value == nil || len(*jslr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (ldulr LedgerDigestUploadsListResult) hasNextLink() bool { - return ldulr.NextLink != nil && len(*ldulr.NextLink) != 0 +func (jslr JobStepListResult) hasNextLink() bool { + return jslr.NextLink != nil && len(*jslr.NextLink) != 0 } -// ledgerDigestUploadsListResultPreparer prepares a request to retrieve the next set of results. +// jobStepListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ldulr LedgerDigestUploadsListResult) ledgerDigestUploadsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ldulr.hasNextLink() { +func (jslr JobStepListResult) jobStepListResultPreparer(ctx context.Context) (*http.Request, error) { + if !jslr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ldulr.NextLink))) + autorest.WithBaseURL(to.String(jslr.NextLink))) } -// LedgerDigestUploadsListResultPage contains a page of LedgerDigestUploads values. -type LedgerDigestUploadsListResultPage struct { - fn func(context.Context, LedgerDigestUploadsListResult) (LedgerDigestUploadsListResult, error) - ldulr LedgerDigestUploadsListResult +// JobStepListResultPage contains a page of JobStep values. +type JobStepListResultPage struct { + fn func(context.Context, JobStepListResult) (JobStepListResult, error) + jslr JobStepListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *LedgerDigestUploadsListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *JobStepListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LedgerDigestUploadsListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobStepListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -12337,11 +12785,11 @@ func (page *LedgerDigestUploadsListResultPage) NextWithContext(ctx context.Conte }() } for { - next, err := page.fn(ctx, page.ldulr) + next, err := page.fn(ctx, page.jslr) if err != nil { return err } - page.ldulr = next + page.jslr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -12352,135 +12800,190 @@ func (page *LedgerDigestUploadsListResultPage) NextWithContext(ctx context.Conte // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *LedgerDigestUploadsListResultPage) Next() error { +func (page *JobStepListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LedgerDigestUploadsListResultPage) NotDone() bool { - return !page.ldulr.IsEmpty() +func (page JobStepListResultPage) NotDone() bool { + return !page.jslr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page LedgerDigestUploadsListResultPage) Response() LedgerDigestUploadsListResult { - return page.ldulr +func (page JobStepListResultPage) Response() JobStepListResult { + return page.jslr } // Values returns the slice of values for the current page or nil if there are no values. -func (page LedgerDigestUploadsListResultPage) Values() []LedgerDigestUploads { - if page.ldulr.IsEmpty() { +func (page JobStepListResultPage) Values() []JobStep { + if page.jslr.IsEmpty() { return nil } - return *page.ldulr.Value -} - -// Creates a new instance of the LedgerDigestUploadsListResultPage type. -func NewLedgerDigestUploadsListResultPage(cur LedgerDigestUploadsListResult, getNextPage func(context.Context, LedgerDigestUploadsListResult) (LedgerDigestUploadsListResult, error)) LedgerDigestUploadsListResultPage { - return LedgerDigestUploadsListResultPage{ - fn: getNextPage, - ldulr: cur, - } -} - -// LedgerDigestUploadsProperties the properties of a database ledger digest upload settings. -type LedgerDigestUploadsProperties struct { - // DigestStorageEndpoint - The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure Confidential Ledger. - DigestStorageEndpoint *string `json:"digestStorageEndpoint,omitempty"` - // State - READ-ONLY; Specifies the state of ledger digest upload. Possible values include: 'LedgerDigestUploadsStateEnabled', 'LedgerDigestUploadsStateDisabled' - State LedgerDigestUploadsState `json:"state,omitempty"` + return *page.jslr.Value } -// MarshalJSON is the custom marshaler for LedgerDigestUploadsProperties. -func (ldup LedgerDigestUploadsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ldup.DigestStorageEndpoint != nil { - objectMap["digestStorageEndpoint"] = ldup.DigestStorageEndpoint +// Creates a new instance of the JobStepListResultPage type. +func NewJobStepListResultPage(cur JobStepListResult, getNextPage func(context.Context, JobStepListResult) (JobStepListResult, error)) JobStepListResultPage { + return JobStepListResultPage{ + fn: getNextPage, + jslr: cur, } - return json.Marshal(objectMap) -} - -// LicenseTypeCapability the license type capability -type LicenseTypeCapability struct { - // Name - READ-ONLY; License type identifier. - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` } -// MarshalJSON is the custom marshaler for LicenseTypeCapability. -func (ltc LicenseTypeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ltc.Reason != nil { - objectMap["reason"] = ltc.Reason - } - return json.Marshal(objectMap) +// JobStepOutput the output configuration of a job step. +type JobStepOutput struct { + // Type - The output destination type. Possible values include: 'JobStepOutputTypeSQLDatabase' + Type JobStepOutputType `json:"type,omitempty"` + // SubscriptionID - The output destination subscription id. + SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` + // ResourceGroupName - The output destination resource group. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ServerName - The output destination server name. + ServerName *string `json:"serverName,omitempty"` + // DatabaseName - The output destination database. + DatabaseName *string `json:"databaseName,omitempty"` + // SchemaName - The output destination schema. + SchemaName *string `json:"schemaName,omitempty"` + // TableName - The output destination table. + TableName *string `json:"tableName,omitempty"` + // Credential - The resource ID of the credential to use to connect to the output destination. + Credential *string `json:"credential,omitempty"` } -// ListAdvisor ... -type ListAdvisor struct { - autorest.Response `json:"-"` - Value *[]Advisor `json:"value,omitempty"` +// JobStepProperties properties of a job step. +type JobStepProperties struct { + // StepID - The job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified. + StepID *int32 `json:"stepId,omitempty"` + // TargetGroup - The resource ID of the target group that the job step will be executed on. + TargetGroup *string `json:"targetGroup,omitempty"` + // Credential - The resource ID of the job credential that will be used to connect to the targets. + Credential *string `json:"credential,omitempty"` + // Action - The action payload of the job step. + Action *JobStepAction `json:"action,omitempty"` + // Output - Output destination properties of the job step. + Output *JobStepOutput `json:"output,omitempty"` + // ExecutionOptions - Execution options for the job step. + ExecutionOptions *JobStepExecutionOptions `json:"executionOptions,omitempty"` } -// ListRecommendedAction ... -type ListRecommendedAction struct { - autorest.Response `json:"-"` - Value *[]RecommendedAction `json:"value,omitempty"` +// JobTarget a job target, for example a specific database or a container of databases that is evaluated +// during job execution. +type JobTarget struct { + // MembershipType - Whether the target is included or excluded from the group. Possible values include: 'JobTargetGroupMembershipTypeInclude', 'JobTargetGroupMembershipTypeExclude' + MembershipType JobTargetGroupMembershipType `json:"membershipType,omitempty"` + // Type - The target type. Possible values include: 'JobTargetTypeTargetGroup', 'JobTargetTypeSQLDatabase', 'JobTargetTypeSQLElasticPool', 'JobTargetTypeSQLShardMap', 'JobTargetTypeSQLServer' + Type JobTargetType `json:"type,omitempty"` + // ServerName - The target server name. + ServerName *string `json:"serverName,omitempty"` + // DatabaseName - The target database name. + DatabaseName *string `json:"databaseName,omitempty"` + // ElasticPoolName - The target elastic pool name. + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + // ShardMapName - The target shard map. + ShardMapName *string `json:"shardMapName,omitempty"` + // RefreshCredential - The resource ID of the credential that is used during job execution to connect to the target and determine the list of databases inside the target. + RefreshCredential *string `json:"refreshCredential,omitempty"` } -// LocationCapabilities the location capability. -type LocationCapabilities struct { +// JobTargetGroup a group of job targets. +type JobTargetGroup struct { autorest.Response `json:"-"` - // Name - READ-ONLY; The location name. + // JobTargetGroupProperties - Resource properties. + *JobTargetGroupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // SupportedServerVersions - READ-ONLY; The list of supported server versions. - SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` - // SupportedManagedInstanceVersions - READ-ONLY; The list of supported managed instance versions. - SupportedManagedInstanceVersions *[]ManagedInstanceVersionCapability `json:"supportedManagedInstanceVersions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for LocationCapabilities. -func (lc LocationCapabilities) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobTargetGroup. +func (jtg JobTargetGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if lc.Reason != nil { - objectMap["reason"] = lc.Reason + if jtg.JobTargetGroupProperties != nil { + objectMap["properties"] = jtg.JobTargetGroupProperties } return json.Marshal(objectMap) } -// LogicalServerSecurityAlertPolicyListResult a list of the server's security alert policies. -type LogicalServerSecurityAlertPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogicalServerSecurityAlertPolicyListResult. -func (lssaplr LogicalServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LogicalServerSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ServerSecurityAlertPolicy values. -type LogicalServerSecurityAlertPolicyListResultIterator struct { +// UnmarshalJSON is the custom unmarshaler for JobTargetGroup struct. +func (jtg *JobTargetGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var jobTargetGroupProperties JobTargetGroupProperties + err = json.Unmarshal(*v, &jobTargetGroupProperties) + if err != nil { + return err + } + jtg.JobTargetGroupProperties = &jobTargetGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + jtg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + jtg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + jtg.Type = &typeVar + } + } + } + + return nil +} + +// JobTargetGroupListResult a list of target groups. +type JobTargetGroupListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]JobTargetGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobTargetGroupListResult. +func (jtglr JobTargetGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// JobTargetGroupListResultIterator provides access to a complete listing of JobTargetGroup values. +type JobTargetGroupListResultIterator struct { i int - page LogicalServerSecurityAlertPolicyListResultPage + page JobTargetGroupListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *LogicalServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *JobTargetGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogicalServerSecurityAlertPolicyListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -12505,67 +13008,67 @@ func (iter *LogicalServerSecurityAlertPolicyListResultIterator) NextWithContext( // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *LogicalServerSecurityAlertPolicyListResultIterator) Next() error { +func (iter *JobTargetGroupListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LogicalServerSecurityAlertPolicyListResultIterator) NotDone() bool { +func (iter JobTargetGroupListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter LogicalServerSecurityAlertPolicyListResultIterator) Response() LogicalServerSecurityAlertPolicyListResult { +func (iter JobTargetGroupListResultIterator) Response() JobTargetGroupListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter LogicalServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { +func (iter JobTargetGroupListResultIterator) Value() JobTargetGroup { if !iter.page.NotDone() { - return ServerSecurityAlertPolicy{} + return JobTargetGroup{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the LogicalServerSecurityAlertPolicyListResultIterator type. -func NewLogicalServerSecurityAlertPolicyListResultIterator(page LogicalServerSecurityAlertPolicyListResultPage) LogicalServerSecurityAlertPolicyListResultIterator { - return LogicalServerSecurityAlertPolicyListResultIterator{page: page} +// Creates a new instance of the JobTargetGroupListResultIterator type. +func NewJobTargetGroupListResultIterator(page JobTargetGroupListResultPage) JobTargetGroupListResultIterator { + return JobTargetGroupListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (lssaplr LogicalServerSecurityAlertPolicyListResult) IsEmpty() bool { - return lssaplr.Value == nil || len(*lssaplr.Value) == 0 +func (jtglr JobTargetGroupListResult) IsEmpty() bool { + return jtglr.Value == nil || len(*jtglr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (lssaplr LogicalServerSecurityAlertPolicyListResult) hasNextLink() bool { - return lssaplr.NextLink != nil && len(*lssaplr.NextLink) != 0 +func (jtglr JobTargetGroupListResult) hasNextLink() bool { + return jtglr.NextLink != nil && len(*jtglr.NextLink) != 0 } -// logicalServerSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. +// jobTargetGroupListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (lssaplr LogicalServerSecurityAlertPolicyListResult) logicalServerSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !lssaplr.hasNextLink() { +func (jtglr JobTargetGroupListResult) jobTargetGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !jtglr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(lssaplr.NextLink))) + autorest.WithBaseURL(to.String(jtglr.NextLink))) } -// LogicalServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. -type LogicalServerSecurityAlertPolicyListResultPage struct { - fn func(context.Context, LogicalServerSecurityAlertPolicyListResult) (LogicalServerSecurityAlertPolicyListResult, error) - lssaplr LogicalServerSecurityAlertPolicyListResult +// JobTargetGroupListResultPage contains a page of JobTargetGroup values. +type JobTargetGroupListResultPage struct { + fn func(context.Context, JobTargetGroupListResult) (JobTargetGroupListResult, error) + jtglr JobTargetGroupListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *LogicalServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *JobTargetGroupListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogicalServerSecurityAlertPolicyListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -12575,11 +13078,11 @@ func (page *LogicalServerSecurityAlertPolicyListResultPage) NextWithContext(ctx }() } for { - next, err := page.fn(ctx, page.lssaplr) + next, err := page.fn(ctx, page.jtglr) if err != nil { return err } - page.lssaplr = next + page.jtglr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -12590,55 +13093,45 @@ func (page *LogicalServerSecurityAlertPolicyListResultPage) NextWithContext(ctx // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *LogicalServerSecurityAlertPolicyListResultPage) Next() error { +func (page *JobTargetGroupListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LogicalServerSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.lssaplr.IsEmpty() +func (page JobTargetGroupListResultPage) NotDone() bool { + return !page.jtglr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page LogicalServerSecurityAlertPolicyListResultPage) Response() LogicalServerSecurityAlertPolicyListResult { - return page.lssaplr +func (page JobTargetGroupListResultPage) Response() JobTargetGroupListResult { + return page.jtglr } // Values returns the slice of values for the current page or nil if there are no values. -func (page LogicalServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { - if page.lssaplr.IsEmpty() { +func (page JobTargetGroupListResultPage) Values() []JobTargetGroup { + if page.jtglr.IsEmpty() { return nil } - return *page.lssaplr.Value + return *page.jtglr.Value } -// Creates a new instance of the LogicalServerSecurityAlertPolicyListResultPage type. -func NewLogicalServerSecurityAlertPolicyListResultPage(cur LogicalServerSecurityAlertPolicyListResult, getNextPage func(context.Context, LogicalServerSecurityAlertPolicyListResult) (LogicalServerSecurityAlertPolicyListResult, error)) LogicalServerSecurityAlertPolicyListResultPage { - return LogicalServerSecurityAlertPolicyListResultPage{ - fn: getNextPage, - lssaplr: cur, +// Creates a new instance of the JobTargetGroupListResultPage type. +func NewJobTargetGroupListResultPage(cur JobTargetGroupListResult, getNextPage func(context.Context, JobTargetGroupListResult) (JobTargetGroupListResult, error)) JobTargetGroupListResultPage { + return JobTargetGroupListResultPage{ + fn: getNextPage, + jtglr: cur, } } -// LogSizeCapability the log size capability. -type LogSizeCapability struct { - // Limit - READ-ONLY; The log size limit (see 'unit' for the units). - Limit *int32 `json:"limit,omitempty"` - // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'LogSizeUnitMegabytes', 'LogSizeUnitGigabytes', 'LogSizeUnitTerabytes', 'LogSizeUnitPetabytes', 'LogSizeUnitPercent' - Unit LogSizeUnit `json:"unit,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogSizeCapability. -func (lsc LogSizeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) +// JobTargetGroupProperties properties of job target group. +type JobTargetGroupProperties struct { + // Members - Members of the target group. + Members *[]JobTarget `json:"members,omitempty"` } -// LongTermRetentionBackup a long term retention backup. -type LongTermRetentionBackup struct { +// JobVersion a job version. +type JobVersion struct { autorest.Response `json:"-"` - // LongTermRetentionBackupProperties - Resource properties. - *LongTermRetentionBackupProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -12647,93 +13140,38 @@ type LongTermRetentionBackup struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for LongTermRetentionBackup. -func (ltrb LongTermRetentionBackup) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobVersion. +func (jv JobVersion) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ltrb.LongTermRetentionBackupProperties != nil { - objectMap["properties"] = ltrb.LongTermRetentionBackupProperties - } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for LongTermRetentionBackup struct. -func (ltrb *LongTermRetentionBackup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var longTermRetentionBackupProperties LongTermRetentionBackupProperties - err = json.Unmarshal(*v, &longTermRetentionBackupProperties) - if err != nil { - return err - } - ltrb.LongTermRetentionBackupProperties = &longTermRetentionBackupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ltrb.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ltrb.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ltrb.Type = &typeVar - } - } - } - - return nil -} - -// LongTermRetentionBackupListResult a list of long term retention backups. -type LongTermRetentionBackupListResult struct { +// JobVersionListResult a list of job versions. +type JobVersionListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]LongTermRetentionBackup `json:"value,omitempty"` + Value *[]JobVersion `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for LongTermRetentionBackupListResult. -func (ltrblr LongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for JobVersionListResult. +func (jvlr JobVersionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// LongTermRetentionBackupListResultIterator provides access to a complete listing of -// LongTermRetentionBackup values. -type LongTermRetentionBackupListResultIterator struct { +// JobVersionListResultIterator provides access to a complete listing of JobVersion values. +type JobVersionListResultIterator struct { i int - page LongTermRetentionBackupListResultPage + page JobVersionListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *LongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *JobVersionListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -12758,67 +13196,67 @@ func (iter *LongTermRetentionBackupListResultIterator) NextWithContext(ctx conte // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *LongTermRetentionBackupListResultIterator) Next() error { +func (iter *JobVersionListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LongTermRetentionBackupListResultIterator) NotDone() bool { +func (iter JobVersionListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter LongTermRetentionBackupListResultIterator) Response() LongTermRetentionBackupListResult { +func (iter JobVersionListResultIterator) Response() JobVersionListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter LongTermRetentionBackupListResultIterator) Value() LongTermRetentionBackup { +func (iter JobVersionListResultIterator) Value() JobVersion { if !iter.page.NotDone() { - return LongTermRetentionBackup{} + return JobVersion{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the LongTermRetentionBackupListResultIterator type. -func NewLongTermRetentionBackupListResultIterator(page LongTermRetentionBackupListResultPage) LongTermRetentionBackupListResultIterator { - return LongTermRetentionBackupListResultIterator{page: page} +// Creates a new instance of the JobVersionListResultIterator type. +func NewJobVersionListResultIterator(page JobVersionListResultPage) JobVersionListResultIterator { + return JobVersionListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (ltrblr LongTermRetentionBackupListResult) IsEmpty() bool { - return ltrblr.Value == nil || len(*ltrblr.Value) == 0 +func (jvlr JobVersionListResult) IsEmpty() bool { + return jvlr.Value == nil || len(*jvlr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (ltrblr LongTermRetentionBackupListResult) hasNextLink() bool { - return ltrblr.NextLink != nil && len(*ltrblr.NextLink) != 0 +func (jvlr JobVersionListResult) hasNextLink() bool { + return jvlr.NextLink != nil && len(*jvlr.NextLink) != 0 } -// longTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. +// jobVersionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ltrblr LongTermRetentionBackupListResult) longTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ltrblr.hasNextLink() { +func (jvlr JobVersionListResult) jobVersionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !jvlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ltrblr.NextLink))) + autorest.WithBaseURL(to.String(jvlr.NextLink))) } -// LongTermRetentionBackupListResultPage contains a page of LongTermRetentionBackup values. -type LongTermRetentionBackupListResultPage struct { - fn func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error) - ltrblr LongTermRetentionBackupListResult +// JobVersionListResultPage contains a page of JobVersion values. +type JobVersionListResultPage struct { + fn func(context.Context, JobVersionListResult) (JobVersionListResult, error) + jvlr JobVersionListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *JobVersionListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -12828,11 +13266,11 @@ func (page *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.C }() } for { - next, err := page.fn(ctx, page.ltrblr) + next, err := page.fn(ctx, page.jvlr) if err != nil { return err } - page.ltrblr = next + page.jvlr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -12843,41 +13281,41 @@ func (page *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.C // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *LongTermRetentionBackupListResultPage) Next() error { +func (page *JobVersionListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LongTermRetentionBackupListResultPage) NotDone() bool { - return !page.ltrblr.IsEmpty() +func (page JobVersionListResultPage) NotDone() bool { + return !page.jvlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page LongTermRetentionBackupListResultPage) Response() LongTermRetentionBackupListResult { - return page.ltrblr +func (page JobVersionListResultPage) Response() JobVersionListResult { + return page.jvlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page LongTermRetentionBackupListResultPage) Values() []LongTermRetentionBackup { - if page.ltrblr.IsEmpty() { +func (page JobVersionListResultPage) Values() []JobVersion { + if page.jvlr.IsEmpty() { return nil } - return *page.ltrblr.Value + return *page.jvlr.Value } -// Creates a new instance of the LongTermRetentionBackupListResultPage type. -func NewLongTermRetentionBackupListResultPage(cur LongTermRetentionBackupListResult, getNextPage func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error)) LongTermRetentionBackupListResultPage { - return LongTermRetentionBackupListResultPage{ - fn: getNextPage, - ltrblr: cur, +// Creates a new instance of the JobVersionListResultPage type. +func NewJobVersionListResultPage(cur JobVersionListResult, getNextPage func(context.Context, JobVersionListResult) (JobVersionListResult, error)) JobVersionListResultPage { + return JobVersionListResultPage{ + fn: getNextPage, + jvlr: cur, } } -// LongTermRetentionBackupOperationResult a LongTermRetentionBackup operation result resource. -type LongTermRetentionBackupOperationResult struct { +// LedgerDigestUploads azure SQL Database ledger digest upload settings. +type LedgerDigestUploads struct { autorest.Response `json:"-"` - // LongTermRetentionOperationResultProperties - Resource properties. - *LongTermRetentionOperationResultProperties `json:"properties,omitempty"` + // LedgerDigestUploadsProperties - Resource properties. + *LedgerDigestUploadsProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -12886,17 +13324,17 @@ type LongTermRetentionBackupOperationResult struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for LongTermRetentionBackupOperationResult. -func (ltrbor LongTermRetentionBackupOperationResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LedgerDigestUploads. +func (ldu LedgerDigestUploads) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ltrbor.LongTermRetentionOperationResultProperties != nil { - objectMap["properties"] = ltrbor.LongTermRetentionOperationResultProperties + if ldu.LedgerDigestUploadsProperties != nil { + objectMap["properties"] = ldu.LedgerDigestUploadsProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for LongTermRetentionBackupOperationResult struct. -func (ltrbor *LongTermRetentionBackupOperationResult) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for LedgerDigestUploads struct. +func (ldu *LedgerDigestUploads) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -12906,12 +13344,12 @@ func (ltrbor *LongTermRetentionBackupOperationResult) UnmarshalJSON(body []byte) switch k { case "properties": if v != nil { - var longTermRetentionOperationResultProperties LongTermRetentionOperationResultProperties - err = json.Unmarshal(*v, &longTermRetentionOperationResultProperties) + var ledgerDigestUploadsProperties LedgerDigestUploadsProperties + err = json.Unmarshal(*v, &ledgerDigestUploadsProperties) if err != nil { return err } - ltrbor.LongTermRetentionOperationResultProperties = &longTermRetentionOperationResultProperties + ldu.LedgerDigestUploadsProperties = &ledgerDigestUploadsProperties } case "id": if v != nil { @@ -12920,7 +13358,7 @@ func (ltrbor *LongTermRetentionBackupOperationResult) UnmarshalJSON(body []byte) if err != nil { return err } - ltrbor.ID = &ID + ldu.ID = &ID } case "name": if v != nil { @@ -12929,7 +13367,7 @@ func (ltrbor *LongTermRetentionBackupOperationResult) UnmarshalJSON(body []byte) if err != nil { return err } - ltrbor.Name = &name + ldu.Name = &name } case "type": if v != nil { @@ -12938,7 +13376,7 @@ func (ltrbor *LongTermRetentionBackupOperationResult) UnmarshalJSON(body []byte) if err != nil { return err } - ltrbor.Type = &typeVar + ldu.Type = &typeVar } } } @@ -12946,46 +13384,17 @@ func (ltrbor *LongTermRetentionBackupOperationResult) UnmarshalJSON(body []byte) return nil } -// LongTermRetentionBackupProperties properties of a long term retention backup -type LongTermRetentionBackupProperties struct { - // ServerName - READ-ONLY; The server name that the backup database belong to. - ServerName *string `json:"serverName,omitempty"` - // ServerCreateTime - READ-ONLY; The create time of the server. - ServerCreateTime *date.Time `json:"serverCreateTime,omitempty"` - // DatabaseName - READ-ONLY; The name of the database the backup belong to - DatabaseName *string `json:"databaseName,omitempty"` - // DatabaseDeletionTime - READ-ONLY; The delete time of the database - DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` - // BackupTime - READ-ONLY; The time the backup was taken - BackupTime *date.Time `json:"backupTime,omitempty"` - // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. - BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` - // BackupStorageRedundancy - READ-ONLY; The storage redundancy type of the backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone' - BackupStorageRedundancy BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty"` - // RequestedBackupStorageRedundancy - The storage redundancy type of the backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone' - RequestedBackupStorageRedundancy BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` -} - -// MarshalJSON is the custom marshaler for LongTermRetentionBackupProperties. -func (ltrbp LongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ltrbp.RequestedBackupStorageRedundancy != "" { - objectMap["requestedBackupStorageRedundancy"] = ltrbp.RequestedBackupStorageRedundancy - } - return json.Marshal(objectMap) -} - -// LongTermRetentionBackupsCopyByResourceGroupFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LongTermRetentionBackupsCopyByResourceGroupFuture struct { +// LedgerDigestUploadsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LedgerDigestUploadsCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) + Result func(LedgerDigestUploadsClient) (LedgerDigestUploads, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsCopyByResourceGroupFuture) UnmarshalJSON(body []byte) error { +func (future *LedgerDigestUploadsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -12995,40 +13404,40 @@ func (future *LongTermRetentionBackupsCopyByResourceGroupFuture) UnmarshalJSON(b return nil } -// result is the default implementation for LongTermRetentionBackupsCopyByResourceGroupFuture.Result. -func (future *LongTermRetentionBackupsCopyByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { +// result is the default implementation for LedgerDigestUploadsCreateOrUpdateFuture.Result. +func (future *LedgerDigestUploadsCreateOrUpdateFuture) result(client LedgerDigestUploadsClient) (ldu LedgerDigestUploads, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyByResourceGroupFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - ltrbor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsCopyByResourceGroupFuture") + ldu.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LedgerDigestUploadsCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { - ltrbor, err = client.CopyByResourceGroupResponder(ltrbor.Response.Response) + if ldu.Response.Response, err = future.GetResult(sender); err == nil && ldu.Response.Response.StatusCode != http.StatusNoContent { + ldu, err = client.CreateOrUpdateResponder(ldu.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyByResourceGroupFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsCreateOrUpdateFuture", "Result", ldu.Response.Response, "Failure responding to request") } } return } -// LongTermRetentionBackupsCopyFuture an abstraction for monitoring and retrieving the results of a +// LedgerDigestUploadsDisableFuture an abstraction for monitoring and retrieving the results of a // long-running operation. -type LongTermRetentionBackupsCopyFuture struct { +type LedgerDigestUploadsDisableFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) + Result func(LedgerDigestUploadsClient) (LedgerDigestUploads, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsCopyFuture) UnmarshalJSON(body []byte) error { +func (future *LedgerDigestUploadsDisableFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -13038,336 +13447,272 @@ func (future *LongTermRetentionBackupsCopyFuture) UnmarshalJSON(body []byte) err return nil } -// result is the default implementation for LongTermRetentionBackupsCopyFuture.Result. -func (future *LongTermRetentionBackupsCopyFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { +// result is the default implementation for LedgerDigestUploadsDisableFuture.Result. +func (future *LedgerDigestUploadsDisableFuture) result(client LedgerDigestUploadsClient) (ldu LedgerDigestUploads, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsDisableFuture", "Result", future.Response(), "Polling failure") return } if !done { - ltrbor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsCopyFuture") + ldu.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LedgerDigestUploadsDisableFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { - ltrbor, err = client.CopyResponder(ltrbor.Response.Response) + if ldu.Response.Response, err = future.GetResult(sender); err == nil && ldu.Response.Response.StatusCode != http.StatusNoContent { + ldu, err = client.DisableResponder(ldu.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.LedgerDigestUploadsDisableFuture", "Result", ldu.Response.Response, "Failure responding to request") } } return } -// LongTermRetentionBackupsDeleteByResourceGroupFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LongTermRetentionBackupsDeleteByResourceGroupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (autorest.Response, error) +// LedgerDigestUploadsListResult a list of ledger digest upload settings. +type LedgerDigestUploadsListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]LedgerDigestUploads `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { +// MarshalJSON is the custom marshaler for LedgerDigestUploadsListResult. +func (ldulr LedgerDigestUploadsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LedgerDigestUploadsListResultIterator provides access to a complete listing of LedgerDigestUploads +// values. +type LedgerDigestUploadsListResultIterator struct { + i int + page LedgerDigestUploadsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LedgerDigestUploadsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LedgerDigestUploadsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- return err } - future.FutureAPI = &azFuture - future.Result = future.result + iter.i = 0 return nil } -// result is the default implementation for LongTermRetentionBackupsDeleteByResourceGroupFuture.Result. -func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteByResourceGroupFuture") - return - } - ar.Response = future.Response() - return +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LedgerDigestUploadsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) } -// LongTermRetentionBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LongTermRetentionBackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (autorest.Response, error) +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LedgerDigestUploadsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// Response returns the raw server response from the last page request. +func (iter LedgerDigestUploadsListResultIterator) Response() LedgerDigestUploadsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LedgerDigestUploadsListResultIterator) Value() LedgerDigestUploads { + if !iter.page.NotDone() { + return LedgerDigestUploads{} } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return iter.page.Values()[iter.i] } -// result is the default implementation for LongTermRetentionBackupsDeleteFuture.Result. -func (future *LongTermRetentionBackupsDeleteFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteFuture") - return - } - ar.Response = future.Response() - return +// Creates a new instance of the LedgerDigestUploadsListResultIterator type. +func NewLedgerDigestUploadsListResultIterator(page LedgerDigestUploadsListResultPage) LedgerDigestUploadsListResultIterator { + return LedgerDigestUploadsListResultIterator{page: page} } -// LongTermRetentionBackupsUpdateByResourceGroupFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LongTermRetentionBackupsUpdateByResourceGroupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) +// IsEmpty returns true if the ListResult contains no values. +func (ldulr LedgerDigestUploadsListResult) IsEmpty() bool { + return ldulr.Value == nil || len(*ldulr.Value) == 0 } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsUpdateByResourceGroupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// hasNextLink returns true if the NextLink is not empty. +func (ldulr LedgerDigestUploadsListResult) hasNextLink() bool { + return ldulr.NextLink != nil && len(*ldulr.NextLink) != 0 } -// result is the default implementation for LongTermRetentionBackupsUpdateByResourceGroupFuture.Result. -func (future *LongTermRetentionBackupsUpdateByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateByResourceGroupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ltrbor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsUpdateByResourceGroupFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { - ltrbor, err = client.UpdateByResourceGroupResponder(ltrbor.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateByResourceGroupFuture", "Result", ltrbor.Response.Response, "Failure responding to request") - } +// ledgerDigestUploadsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ldulr LedgerDigestUploadsListResult) ledgerDigestUploadsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ldulr.hasNextLink() { + return nil, nil } - return -} - -// LongTermRetentionBackupsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type LongTermRetentionBackupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ldulr.NextLink))) } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionBackupsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// LedgerDigestUploadsListResultPage contains a page of LedgerDigestUploads values. +type LedgerDigestUploadsListResultPage struct { + fn func(context.Context, LedgerDigestUploadsListResult) (LedgerDigestUploadsListResult, error) + ldulr LedgerDigestUploadsListResult } -// result is the default implementation for LongTermRetentionBackupsUpdateFuture.Result. -func (future *LongTermRetentionBackupsUpdateFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ltrbor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsUpdateFuture") - return +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LedgerDigestUploadsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LedgerDigestUploadsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { - ltrbor, err = client.UpdateResponder(ltrbor.Response.Response) + for { + next, err := page.fn(ctx, page.ldulr) if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + return err + } + page.ldulr = next + if !next.hasNextLink() || !next.IsEmpty() { + break } } - return -} - -// LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) + return nil } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LedgerDigestUploadsListResultPage) Next() error { + return page.NextWithContext(context.Background()) } -// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture.Result. -func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture") - return - } - ar.Response = future.Response() - return +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LedgerDigestUploadsListResultPage) NotDone() bool { + return !page.ldulr.IsEmpty() } -// LongTermRetentionManagedInstanceBackupsDeleteFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type LongTermRetentionManagedInstanceBackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) +// Response returns the raw server response from the last page request. +func (page LedgerDigestUploadsListResultPage) Response() LedgerDigestUploadsListResult { + return page.ldulr } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// Values returns the slice of values for the current page or nil if there are no values. +func (page LedgerDigestUploadsListResultPage) Values() []LedgerDigestUploads { + if page.ldulr.IsEmpty() { + return nil } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return *page.ldulr.Value } -// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteFuture.Result. -func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteFuture") - return +// Creates a new instance of the LedgerDigestUploadsListResultPage type. +func NewLedgerDigestUploadsListResultPage(cur LedgerDigestUploadsListResult, getNextPage func(context.Context, LedgerDigestUploadsListResult) (LedgerDigestUploadsListResult, error)) LedgerDigestUploadsListResultPage { + return LedgerDigestUploadsListResultPage{ + fn: getNextPage, + ldulr: cur, } - ar.Response = future.Response() - return } -// LongTermRetentionOperationResultProperties contains the operation result properties for long term -// retention backup operation. -type LongTermRetentionOperationResultProperties struct { - // RequestID - READ-ONLY; Request Id. - RequestID *uuid.UUID `json:"requestId,omitempty"` - // OperationType - READ-ONLY; Operation type. - OperationType *string `json:"operationType,omitempty"` - // FromBackupResourceID - READ-ONLY; Source backup resource id - FromBackupResourceID *string `json:"fromBackupResourceId,omitempty"` - // ToBackupResourceID - READ-ONLY; Target backup resource id - ToBackupResourceID *string `json:"toBackupResourceId,omitempty"` - // TargetBackupStorageRedundancy - READ-ONLY; The storage redundancy type of the copied backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone' - TargetBackupStorageRedundancy BackupStorageRedundancy `json:"targetBackupStorageRedundancy,omitempty"` - // Status - READ-ONLY; Operation status - Status *string `json:"status,omitempty"` - // Message - READ-ONLY; Progress message - Message *string `json:"message,omitempty"` +// LedgerDigestUploadsProperties the properties of a database ledger digest upload settings. +type LedgerDigestUploadsProperties struct { + // DigestStorageEndpoint - The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure Confidential Ledger. + DigestStorageEndpoint *string `json:"digestStorageEndpoint,omitempty"` + // State - READ-ONLY; Specifies the state of ledger digest upload. Possible values include: 'LedgerDigestUploadsStateEnabled', 'LedgerDigestUploadsStateDisabled' + State LedgerDigestUploadsState `json:"state,omitempty"` } -// MarshalJSON is the custom marshaler for LongTermRetentionOperationResultProperties. -func (ltrorp LongTermRetentionOperationResultProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LedgerDigestUploadsProperties. +func (ldup LedgerDigestUploadsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if ldup.DigestStorageEndpoint != nil { + objectMap["digestStorageEndpoint"] = ldup.DigestStorageEndpoint + } return json.Marshal(objectMap) } -// LongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type LongTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(LongTermRetentionPoliciesClient) (LongTermRetentionPolicy, error) +// LicenseTypeCapability the license type capability +type LicenseTypeCapability struct { + // Name - READ-ONLY; License type identifier. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *LongTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// MarshalJSON is the custom marshaler for LicenseTypeCapability. +func (ltc LicenseTypeCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ltc.Reason != nil { + objectMap["reason"] = ltc.Reason } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return json.Marshal(objectMap) } -// result is the default implementation for LongTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *LongTermRetentionPoliciesCreateOrUpdateFuture) result(client LongTermRetentionPoliciesClient) (ltrp LongTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ltrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ltrp.Response.Response, err = future.GetResult(sender); err == nil && ltrp.Response.Response.StatusCode != http.StatusNoContent { - ltrp, err = client.CreateOrUpdateResponder(ltrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesCreateOrUpdateFuture", "Result", ltrp.Response.Response, "Failure responding to request") - } +// ListAdvisor ... +type ListAdvisor struct { + autorest.Response `json:"-"` + Value *[]Advisor `json:"value,omitempty"` +} + +// ListRecommendedAction ... +type ListRecommendedAction struct { + autorest.Response `json:"-"` + Value *[]RecommendedAction `json:"value,omitempty"` +} + +// LocationCapabilities the location capability. +type LocationCapabilities struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; The location name. + Name *string `json:"name,omitempty"` + // SupportedServerVersions - READ-ONLY; The list of supported server versions. + SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` + // SupportedManagedInstanceVersions - READ-ONLY; The list of supported managed instance versions. + SupportedManagedInstanceVersions *[]ManagedInstanceVersionCapability `json:"supportedManagedInstanceVersions,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocationCapabilities. +func (lc LocationCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lc.Reason != nil { + objectMap["reason"] = lc.Reason } - return + return json.Marshal(objectMap) } -// LongTermRetentionPolicy a long term retention policy. -type LongTermRetentionPolicy struct { +// LogicalDatabaseTransparentDataEncryption a logical database transparent data encryption state. +type LogicalDatabaseTransparentDataEncryption struct { autorest.Response `json:"-"` - // BaseLongTermRetentionPolicyProperties - Resource properties. - *BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"` + // TransparentDataEncryptionProperties - Resource properties. + *TransparentDataEncryptionProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -13376,17 +13721,17 @@ type LongTermRetentionPolicy struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for LongTermRetentionPolicy. -func (ltrp LongTermRetentionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LogicalDatabaseTransparentDataEncryption. +func (ldtde LogicalDatabaseTransparentDataEncryption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ltrp.BaseLongTermRetentionPolicyProperties != nil { - objectMap["properties"] = ltrp.BaseLongTermRetentionPolicyProperties + if ldtde.TransparentDataEncryptionProperties != nil { + objectMap["properties"] = ldtde.TransparentDataEncryptionProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for LongTermRetentionPolicy struct. -func (ltrp *LongTermRetentionPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for LogicalDatabaseTransparentDataEncryption struct. +func (ldtde *LogicalDatabaseTransparentDataEncryption) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -13396,12 +13741,12 @@ func (ltrp *LongTermRetentionPolicy) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var baseLongTermRetentionPolicyProperties BaseLongTermRetentionPolicyProperties - err = json.Unmarshal(*v, &baseLongTermRetentionPolicyProperties) + var transparentDataEncryptionProperties TransparentDataEncryptionProperties + err = json.Unmarshal(*v, &transparentDataEncryptionProperties) if err != nil { return err } - ltrp.BaseLongTermRetentionPolicyProperties = &baseLongTermRetentionPolicyProperties + ldtde.TransparentDataEncryptionProperties = &transparentDataEncryptionProperties } case "id": if v != nil { @@ -13410,7 +13755,7 @@ func (ltrp *LongTermRetentionPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - ltrp.ID = &ID + ldtde.ID = &ID } case "name": if v != nil { @@ -13419,7 +13764,7 @@ func (ltrp *LongTermRetentionPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - ltrp.Name = &name + ldtde.Name = &name } case "type": if v != nil { @@ -13428,7 +13773,7 @@ func (ltrp *LongTermRetentionPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - ltrp.Type = &typeVar + ldtde.Type = &typeVar } } } @@ -13436,33 +13781,33 @@ func (ltrp *LongTermRetentionPolicy) UnmarshalJSON(body []byte) error { return nil } -// LongTermRetentionPolicyListResult a list of long term retention policies. -type LongTermRetentionPolicyListResult struct { +// LogicalDatabaseTransparentDataEncryptionListResult a list of transparent data encryptions +type LogicalDatabaseTransparentDataEncryptionListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]LongTermRetentionPolicy `json:"value,omitempty"` + Value *[]LogicalDatabaseTransparentDataEncryption `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for LongTermRetentionPolicyListResult. -func (ltrplr LongTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LogicalDatabaseTransparentDataEncryptionListResult. +func (ldtdelr LogicalDatabaseTransparentDataEncryptionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// LongTermRetentionPolicyListResultIterator provides access to a complete listing of -// LongTermRetentionPolicy values. -type LongTermRetentionPolicyListResultIterator struct { +// LogicalDatabaseTransparentDataEncryptionListResultIterator provides access to a complete listing of +// LogicalDatabaseTransparentDataEncryption values. +type LogicalDatabaseTransparentDataEncryptionListResultIterator struct { i int - page LongTermRetentionPolicyListResultPage + page LogicalDatabaseTransparentDataEncryptionListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *LongTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *LogicalDatabaseTransparentDataEncryptionListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPolicyListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/LogicalDatabaseTransparentDataEncryptionListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -13487,67 +13832,68 @@ func (iter *LongTermRetentionPolicyListResultIterator) NextWithContext(ctx conte // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *LongTermRetentionPolicyListResultIterator) Next() error { +func (iter *LogicalDatabaseTransparentDataEncryptionListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter LongTermRetentionPolicyListResultIterator) NotDone() bool { +func (iter LogicalDatabaseTransparentDataEncryptionListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter LongTermRetentionPolicyListResultIterator) Response() LongTermRetentionPolicyListResult { +func (iter LogicalDatabaseTransparentDataEncryptionListResultIterator) Response() LogicalDatabaseTransparentDataEncryptionListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter LongTermRetentionPolicyListResultIterator) Value() LongTermRetentionPolicy { +func (iter LogicalDatabaseTransparentDataEncryptionListResultIterator) Value() LogicalDatabaseTransparentDataEncryption { if !iter.page.NotDone() { - return LongTermRetentionPolicy{} + return LogicalDatabaseTransparentDataEncryption{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the LongTermRetentionPolicyListResultIterator type. -func NewLongTermRetentionPolicyListResultIterator(page LongTermRetentionPolicyListResultPage) LongTermRetentionPolicyListResultIterator { - return LongTermRetentionPolicyListResultIterator{page: page} +// Creates a new instance of the LogicalDatabaseTransparentDataEncryptionListResultIterator type. +func NewLogicalDatabaseTransparentDataEncryptionListResultIterator(page LogicalDatabaseTransparentDataEncryptionListResultPage) LogicalDatabaseTransparentDataEncryptionListResultIterator { + return LogicalDatabaseTransparentDataEncryptionListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (ltrplr LongTermRetentionPolicyListResult) IsEmpty() bool { - return ltrplr.Value == nil || len(*ltrplr.Value) == 0 +func (ldtdelr LogicalDatabaseTransparentDataEncryptionListResult) IsEmpty() bool { + return ldtdelr.Value == nil || len(*ldtdelr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (ltrplr LongTermRetentionPolicyListResult) hasNextLink() bool { - return ltrplr.NextLink != nil && len(*ltrplr.NextLink) != 0 +func (ldtdelr LogicalDatabaseTransparentDataEncryptionListResult) hasNextLink() bool { + return ldtdelr.NextLink != nil && len(*ldtdelr.NextLink) != 0 } -// longTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. +// logicalDatabaseTransparentDataEncryptionListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ltrplr LongTermRetentionPolicyListResult) longTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ltrplr.hasNextLink() { +func (ldtdelr LogicalDatabaseTransparentDataEncryptionListResult) logicalDatabaseTransparentDataEncryptionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ldtdelr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ltrplr.NextLink))) + autorest.WithBaseURL(to.String(ldtdelr.NextLink))) } -// LongTermRetentionPolicyListResultPage contains a page of LongTermRetentionPolicy values. -type LongTermRetentionPolicyListResultPage struct { - fn func(context.Context, LongTermRetentionPolicyListResult) (LongTermRetentionPolicyListResult, error) - ltrplr LongTermRetentionPolicyListResult +// LogicalDatabaseTransparentDataEncryptionListResultPage contains a page of +// LogicalDatabaseTransparentDataEncryption values. +type LogicalDatabaseTransparentDataEncryptionListResultPage struct { + fn func(context.Context, LogicalDatabaseTransparentDataEncryptionListResult) (LogicalDatabaseTransparentDataEncryptionListResult, error) + ldtdelr LogicalDatabaseTransparentDataEncryptionListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *LongTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *LogicalDatabaseTransparentDataEncryptionListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPolicyListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/LogicalDatabaseTransparentDataEncryptionListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -13557,11 +13903,11 @@ func (page *LongTermRetentionPolicyListResultPage) NextWithContext(ctx context.C }() } for { - next, err := page.fn(ctx, page.ltrplr) + next, err := page.fn(ctx, page.ldtdelr) if err != nil { return err } - page.ltrplr = next + page.ldtdelr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -13572,153 +13918,221 @@ func (page *LongTermRetentionPolicyListResultPage) NextWithContext(ctx context.C // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *LongTermRetentionPolicyListResultPage) Next() error { +func (page *LogicalDatabaseTransparentDataEncryptionListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page LongTermRetentionPolicyListResultPage) NotDone() bool { - return !page.ltrplr.IsEmpty() +func (page LogicalDatabaseTransparentDataEncryptionListResultPage) NotDone() bool { + return !page.ldtdelr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page LongTermRetentionPolicyListResultPage) Response() LongTermRetentionPolicyListResult { - return page.ltrplr +func (page LogicalDatabaseTransparentDataEncryptionListResultPage) Response() LogicalDatabaseTransparentDataEncryptionListResult { + return page.ldtdelr } // Values returns the slice of values for the current page or nil if there are no values. -func (page LongTermRetentionPolicyListResultPage) Values() []LongTermRetentionPolicy { - if page.ltrplr.IsEmpty() { +func (page LogicalDatabaseTransparentDataEncryptionListResultPage) Values() []LogicalDatabaseTransparentDataEncryption { + if page.ldtdelr.IsEmpty() { return nil } - return *page.ltrplr.Value + return *page.ldtdelr.Value } -// Creates a new instance of the LongTermRetentionPolicyListResultPage type. -func NewLongTermRetentionPolicyListResultPage(cur LongTermRetentionPolicyListResult, getNextPage func(context.Context, LongTermRetentionPolicyListResult) (LongTermRetentionPolicyListResult, error)) LongTermRetentionPolicyListResultPage { - return LongTermRetentionPolicyListResultPage{ - fn: getNextPage, - ltrplr: cur, +// Creates a new instance of the LogicalDatabaseTransparentDataEncryptionListResultPage type. +func NewLogicalDatabaseTransparentDataEncryptionListResultPage(cur LogicalDatabaseTransparentDataEncryptionListResult, getNextPage func(context.Context, LogicalDatabaseTransparentDataEncryptionListResult) (LogicalDatabaseTransparentDataEncryptionListResult, error)) LogicalDatabaseTransparentDataEncryptionListResultPage { + return LogicalDatabaseTransparentDataEncryptionListResultPage{ + fn: getNextPage, + ldtdelr: cur, } } -// MaintenanceConfigurationCapability the maintenance configuration capability -type MaintenanceConfigurationCapability struct { - // Name - READ-ONLY; Maintenance configuration name - Name *string `json:"name,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the maintenance configuration. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` +// LogicalServerSecurityAlertPolicyListResult a list of the server's security alert policies. +type LogicalServerSecurityAlertPolicyListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for MaintenanceConfigurationCapability. -func (mcc MaintenanceConfigurationCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LogicalServerSecurityAlertPolicyListResult. +func (lssaplr LogicalServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mcc.Reason != nil { - objectMap["reason"] = mcc.Reason - } return json.Marshal(objectMap) } -// MaintenanceWindowOptions maintenance window options. -type MaintenanceWindowOptions struct { - autorest.Response `json:"-"` - // MaintenanceWindowOptionsProperties - Resource properties. - *MaintenanceWindowOptionsProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// LogicalServerSecurityAlertPolicyListResultIterator provides access to a complete listing of +// ServerSecurityAlertPolicy values. +type LogicalServerSecurityAlertPolicyListResultIterator struct { + i int + page LogicalServerSecurityAlertPolicyListResultPage } -// MarshalJSON is the custom marshaler for MaintenanceWindowOptions. -func (mwo MaintenanceWindowOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mwo.MaintenanceWindowOptionsProperties != nil { - objectMap["properties"] = mwo.MaintenanceWindowOptionsProperties +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LogicalServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogicalServerSecurityAlertPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MaintenanceWindowOptions struct. -func (mwo *MaintenanceWindowOptions) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) if err != nil { + iter.i-- return err } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var maintenanceWindowOptionsProperties MaintenanceWindowOptionsProperties - err = json.Unmarshal(*v, &maintenanceWindowOptionsProperties) - if err != nil { - return err - } - mwo.MaintenanceWindowOptionsProperties = &maintenanceWindowOptionsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mwo.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mwo.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mwo.Type = &typeVar - } - } - } - + iter.i = 0 return nil } -// MaintenanceWindowOptionsProperties maintenance window options properties. -type MaintenanceWindowOptionsProperties struct { - // IsEnabled - Whether maintenance windows are enabled for the database. - IsEnabled *bool `json:"isEnabled,omitempty"` - // MaintenanceWindowCycles - Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, 24*60}. - MaintenanceWindowCycles *[]MaintenanceWindowTimeRange `json:"maintenanceWindowCycles,omitempty"` - // MinDurationInMinutes - Minimum duration of maintenance window. - MinDurationInMinutes *int32 `json:"minDurationInMinutes,omitempty"` - // DefaultDurationInMinutes - Default duration for maintenance window. - DefaultDurationInMinutes *int32 `json:"defaultDurationInMinutes,omitempty"` - // MinCycles - Minimum number of maintenance windows cycles to be set on the database. - MinCycles *int32 `json:"minCycles,omitempty"` - // TimeGranularityInMinutes - Time granularity in minutes for maintenance windows. - TimeGranularityInMinutes *int32 `json:"timeGranularityInMinutes,omitempty"` - // AllowMultipleMaintenanceWindowsPerCycle - Whether we allow multiple maintenance windows per cycle. - AllowMultipleMaintenanceWindowsPerCycle *bool `json:"allowMultipleMaintenanceWindowsPerCycle,omitempty"` +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LogicalServerSecurityAlertPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) } -// MaintenanceWindows maintenance windows. -type MaintenanceWindows struct { +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LogicalServerSecurityAlertPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LogicalServerSecurityAlertPolicyListResultIterator) Response() LogicalServerSecurityAlertPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LogicalServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { + if !iter.page.NotDone() { + return ServerSecurityAlertPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LogicalServerSecurityAlertPolicyListResultIterator type. +func NewLogicalServerSecurityAlertPolicyListResultIterator(page LogicalServerSecurityAlertPolicyListResultPage) LogicalServerSecurityAlertPolicyListResultIterator { + return LogicalServerSecurityAlertPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lssaplr LogicalServerSecurityAlertPolicyListResult) IsEmpty() bool { + return lssaplr.Value == nil || len(*lssaplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lssaplr LogicalServerSecurityAlertPolicyListResult) hasNextLink() bool { + return lssaplr.NextLink != nil && len(*lssaplr.NextLink) != 0 +} + +// logicalServerSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lssaplr LogicalServerSecurityAlertPolicyListResult) logicalServerSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lssaplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lssaplr.NextLink))) +} + +// LogicalServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. +type LogicalServerSecurityAlertPolicyListResultPage struct { + fn func(context.Context, LogicalServerSecurityAlertPolicyListResult) (LogicalServerSecurityAlertPolicyListResult, error) + lssaplr LogicalServerSecurityAlertPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LogicalServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogicalServerSecurityAlertPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lssaplr) + if err != nil { + return err + } + page.lssaplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LogicalServerSecurityAlertPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LogicalServerSecurityAlertPolicyListResultPage) NotDone() bool { + return !page.lssaplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LogicalServerSecurityAlertPolicyListResultPage) Response() LogicalServerSecurityAlertPolicyListResult { + return page.lssaplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LogicalServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { + if page.lssaplr.IsEmpty() { + return nil + } + return *page.lssaplr.Value +} + +// Creates a new instance of the LogicalServerSecurityAlertPolicyListResultPage type. +func NewLogicalServerSecurityAlertPolicyListResultPage(cur LogicalServerSecurityAlertPolicyListResult, getNextPage func(context.Context, LogicalServerSecurityAlertPolicyListResult) (LogicalServerSecurityAlertPolicyListResult, error)) LogicalServerSecurityAlertPolicyListResultPage { + return LogicalServerSecurityAlertPolicyListResultPage{ + fn: getNextPage, + lssaplr: cur, + } +} + +// LogSizeCapability the log size capability. +type LogSizeCapability struct { + // Limit - READ-ONLY; The log size limit (see 'unit' for the units). + Limit *int32 `json:"limit,omitempty"` + // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'LogSizeUnitMegabytes', 'LogSizeUnitGigabytes', 'LogSizeUnitTerabytes', 'LogSizeUnitPetabytes', 'LogSizeUnitPercent' + Unit LogSizeUnit `json:"unit,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogSizeCapability. +func (lsc LogSizeCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LongTermRetentionBackup a long term retention backup. +type LongTermRetentionBackup struct { autorest.Response `json:"-"` - // MaintenanceWindowsProperties - Resource properties. - *MaintenanceWindowsProperties `json:"properties,omitempty"` + // LongTermRetentionBackupProperties - Resource properties. + *LongTermRetentionBackupProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -13727,17 +14141,17 @@ type MaintenanceWindows struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for MaintenanceWindows. -func (mw MaintenanceWindows) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LongTermRetentionBackup. +func (ltrb LongTermRetentionBackup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mw.MaintenanceWindowsProperties != nil { - objectMap["properties"] = mw.MaintenanceWindowsProperties + if ltrb.LongTermRetentionBackupProperties != nil { + objectMap["properties"] = ltrb.LongTermRetentionBackupProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for MaintenanceWindows struct. -func (mw *MaintenanceWindows) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for LongTermRetentionBackup struct. +func (ltrb *LongTermRetentionBackup) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -13747,12 +14161,12 @@ func (mw *MaintenanceWindows) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var maintenanceWindowsProperties MaintenanceWindowsProperties - err = json.Unmarshal(*v, &maintenanceWindowsProperties) + var longTermRetentionBackupProperties LongTermRetentionBackupProperties + err = json.Unmarshal(*v, &longTermRetentionBackupProperties) if err != nil { return err } - mw.MaintenanceWindowsProperties = &maintenanceWindowsProperties + ltrb.LongTermRetentionBackupProperties = &longTermRetentionBackupProperties } case "id": if v != nil { @@ -13761,7 +14175,7 @@ func (mw *MaintenanceWindows) UnmarshalJSON(body []byte) error { if err != nil { return err } - mw.ID = &ID + ltrb.ID = &ID } case "name": if v != nil { @@ -13770,7 +14184,7 @@ func (mw *MaintenanceWindows) UnmarshalJSON(body []byte) error { if err != nil { return err } - mw.Name = &name + ltrb.Name = &name } case "type": if v != nil { @@ -13779,7 +14193,7 @@ func (mw *MaintenanceWindows) UnmarshalJSON(body []byte) error { if err != nil { return err } - mw.Type = &typeVar + ltrb.Type = &typeVar } } } @@ -13787,112 +14201,177 @@ func (mw *MaintenanceWindows) UnmarshalJSON(body []byte) error { return nil } -// MaintenanceWindowsProperties maintenance windows resource properties. -type MaintenanceWindowsProperties struct { - TimeRanges *[]MaintenanceWindowTimeRange `json:"timeRanges,omitempty"` +// LongTermRetentionBackupListResult a list of long term retention backups. +type LongTermRetentionBackupListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]LongTermRetentionBackup `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` } -// MaintenanceWindowTimeRange maintenance window time range. -type MaintenanceWindowTimeRange struct { - // DayOfWeek - Day of maintenance window. Possible values include: 'DayOfWeekSunday', 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday' - DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` - // StartTime - Start time minutes offset from 12am. - StartTime *string `json:"startTime,omitempty"` - // Duration - Duration of maintenance window in minutes. - Duration *string `json:"duration,omitempty"` +// MarshalJSON is the custom marshaler for LongTermRetentionBackupListResult. +func (ltrblr LongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) } -// ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving -// the results of a long-running operation. -type ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) +// LongTermRetentionBackupListResultIterator provides access to a complete listing of +// LongTermRetentionBackup values. +type LongTermRetentionBackupListResultIterator struct { + i int + page LongTermRetentionBackupListResultPage } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- return err } - future.FutureAPI = &azFuture - future.Result = future.result + iter.i = 0 return nil } -// result is the default implementation for ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mbstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { - mbstrp, err = client.CreateOrUpdateResponder(mbstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") - } - } - return +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LongTermRetentionBackupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) } -// ManagedBackupShortTermRetentionPoliciesUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedBackupShortTermRetentionPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LongTermRetentionBackupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedBackupShortTermRetentionPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// Response returns the raw server response from the last page request. +func (iter LongTermRetentionBackupListResultIterator) Response() LongTermRetentionBackupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LongTermRetentionBackupListResultIterator) Value() LongTermRetentionBackup { + if !iter.page.NotDone() { + return LongTermRetentionBackup{} } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return iter.page.Values()[iter.i] } -// result is the default implementation for ManagedBackupShortTermRetentionPoliciesUpdateFuture.Result. -func (future *ManagedBackupShortTermRetentionPoliciesUpdateFuture) result(client ManagedBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return +// Creates a new instance of the LongTermRetentionBackupListResultIterator type. +func NewLongTermRetentionBackupListResultIterator(page LongTermRetentionBackupListResultPage) LongTermRetentionBackupListResultIterator { + return LongTermRetentionBackupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ltrblr LongTermRetentionBackupListResult) IsEmpty() bool { + return ltrblr.Value == nil || len(*ltrblr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ltrblr LongTermRetentionBackupListResult) hasNextLink() bool { + return ltrblr.NextLink != nil && len(*ltrblr.NextLink) != 0 +} + +// longTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ltrblr LongTermRetentionBackupListResult) longTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ltrblr.hasNextLink() { + return nil, nil } - if !done { - mbstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture") - return + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ltrblr.NextLink))) +} + +// LongTermRetentionBackupListResultPage contains a page of LongTermRetentionBackup values. +type LongTermRetentionBackupListResultPage struct { + fn func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error) + ltrblr LongTermRetentionBackupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionBackupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { - mbstrp, err = client.UpdateResponder(mbstrp.Response.Response) + for { + next, err := page.fn(ctx, page.ltrblr) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") + return err + } + page.ltrblr = next + if !next.hasNextLink() || !next.IsEmpty() { + break } } - return + return nil } -// ManagedBackupShortTermRetentionPolicy a short term retention policy. -type ManagedBackupShortTermRetentionPolicy struct { +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LongTermRetentionBackupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LongTermRetentionBackupListResultPage) NotDone() bool { + return !page.ltrblr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LongTermRetentionBackupListResultPage) Response() LongTermRetentionBackupListResult { + return page.ltrblr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LongTermRetentionBackupListResultPage) Values() []LongTermRetentionBackup { + if page.ltrblr.IsEmpty() { + return nil + } + return *page.ltrblr.Value +} + +// Creates a new instance of the LongTermRetentionBackupListResultPage type. +func NewLongTermRetentionBackupListResultPage(cur LongTermRetentionBackupListResult, getNextPage func(context.Context, LongTermRetentionBackupListResult) (LongTermRetentionBackupListResult, error)) LongTermRetentionBackupListResultPage { + return LongTermRetentionBackupListResultPage{ + fn: getNextPage, + ltrblr: cur, + } +} + +// LongTermRetentionBackupOperationResult a LongTermRetentionBackup operation result resource. +type LongTermRetentionBackupOperationResult struct { autorest.Response `json:"-"` - // ManagedBackupShortTermRetentionPolicyProperties - Resource properties. - *ManagedBackupShortTermRetentionPolicyProperties `json:"properties,omitempty"` + // LongTermRetentionOperationResultProperties - Resource properties. + *LongTermRetentionOperationResultProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -13901,17 +14380,17 @@ type ManagedBackupShortTermRetentionPolicy struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedBackupShortTermRetentionPolicy. -func (mbstrp ManagedBackupShortTermRetentionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LongTermRetentionBackupOperationResult. +func (ltrbor LongTermRetentionBackupOperationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mbstrp.ManagedBackupShortTermRetentionPolicyProperties != nil { - objectMap["properties"] = mbstrp.ManagedBackupShortTermRetentionPolicyProperties + if ltrbor.LongTermRetentionOperationResultProperties != nil { + objectMap["properties"] = ltrbor.LongTermRetentionOperationResultProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedBackupShortTermRetentionPolicy struct. -func (mbstrp *ManagedBackupShortTermRetentionPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for LongTermRetentionBackupOperationResult struct. +func (ltrbor *LongTermRetentionBackupOperationResult) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -13921,12 +14400,12 @@ func (mbstrp *ManagedBackupShortTermRetentionPolicy) UnmarshalJSON(body []byte) switch k { case "properties": if v != nil { - var managedBackupShortTermRetentionPolicyProperties ManagedBackupShortTermRetentionPolicyProperties - err = json.Unmarshal(*v, &managedBackupShortTermRetentionPolicyProperties) + var longTermRetentionOperationResultProperties LongTermRetentionOperationResultProperties + err = json.Unmarshal(*v, &longTermRetentionOperationResultProperties) if err != nil { return err } - mbstrp.ManagedBackupShortTermRetentionPolicyProperties = &managedBackupShortTermRetentionPolicyProperties + ltrbor.LongTermRetentionOperationResultProperties = &longTermRetentionOperationResultProperties } case "id": if v != nil { @@ -13935,7 +14414,7 @@ func (mbstrp *ManagedBackupShortTermRetentionPolicy) UnmarshalJSON(body []byte) if err != nil { return err } - mbstrp.ID = &ID + ltrbor.ID = &ID } case "name": if v != nil { @@ -13944,7 +14423,7 @@ func (mbstrp *ManagedBackupShortTermRetentionPolicy) UnmarshalJSON(body []byte) if err != nil { return err } - mbstrp.Name = &name + ltrbor.Name = &name } case "type": if v != nil { @@ -13953,7 +14432,7 @@ func (mbstrp *ManagedBackupShortTermRetentionPolicy) UnmarshalJSON(body []byte) if err != nil { return err } - mbstrp.Type = &typeVar + ltrbor.Type = &typeVar } } } @@ -13961,213 +14440,447 @@ func (mbstrp *ManagedBackupShortTermRetentionPolicy) UnmarshalJSON(body []byte) return nil } -// ManagedBackupShortTermRetentionPolicyListResult a list of short term retention policies. -type ManagedBackupShortTermRetentionPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedBackupShortTermRetentionPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` +// LongTermRetentionBackupProperties properties of a long term retention backup +type LongTermRetentionBackupProperties struct { + // ServerName - READ-ONLY; The server name that the backup database belong to. + ServerName *string `json:"serverName,omitempty"` + // ServerCreateTime - READ-ONLY; The create time of the server. + ServerCreateTime *date.Time `json:"serverCreateTime,omitempty"` + // DatabaseName - READ-ONLY; The name of the database the backup belong to + DatabaseName *string `json:"databaseName,omitempty"` + // DatabaseDeletionTime - READ-ONLY; The delete time of the database + DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` + // BackupTime - READ-ONLY; The time the backup was taken + BackupTime *date.Time `json:"backupTime,omitempty"` + // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. + BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` + // BackupStorageRedundancy - READ-ONLY; The storage redundancy type of the backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + BackupStorageRedundancy BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty"` + // RequestedBackupStorageRedundancy - The storage redundancy type of the backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + RequestedBackupStorageRedundancy BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedBackupShortTermRetentionPolicyListResult. -func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LongTermRetentionBackupProperties. +func (ltrbp LongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if ltrbp.RequestedBackupStorageRedundancy != "" { + objectMap["requestedBackupStorageRedundancy"] = ltrbp.RequestedBackupStorageRedundancy + } return json.Marshal(objectMap) } -// ManagedBackupShortTermRetentionPolicyListResultIterator provides access to a complete listing of -// ManagedBackupShortTermRetentionPolicy values. -type ManagedBackupShortTermRetentionPolicyListResultIterator struct { - i int - page ManagedBackupShortTermRetentionPolicyListResultPage +// LongTermRetentionBackupsCopyByResourceGroupFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LongTermRetentionBackupsCopyByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) } -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagedBackupShortTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPolicyListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsCopyByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { return err } - iter.i = 0 + future.FutureAPI = &azFuture + future.Result = future.result return nil } -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ManagedBackupShortTermRetentionPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) +// result is the default implementation for LongTermRetentionBackupsCopyByResourceGroupFuture.Result. +func (future *LongTermRetentionBackupsCopyByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrbor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsCopyByResourceGroupFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { + ltrbor, err = client.CopyByResourceGroupResponder(ltrbor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyByResourceGroupFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + } + } + return } -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) Response() ManagedBackupShortTermRetentionPolicyListResult { - return iter.page.Response() +// LongTermRetentionBackupsCopyFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LongTermRetentionBackupsCopyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) } -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) Value() ManagedBackupShortTermRetentionPolicy { - if !iter.page.NotDone() { - return ManagedBackupShortTermRetentionPolicy{} +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsCopyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - return iter.page.Values()[iter.i] + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// Creates a new instance of the ManagedBackupShortTermRetentionPolicyListResultIterator type. -func NewManagedBackupShortTermRetentionPolicyListResultIterator(page ManagedBackupShortTermRetentionPolicyListResultPage) ManagedBackupShortTermRetentionPolicyListResultIterator { - return ManagedBackupShortTermRetentionPolicyListResultIterator{page: page} +// result is the default implementation for LongTermRetentionBackupsCopyFuture.Result. +func (future *LongTermRetentionBackupsCopyFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrbor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsCopyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { + ltrbor, err = client.CopyResponder(ltrbor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsCopyFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + } + } + return } -// IsEmpty returns true if the ListResult contains no values. -func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) IsEmpty() bool { - return mbstrplr.Value == nil || len(*mbstrplr.Value) == 0 +// LongTermRetentionBackupsDeleteByResourceGroupFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LongTermRetentionBackupsDeleteByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (autorest.Response, error) } -// hasNextLink returns true if the NextLink is not empty. -func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) hasNextLink() bool { - return mbstrplr.NextLink != nil && len(*mbstrplr.NextLink) != 0 +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// managedBackupShortTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) managedBackupShortTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mbstrplr.hasNextLink() { - return nil, nil +// result is the default implementation for LongTermRetentionBackupsDeleteByResourceGroupFuture.Result. +func (future *LongTermRetentionBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mbstrplr.NextLink))) + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteByResourceGroupFuture") + return + } + ar.Response = future.Response() + return } -// ManagedBackupShortTermRetentionPolicyListResultPage contains a page of -// ManagedBackupShortTermRetentionPolicy values. -type ManagedBackupShortTermRetentionPolicyListResultPage struct { - fn func(context.Context, ManagedBackupShortTermRetentionPolicyListResult) (ManagedBackupShortTermRetentionPolicyListResult, error) - mbstrplr ManagedBackupShortTermRetentionPolicyListResult +// LongTermRetentionBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LongTermRetentionBackupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (autorest.Response, error) } -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ManagedBackupShortTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPolicyListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mbstrplr) - if err != nil { - return err - } - page.mbstrplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } + future.FutureAPI = &azFuture + future.Result = future.result return nil } -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagedBackupShortTermRetentionPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedBackupShortTermRetentionPolicyListResultPage) NotDone() bool { - return !page.mbstrplr.IsEmpty() +// result is the default implementation for LongTermRetentionBackupsDeleteFuture.Result. +func (future *LongTermRetentionBackupsDeleteFuture) result(client LongTermRetentionBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsDeleteFuture") + return + } + ar.Response = future.Response() + return } -// Response returns the raw server response from the last page request. -func (page ManagedBackupShortTermRetentionPolicyListResultPage) Response() ManagedBackupShortTermRetentionPolicyListResult { - return page.mbstrplr +// LongTermRetentionBackupsUpdateByResourceGroupFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LongTermRetentionBackupsUpdateByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) } -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedBackupShortTermRetentionPolicyListResultPage) Values() []ManagedBackupShortTermRetentionPolicy { - if page.mbstrplr.IsEmpty() { - return nil +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsUpdateByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - return *page.mbstrplr.Value + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// Creates a new instance of the ManagedBackupShortTermRetentionPolicyListResultPage type. -func NewManagedBackupShortTermRetentionPolicyListResultPage(cur ManagedBackupShortTermRetentionPolicyListResult, getNextPage func(context.Context, ManagedBackupShortTermRetentionPolicyListResult) (ManagedBackupShortTermRetentionPolicyListResult, error)) ManagedBackupShortTermRetentionPolicyListResultPage { - return ManagedBackupShortTermRetentionPolicyListResultPage{ - fn: getNextPage, - mbstrplr: cur, +// result is the default implementation for LongTermRetentionBackupsUpdateByResourceGroupFuture.Result. +func (future *LongTermRetentionBackupsUpdateByResourceGroupFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrbor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsUpdateByResourceGroupFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { + ltrbor, err = client.UpdateByResourceGroupResponder(ltrbor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateByResourceGroupFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + } } + return } -// ManagedBackupShortTermRetentionPolicyProperties properties of a short term retention policy -type ManagedBackupShortTermRetentionPolicyProperties struct { - // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. - RetentionDays *int32 `json:"retentionDays,omitempty"` +// LongTermRetentionBackupsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LongTermRetentionBackupsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionBackupsClient) (LongTermRetentionBackupOperationResult, error) } -// ManagedDatabase a managed database resource. -type ManagedDatabase struct { - autorest.Response `json:"-"` - // ManagedDatabaseProperties - Resource properties. - *ManagedDatabaseProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionBackupsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// MarshalJSON is the custom marshaler for ManagedDatabase. -func (md ManagedDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if md.ManagedDatabaseProperties != nil { - objectMap["properties"] = md.ManagedDatabaseProperties - } - if md.Location != nil { - objectMap["location"] = md.Location - } - if md.Tags != nil { - objectMap["tags"] = md.Tags +// result is the default implementation for LongTermRetentionBackupsUpdateFuture.Result. +func (future *LongTermRetentionBackupsUpdateFuture) result(client LongTermRetentionBackupsClient) (ltrbor LongTermRetentionBackupOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrbor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionBackupsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrbor.Response.Response, err = future.GetResult(sender); err == nil && ltrbor.Response.Response.StatusCode != http.StatusNoContent { + ltrbor, err = client.UpdateResponder(ltrbor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionBackupsUpdateFuture", "Result", ltrbor.Response.Response, "Failure responding to request") + } + } + return +} + +// LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture.Result. +func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture") + return + } + ar.Response = future.Response() + return +} + +// LongTermRetentionManagedInstanceBackupsDeleteFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LongTermRetentionManagedInstanceBackupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteFuture.Result. +func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteFuture") + return } + ar.Response = future.Response() + return +} + +// LongTermRetentionOperationResultProperties contains the operation result properties for long term +// retention backup operation. +type LongTermRetentionOperationResultProperties struct { + // RequestID - READ-ONLY; Request Id. + RequestID *uuid.UUID `json:"requestId,omitempty"` + // OperationType - READ-ONLY; Operation type. + OperationType *string `json:"operationType,omitempty"` + // FromBackupResourceID - READ-ONLY; Source backup resource id + FromBackupResourceID *string `json:"fromBackupResourceId,omitempty"` + // ToBackupResourceID - READ-ONLY; Target backup resource id + ToBackupResourceID *string `json:"toBackupResourceId,omitempty"` + // TargetBackupStorageRedundancy - READ-ONLY; The storage redundancy type of the copied backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + TargetBackupStorageRedundancy BackupStorageRedundancy `json:"targetBackupStorageRedundancy,omitempty"` + // Status - READ-ONLY; Operation status + Status *string `json:"status,omitempty"` + // Message - READ-ONLY; Progress message + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for LongTermRetentionOperationResultProperties. +func (ltrorp LongTermRetentionOperationResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedDatabase struct. -func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { +// LongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type LongTermRetentionPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LongTermRetentionPoliciesClient) (LongTermRetentionPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LongTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LongTermRetentionPoliciesCreateOrUpdateFuture.Result. +func (future *LongTermRetentionPoliciesCreateOrUpdateFuture) result(client LongTermRetentionPoliciesClient) (ltrp LongTermRetentionPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ltrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ltrp.Response.Response, err = future.GetResult(sender); err == nil && ltrp.Response.Response.StatusCode != http.StatusNoContent { + ltrp, err = client.CreateOrUpdateResponder(ltrp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.LongTermRetentionPoliciesCreateOrUpdateFuture", "Result", ltrp.Response.Response, "Failure responding to request") + } + } + return +} + +// LongTermRetentionPolicy a long term retention policy. +type LongTermRetentionPolicy struct { + autorest.Response `json:"-"` + // BaseLongTermRetentionPolicyProperties - Resource properties. + *BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LongTermRetentionPolicy. +func (ltrp LongTermRetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ltrp.BaseLongTermRetentionPolicyProperties != nil { + objectMap["properties"] = ltrp.BaseLongTermRetentionPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LongTermRetentionPolicy struct. +func (ltrp *LongTermRetentionPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -14177,30 +14890,12 @@ func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var managedDatabaseProperties ManagedDatabaseProperties - err = json.Unmarshal(*v, &managedDatabaseProperties) - if err != nil { - return err - } - md.ManagedDatabaseProperties = &managedDatabaseProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - md.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var baseLongTermRetentionPolicyProperties BaseLongTermRetentionPolicyProperties + err = json.Unmarshal(*v, &baseLongTermRetentionPolicyProperties) if err != nil { return err } - md.Tags = tags + ltrp.BaseLongTermRetentionPolicyProperties = &baseLongTermRetentionPolicyProperties } case "id": if v != nil { @@ -14209,7 +14904,7 @@ func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { if err != nil { return err } - md.ID = &ID + ltrp.ID = &ID } case "name": if v != nil { @@ -14218,7 +14913,7 @@ func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { if err != nil { return err } - md.Name = &name + ltrp.Name = &name } case "type": if v != nil { @@ -14227,7 +14922,7 @@ func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { if err != nil { return err } - md.Type = &typeVar + ltrp.Type = &typeVar } } } @@ -14235,32 +14930,33 @@ func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { return nil } -// ManagedDatabaseListResult a list of managed databases. -type ManagedDatabaseListResult struct { +// LongTermRetentionPolicyListResult a list of long term retention policies. +type LongTermRetentionPolicyListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedDatabase `json:"value,omitempty"` + Value *[]LongTermRetentionPolicy `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedDatabaseListResult. -func (mdlr ManagedDatabaseListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for LongTermRetentionPolicyListResult. +func (ltrplr LongTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedDatabaseListResultIterator provides access to a complete listing of ManagedDatabase values. -type ManagedDatabaseListResultIterator struct { +// LongTermRetentionPolicyListResultIterator provides access to a complete listing of +// LongTermRetentionPolicy values. +type LongTermRetentionPolicyListResultIterator struct { i int - page ManagedDatabaseListResultPage + page LongTermRetentionPolicyListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *LongTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPolicyListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -14285,67 +14981,67 @@ func (iter *ManagedDatabaseListResultIterator) NextWithContext(ctx context.Conte // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedDatabaseListResultIterator) Next() error { +func (iter *LongTermRetentionPolicyListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedDatabaseListResultIterator) NotDone() bool { +func (iter LongTermRetentionPolicyListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedDatabaseListResultIterator) Response() ManagedDatabaseListResult { +func (iter LongTermRetentionPolicyListResultIterator) Response() LongTermRetentionPolicyListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedDatabaseListResultIterator) Value() ManagedDatabase { +func (iter LongTermRetentionPolicyListResultIterator) Value() LongTermRetentionPolicy { if !iter.page.NotDone() { - return ManagedDatabase{} + return LongTermRetentionPolicy{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedDatabaseListResultIterator type. -func NewManagedDatabaseListResultIterator(page ManagedDatabaseListResultPage) ManagedDatabaseListResultIterator { - return ManagedDatabaseListResultIterator{page: page} +// Creates a new instance of the LongTermRetentionPolicyListResultIterator type. +func NewLongTermRetentionPolicyListResultIterator(page LongTermRetentionPolicyListResultPage) LongTermRetentionPolicyListResultIterator { + return LongTermRetentionPolicyListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (mdlr ManagedDatabaseListResult) IsEmpty() bool { - return mdlr.Value == nil || len(*mdlr.Value) == 0 +func (ltrplr LongTermRetentionPolicyListResult) IsEmpty() bool { + return ltrplr.Value == nil || len(*ltrplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (mdlr ManagedDatabaseListResult) hasNextLink() bool { - return mdlr.NextLink != nil && len(*mdlr.NextLink) != 0 +func (ltrplr LongTermRetentionPolicyListResult) hasNextLink() bool { + return ltrplr.NextLink != nil && len(*ltrplr.NextLink) != 0 } -// managedDatabaseListResultPreparer prepares a request to retrieve the next set of results. +// longTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (mdlr ManagedDatabaseListResult) managedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mdlr.hasNextLink() { +func (ltrplr LongTermRetentionPolicyListResult) longTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ltrplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(mdlr.NextLink))) + autorest.WithBaseURL(to.String(ltrplr.NextLink))) } -// ManagedDatabaseListResultPage contains a page of ManagedDatabase values. -type ManagedDatabaseListResultPage struct { - fn func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error) - mdlr ManagedDatabaseListResult +// LongTermRetentionPolicyListResultPage contains a page of LongTermRetentionPolicy values. +type LongTermRetentionPolicyListResultPage struct { + fn func(context.Context, LongTermRetentionPolicyListResult) (LongTermRetentionPolicyListResult, error) + ltrplr LongTermRetentionPolicyListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *LongTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/LongTermRetentionPolicyListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -14355,11 +15051,11 @@ func (page *ManagedDatabaseListResultPage) NextWithContext(ctx context.Context) }() } for { - next, err := page.fn(ctx, page.mdlr) + next, err := page.fn(ctx, page.ltrplr) if err != nil { return err } - page.mdlr = next + page.ltrplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -14370,151 +15066,62 @@ func (page *ManagedDatabaseListResultPage) NextWithContext(ctx context.Context) // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedDatabaseListResultPage) Next() error { +func (page *LongTermRetentionPolicyListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedDatabaseListResultPage) NotDone() bool { - return !page.mdlr.IsEmpty() +func (page LongTermRetentionPolicyListResultPage) NotDone() bool { + return !page.ltrplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedDatabaseListResultPage) Response() ManagedDatabaseListResult { - return page.mdlr +func (page LongTermRetentionPolicyListResultPage) Response() LongTermRetentionPolicyListResult { + return page.ltrplr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedDatabaseListResultPage) Values() []ManagedDatabase { - if page.mdlr.IsEmpty() { +func (page LongTermRetentionPolicyListResultPage) Values() []LongTermRetentionPolicy { + if page.ltrplr.IsEmpty() { return nil } - return *page.mdlr.Value + return *page.ltrplr.Value } -// Creates a new instance of the ManagedDatabaseListResultPage type. -func NewManagedDatabaseListResultPage(cur ManagedDatabaseListResult, getNextPage func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error)) ManagedDatabaseListResultPage { - return ManagedDatabaseListResultPage{ - fn: getNextPage, - mdlr: cur, +// Creates a new instance of the LongTermRetentionPolicyListResultPage type. +func NewLongTermRetentionPolicyListResultPage(cur LongTermRetentionPolicyListResult, getNextPage func(context.Context, LongTermRetentionPolicyListResult) (LongTermRetentionPolicyListResult, error)) LongTermRetentionPolicyListResultPage { + return LongTermRetentionPolicyListResultPage{ + fn: getNextPage, + ltrplr: cur, } } -// ManagedDatabaseProperties the managed database's properties. -type ManagedDatabaseProperties struct { - // Collation - Collation of the managed database. - Collation *string `json:"collation,omitempty"` - // Status - READ-ONLY; Status of the database. Possible values include: 'ManagedDatabaseStatusOnline', 'ManagedDatabaseStatusOffline', 'ManagedDatabaseStatusShutdown', 'ManagedDatabaseStatusCreating', 'ManagedDatabaseStatusInaccessible', 'ManagedDatabaseStatusRestoring', 'ManagedDatabaseStatusUpdating' - Status ManagedDatabaseStatus `json:"status,omitempty"` - // CreationDate - READ-ONLY; Creation date of the database. - CreationDate *date.Time `json:"creationDate,omitempty"` - // EarliestRestorePoint - READ-ONLY; Earliest restore point in time for point in time restore. - EarliestRestorePoint *date.Time `json:"earliestRestorePoint,omitempty"` - // 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. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // DefaultSecondaryLocation - READ-ONLY; Geo paired region. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` - // CatalogCollation - Collation of the metadata catalog. Possible values include: 'CatalogCollationTypeDATABASEDEFAULT', 'CatalogCollationTypeSQLLatin1GeneralCP1CIAS' - CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` - // 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required). Possible values include: 'ManagedDatabaseCreateModeDefault', 'ManagedDatabaseCreateModeRestoreExternalBackup', 'ManagedDatabaseCreateModePointInTimeRestore', 'ManagedDatabaseCreateModeRecovery', 'ManagedDatabaseCreateModeRestoreLongTermRetentionBackup' - CreateMode ManagedDatabaseCreateMode `json:"createMode,omitempty"` - // StorageContainerURI - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. - StorageContainerURI *string `json:"storageContainerUri,omitempty"` - // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - // RestorableDroppedDatabaseID - The restorable dropped database resource id to restore when creating this database. - RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` - // StorageContainerSasToken - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. - StorageContainerSasToken *string `json:"storageContainerSasToken,omitempty"` - // FailoverGroupID - READ-ONLY; Instance Failover Group resource identifier that this managed database belongs to. - FailoverGroupID *string `json:"failoverGroupId,omitempty"` - // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` - // LongTermRetentionBackupResourceID - The name of the Long Term Retention backup to be used for restore of this managed database. - LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` - // AutoCompleteRestore - Whether to auto complete restore of this managed database. - AutoCompleteRestore *bool `json:"autoCompleteRestore,omitempty"` - // LastBackupName - Last backup file name for restore of this managed database. - LastBackupName *string `json:"lastBackupName,omitempty"` +// MaintenanceConfigurationCapability the maintenance configuration capability +type MaintenanceConfigurationCapability struct { + // Name - READ-ONLY; Maintenance configuration name + Name *string `json:"name,omitempty"` + // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the maintenance configuration. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedDatabaseProperties. -func (mdp ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for MaintenanceConfigurationCapability. +func (mcc MaintenanceConfigurationCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mdp.Collation != nil { - objectMap["collation"] = mdp.Collation - } - if mdp.RestorePointInTime != nil { - objectMap["restorePointInTime"] = mdp.RestorePointInTime - } - if mdp.CatalogCollation != "" { - objectMap["catalogCollation"] = mdp.CatalogCollation - } - if mdp.CreateMode != "" { - objectMap["createMode"] = mdp.CreateMode - } - if mdp.StorageContainerURI != nil { - objectMap["storageContainerUri"] = mdp.StorageContainerURI - } - if mdp.SourceDatabaseID != nil { - objectMap["sourceDatabaseId"] = mdp.SourceDatabaseID - } - if mdp.RestorableDroppedDatabaseID != nil { - objectMap["restorableDroppedDatabaseId"] = mdp.RestorableDroppedDatabaseID - } - if mdp.StorageContainerSasToken != nil { - objectMap["storageContainerSasToken"] = mdp.StorageContainerSasToken - } - if mdp.RecoverableDatabaseID != nil { - objectMap["recoverableDatabaseId"] = mdp.RecoverableDatabaseID - } - if mdp.LongTermRetentionBackupResourceID != nil { - objectMap["longTermRetentionBackupResourceId"] = mdp.LongTermRetentionBackupResourceID - } - if mdp.AutoCompleteRestore != nil { - objectMap["autoCompleteRestore"] = mdp.AutoCompleteRestore - } - if mdp.LastBackupName != nil { - objectMap["lastBackupName"] = mdp.LastBackupName + if mcc.Reason != nil { + objectMap["reason"] = mcc.Reason } return json.Marshal(objectMap) } -// ManagedDatabaseRestoreDetailsProperties the managed database's restore details properties. -type ManagedDatabaseRestoreDetailsProperties struct { - // Status - READ-ONLY; Restore status. - Status *string `json:"status,omitempty"` - // CurrentRestoringFileName - READ-ONLY; Current restoring file name. - CurrentRestoringFileName *string `json:"currentRestoringFileName,omitempty"` - // LastRestoredFileName - READ-ONLY; Last restored file name. - LastRestoredFileName *string `json:"lastRestoredFileName,omitempty"` - // LastRestoredFileTime - READ-ONLY; Last restored file time. - LastRestoredFileTime *date.Time `json:"lastRestoredFileTime,omitempty"` - // PercentCompleted - READ-ONLY; Percent completed. - PercentCompleted *float64 `json:"percentCompleted,omitempty"` - // UnrestorableFiles - READ-ONLY; List of unrestorable files. - UnrestorableFiles *[]string `json:"unrestorableFiles,omitempty"` - // NumberOfFilesDetected - READ-ONLY; Number of files detected. - NumberOfFilesDetected *int64 `json:"numberOfFilesDetected,omitempty"` - // LastUploadedFileName - READ-ONLY; Last uploaded file name. - LastUploadedFileName *string `json:"lastUploadedFileName,omitempty"` - // LastUploadedFileTime - READ-ONLY; Last uploaded file time. - LastUploadedFileTime *date.Time `json:"lastUploadedFileTime,omitempty"` - // BlockReason - READ-ONLY; The reason why restore is in Blocked state. - BlockReason *string `json:"blockReason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsProperties. -func (mdrdp ManagedDatabaseRestoreDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedDatabaseRestoreDetailsResult a managed database restore details. -type ManagedDatabaseRestoreDetailsResult struct { +// MaintenanceWindowOptions maintenance window options. +type MaintenanceWindowOptions struct { autorest.Response `json:"-"` - // ManagedDatabaseRestoreDetailsProperties - Resource properties. - *ManagedDatabaseRestoreDetailsProperties `json:"properties,omitempty"` + // MaintenanceWindowOptionsProperties - Resource properties. + *MaintenanceWindowOptionsProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -14523,17 +15130,17 @@ type ManagedDatabaseRestoreDetailsResult struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsResult. -func (mdrdr ManagedDatabaseRestoreDetailsResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for MaintenanceWindowOptions. +func (mwo MaintenanceWindowOptions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mdrdr.ManagedDatabaseRestoreDetailsProperties != nil { - objectMap["properties"] = mdrdr.ManagedDatabaseRestoreDetailsProperties + if mwo.MaintenanceWindowOptionsProperties != nil { + objectMap["properties"] = mwo.MaintenanceWindowOptionsProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseRestoreDetailsResult struct. -func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for MaintenanceWindowOptions struct. +func (mwo *MaintenanceWindowOptions) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -14543,12 +15150,12 @@ func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) err switch k { case "properties": if v != nil { - var managedDatabaseRestoreDetailsProperties ManagedDatabaseRestoreDetailsProperties - err = json.Unmarshal(*v, &managedDatabaseRestoreDetailsProperties) + var maintenanceWindowOptionsProperties MaintenanceWindowOptionsProperties + err = json.Unmarshal(*v, &maintenanceWindowOptionsProperties) if err != nil { return err } - mdrdr.ManagedDatabaseRestoreDetailsProperties = &managedDatabaseRestoreDetailsProperties + mwo.MaintenanceWindowOptionsProperties = &maintenanceWindowOptionsProperties } case "id": if v != nil { @@ -14557,7 +15164,7 @@ func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) err if err != nil { return err } - mdrdr.ID = &ID + mwo.ID = &ID } case "name": if v != nil { @@ -14566,7 +15173,7 @@ func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) err if err != nil { return err } - mdrdr.Name = &name + mwo.Name = &name } case "type": if v != nil { @@ -14575,7 +15182,7 @@ func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) err if err != nil { return err } - mdrdr.Type = &typeVar + mwo.Type = &typeVar } } } @@ -14583,54 +15190,123 @@ func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) err return nil } -// ManagedDatabasesCompleteRestoreFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedDatabasesCompleteRestoreFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabasesClient) (autorest.Response, error) +// MaintenanceWindowOptionsProperties maintenance window options properties. +type MaintenanceWindowOptionsProperties struct { + // IsEnabled - Whether maintenance windows are enabled for the database. + IsEnabled *bool `json:"isEnabled,omitempty"` + // MaintenanceWindowCycles - Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, 24*60}. + MaintenanceWindowCycles *[]MaintenanceWindowTimeRange `json:"maintenanceWindowCycles,omitempty"` + // MinDurationInMinutes - Minimum duration of maintenance window. + MinDurationInMinutes *int32 `json:"minDurationInMinutes,omitempty"` + // DefaultDurationInMinutes - Default duration for maintenance window. + DefaultDurationInMinutes *int32 `json:"defaultDurationInMinutes,omitempty"` + // MinCycles - Minimum number of maintenance windows cycles to be set on the database. + MinCycles *int32 `json:"minCycles,omitempty"` + // TimeGranularityInMinutes - Time granularity in minutes for maintenance windows. + TimeGranularityInMinutes *int32 `json:"timeGranularityInMinutes,omitempty"` + // AllowMultipleMaintenanceWindowsPerCycle - Whether we allow multiple maintenance windows per cycle. + AllowMultipleMaintenanceWindowsPerCycle *bool `json:"allowMultipleMaintenanceWindowsPerCycle,omitempty"` } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabasesCompleteRestoreFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// MaintenanceWindows maintenance windows. +type MaintenanceWindows struct { + autorest.Response `json:"-"` + // MaintenanceWindowsProperties - Resource properties. + *MaintenanceWindowsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceWindows. +func (mw MaintenanceWindows) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mw.MaintenanceWindowsProperties != nil { + objectMap["properties"] = mw.MaintenanceWindowsProperties } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return json.Marshal(objectMap) } -// result is the default implementation for ManagedDatabasesCompleteRestoreFuture.Result. -func (future *ManagedDatabasesCompleteRestoreFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// UnmarshalJSON is the custom unmarshaler for MaintenanceWindows struct. +func (mw *MaintenanceWindows) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCompleteRestoreFuture", "Result", future.Response(), "Polling failure") - return + return err } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCompleteRestoreFuture") - return + for k, v := range m { + switch k { + case "properties": + if v != nil { + var maintenanceWindowsProperties MaintenanceWindowsProperties + err = json.Unmarshal(*v, &maintenanceWindowsProperties) + if err != nil { + return err + } + mw.MaintenanceWindowsProperties = &maintenanceWindowsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mw.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mw.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mw.Type = &typeVar + } + } } - ar.Response = future.Response() - return + + return nil } -// ManagedDatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedDatabasesCreateOrUpdateFuture struct { +// MaintenanceWindowsProperties maintenance windows resource properties. +type MaintenanceWindowsProperties struct { + TimeRanges *[]MaintenanceWindowTimeRange `json:"timeRanges,omitempty"` +} + +// MaintenanceWindowTimeRange maintenance window time range. +type MaintenanceWindowTimeRange struct { + // DayOfWeek - Day of maintenance window. Possible values include: 'DayOfWeekSunday', 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday' + DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` + // StartTime - Start time minutes offset from 12am. + StartTime *string `json:"startTime,omitempty"` + // Duration - Duration of maintenance window in minutes. + Duration *string `json:"duration,omitempty"` +} + +// ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedDatabasesClient) (ManagedDatabase, error) + Result func(ManagedBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -14640,40 +15316,40 @@ func (future *ManagedDatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) e return nil } -// result is the default implementation for ManagedDatabasesCreateOrUpdateFuture.Result. -func (future *ManagedDatabasesCreateOrUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { +// result is the default implementation for ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. +func (future *ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - md.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCreateOrUpdateFuture") + mbstrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { - md, err = client.CreateOrUpdateResponder(md.Response.Response) + if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { + mbstrp, err = client.CreateOrUpdateResponder(mbstrp.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", md.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") } } return } -// ManagedDatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedDatabasesDeleteFuture struct { +// ManagedBackupShortTermRetentionPoliciesUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedBackupShortTermRetentionPoliciesUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedDatabasesClient) (autorest.Response, error) + Result func(ManagedBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabasesDeleteFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedBackupShortTermRetentionPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -14683,28 +15359,34 @@ func (future *ManagedDatabasesDeleteFuture) UnmarshalJSON(body []byte) error { return nil } -// result is the default implementation for ManagedDatabasesDeleteFuture.Result. -func (future *ManagedDatabasesDeleteFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { +// result is the default implementation for ManagedBackupShortTermRetentionPoliciesUpdateFuture.Result. +func (future *ManagedBackupShortTermRetentionPoliciesUpdateFuture) result(client ManagedBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesDeleteFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesDeleteFuture") + mbstrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture") return } - ar.Response = future.Response() + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { + mbstrp, err = client.UpdateResponder(mbstrp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") + } + } return } -// ManagedDatabaseSecurityAlertPolicy a managed database security alert policy. -type ManagedDatabaseSecurityAlertPolicy struct { +// ManagedBackupShortTermRetentionPolicy a short term retention policy. +type ManagedBackupShortTermRetentionPolicy struct { autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `json:"properties,omitempty"` + // ManagedBackupShortTermRetentionPolicyProperties - Resource properties. + *ManagedBackupShortTermRetentionPolicyProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -14713,17 +15395,17 @@ type ManagedDatabaseSecurityAlertPolicy struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedDatabaseSecurityAlertPolicy. -func (mdsap ManagedDatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedBackupShortTermRetentionPolicy. +func (mbstrp ManagedBackupShortTermRetentionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mdsap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = mdsap.SecurityAlertPolicyProperties + if mbstrp.ManagedBackupShortTermRetentionPolicyProperties != nil { + objectMap["properties"] = mbstrp.ManagedBackupShortTermRetentionPolicyProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseSecurityAlertPolicy struct. -func (mdsap *ManagedDatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedBackupShortTermRetentionPolicy struct. +func (mbstrp *ManagedBackupShortTermRetentionPolicy) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -14733,12 +15415,12 @@ func (mdsap *ManagedDatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) erro switch k { case "properties": if v != nil { - var securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) + var managedBackupShortTermRetentionPolicyProperties ManagedBackupShortTermRetentionPolicyProperties + err = json.Unmarshal(*v, &managedBackupShortTermRetentionPolicyProperties) if err != nil { return err } - mdsap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties + mbstrp.ManagedBackupShortTermRetentionPolicyProperties = &managedBackupShortTermRetentionPolicyProperties } case "id": if v != nil { @@ -14747,7 +15429,7 @@ func (mdsap *ManagedDatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) erro if err != nil { return err } - mdsap.ID = &ID + mbstrp.ID = &ID } case "name": if v != nil { @@ -14756,7 +15438,7 @@ func (mdsap *ManagedDatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) erro if err != nil { return err } - mdsap.Name = &name + mbstrp.Name = &name } case "type": if v != nil { @@ -14765,7 +15447,7 @@ func (mdsap *ManagedDatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) erro if err != nil { return err } - mdsap.Type = &typeVar + mbstrp.Type = &typeVar } } } @@ -14773,33 +15455,33 @@ func (mdsap *ManagedDatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) erro return nil } -// ManagedDatabaseSecurityAlertPolicyListResult a list of the managed database's security alert policies. -type ManagedDatabaseSecurityAlertPolicyListResult struct { +// ManagedBackupShortTermRetentionPolicyListResult a list of short term retention policies. +type ManagedBackupShortTermRetentionPolicyListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedDatabaseSecurityAlertPolicy `json:"value,omitempty"` + Value *[]ManagedBackupShortTermRetentionPolicy `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedDatabaseSecurityAlertPolicyListResult. -func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedBackupShortTermRetentionPolicyListResult. +func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedDatabaseSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ManagedDatabaseSecurityAlertPolicy values. -type ManagedDatabaseSecurityAlertPolicyListResultIterator struct { +// ManagedBackupShortTermRetentionPolicyListResultIterator provides access to a complete listing of +// ManagedBackupShortTermRetentionPolicy values. +type ManagedBackupShortTermRetentionPolicyListResultIterator struct { i int - page ManagedDatabaseSecurityAlertPolicyListResultPage + page ManagedBackupShortTermRetentionPolicyListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedDatabaseSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedBackupShortTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPolicyListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPolicyListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -14824,68 +15506,68 @@ func (iter *ManagedDatabaseSecurityAlertPolicyListResultIterator) NextWithContex // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedDatabaseSecurityAlertPolicyListResultIterator) Next() error { +func (iter *ManagedBackupShortTermRetentionPolicyListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedDatabaseSecurityAlertPolicyListResultIterator) NotDone() bool { +func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedDatabaseSecurityAlertPolicyListResultIterator) Response() ManagedDatabaseSecurityAlertPolicyListResult { +func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) Response() ManagedBackupShortTermRetentionPolicyListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedDatabaseSecurityAlertPolicyListResultIterator) Value() ManagedDatabaseSecurityAlertPolicy { +func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) Value() ManagedBackupShortTermRetentionPolicy { if !iter.page.NotDone() { - return ManagedDatabaseSecurityAlertPolicy{} + return ManagedBackupShortTermRetentionPolicy{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedDatabaseSecurityAlertPolicyListResultIterator type. -func NewManagedDatabaseSecurityAlertPolicyListResultIterator(page ManagedDatabaseSecurityAlertPolicyListResultPage) ManagedDatabaseSecurityAlertPolicyListResultIterator { - return ManagedDatabaseSecurityAlertPolicyListResultIterator{page: page} +// Creates a new instance of the ManagedBackupShortTermRetentionPolicyListResultIterator type. +func NewManagedBackupShortTermRetentionPolicyListResultIterator(page ManagedBackupShortTermRetentionPolicyListResultPage) ManagedBackupShortTermRetentionPolicyListResultIterator { + return ManagedBackupShortTermRetentionPolicyListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) IsEmpty() bool { - return mdsaplr.Value == nil || len(*mdsaplr.Value) == 0 +func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) IsEmpty() bool { + return mbstrplr.Value == nil || len(*mbstrplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) hasNextLink() bool { - return mdsaplr.NextLink != nil && len(*mdsaplr.NextLink) != 0 +func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) hasNextLink() bool { + return mbstrplr.NextLink != nil && len(*mbstrplr.NextLink) != 0 } -// managedDatabaseSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. +// managedBackupShortTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) managedDatabaseSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mdsaplr.hasNextLink() { +func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) managedBackupShortTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mbstrplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(mdsaplr.NextLink))) + autorest.WithBaseURL(to.String(mbstrplr.NextLink))) } -// ManagedDatabaseSecurityAlertPolicyListResultPage contains a page of ManagedDatabaseSecurityAlertPolicy -// values. -type ManagedDatabaseSecurityAlertPolicyListResultPage struct { - fn func(context.Context, ManagedDatabaseSecurityAlertPolicyListResult) (ManagedDatabaseSecurityAlertPolicyListResult, error) - mdsaplr ManagedDatabaseSecurityAlertPolicyListResult +// ManagedBackupShortTermRetentionPolicyListResultPage contains a page of +// ManagedBackupShortTermRetentionPolicy values. +type ManagedBackupShortTermRetentionPolicyListResultPage struct { + fn func(context.Context, ManagedBackupShortTermRetentionPolicyListResult) (ManagedBackupShortTermRetentionPolicyListResult, error) + mbstrplr ManagedBackupShortTermRetentionPolicyListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedDatabaseSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedBackupShortTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPolicyListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPolicyListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -14895,11 +15577,11 @@ func (page *ManagedDatabaseSecurityAlertPolicyListResultPage) NextWithContext(ct }() } for { - next, err := page.fn(ctx, page.mdsaplr) + next, err := page.fn(ctx, page.mbstrplr) if err != nil { return err } - page.mdsaplr = next + page.mbstrplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -14910,178 +15592,47 @@ func (page *ManagedDatabaseSecurityAlertPolicyListResultPage) NextWithContext(ct // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedDatabaseSecurityAlertPolicyListResultPage) Next() error { +func (page *ManagedBackupShortTermRetentionPolicyListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedDatabaseSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.mdsaplr.IsEmpty() +func (page ManagedBackupShortTermRetentionPolicyListResultPage) NotDone() bool { + return !page.mbstrplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedDatabaseSecurityAlertPolicyListResultPage) Response() ManagedDatabaseSecurityAlertPolicyListResult { - return page.mdsaplr +func (page ManagedBackupShortTermRetentionPolicyListResultPage) Response() ManagedBackupShortTermRetentionPolicyListResult { + return page.mbstrplr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedDatabaseSecurityAlertPolicyListResultPage) Values() []ManagedDatabaseSecurityAlertPolicy { - if page.mdsaplr.IsEmpty() { +func (page ManagedBackupShortTermRetentionPolicyListResultPage) Values() []ManagedBackupShortTermRetentionPolicy { + if page.mbstrplr.IsEmpty() { return nil } - return *page.mdsaplr.Value -} - -// Creates a new instance of the ManagedDatabaseSecurityAlertPolicyListResultPage type. -func NewManagedDatabaseSecurityAlertPolicyListResultPage(cur ManagedDatabaseSecurityAlertPolicyListResult, getNextPage func(context.Context, ManagedDatabaseSecurityAlertPolicyListResult) (ManagedDatabaseSecurityAlertPolicyListResult, error)) ManagedDatabaseSecurityAlertPolicyListResultPage { - return ManagedDatabaseSecurityAlertPolicyListResultPage{ - fn: getNextPage, - mdsaplr: cur, - } + return *page.mbstrplr.Value } -// ManagedDatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedDatabasesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabasesClient) (ManagedDatabase, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabasesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// Creates a new instance of the ManagedBackupShortTermRetentionPolicyListResultPage type. +func NewManagedBackupShortTermRetentionPolicyListResultPage(cur ManagedBackupShortTermRetentionPolicyListResult, getNextPage func(context.Context, ManagedBackupShortTermRetentionPolicyListResult) (ManagedBackupShortTermRetentionPolicyListResult, error)) ManagedBackupShortTermRetentionPolicyListResultPage { + return ManagedBackupShortTermRetentionPolicyListResultPage{ + fn: getNextPage, + mbstrplr: cur, } - future.FutureAPI = &azFuture - future.Result = future.result - return nil } -// result is the default implementation for ManagedDatabasesUpdateFuture.Result. -func (future *ManagedDatabasesUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - md.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { - md, err = client.UpdateResponder(md.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", md.Response.Response, "Failure responding to request") - } - } - return +// ManagedBackupShortTermRetentionPolicyProperties properties of a short term retention policy +type ManagedBackupShortTermRetentionPolicyProperties struct { + // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + RetentionDays *int32 `json:"retentionDays,omitempty"` } -// ManagedDatabaseUpdate an managed database update. -type ManagedDatabaseUpdate struct { +// ManagedDatabase a managed database resource. +type ManagedDatabase struct { + autorest.Response `json:"-"` // ManagedDatabaseProperties - Resource properties. *ManagedDatabaseProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedDatabaseUpdate. -func (mdu ManagedDatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mdu.ManagedDatabaseProperties != nil { - objectMap["properties"] = mdu.ManagedDatabaseProperties - } - if mdu.Tags != nil { - objectMap["tags"] = mdu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseUpdate struct. -func (mdu *ManagedDatabaseUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedDatabaseProperties ManagedDatabaseProperties - err = json.Unmarshal(*v, &managedDatabaseProperties) - if err != nil { - return err - } - mdu.ManagedDatabaseProperties = &managedDatabaseProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mdu.Tags = tags - } - } - } - - return nil -} - -// ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedDatabaseVulnerabilityAssessmentScansClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture.Result. -func (future *ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture) result(client ManagedDatabaseVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstance an Azure SQL managed instance. -type ManagedInstance struct { - autorest.Response `json:"-"` - // Identity - The Azure Active Directory identity of the managed instance. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 - Sku *Sku `json:"sku,omitempty"` - // ManagedInstanceProperties - Resource properties. - *ManagedInstanceProperties `json:"properties,omitempty"` // Location - Resource location. Location *string `json:"location,omitempty"` // Tags - Resource tags. @@ -15094,29 +15645,23 @@ type ManagedInstance struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstance. -func (mi ManagedInstance) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedDatabase. +func (md ManagedDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mi.Identity != nil { - objectMap["identity"] = mi.Identity - } - if mi.Sku != nil { - objectMap["sku"] = mi.Sku - } - if mi.ManagedInstanceProperties != nil { - objectMap["properties"] = mi.ManagedInstanceProperties + if md.ManagedDatabaseProperties != nil { + objectMap["properties"] = md.ManagedDatabaseProperties } - if mi.Location != nil { - objectMap["location"] = mi.Location + if md.Location != nil { + objectMap["location"] = md.Location } - if mi.Tags != nil { - objectMap["tags"] = mi.Tags + if md.Tags != nil { + objectMap["tags"] = md.Tags } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstance struct. -func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedDatabase struct. +func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -15124,32 +15669,14 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mi.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - mi.Sku = &sku - } case "properties": if v != nil { - var managedInstanceProperties ManagedInstanceProperties - err = json.Unmarshal(*v, &managedInstanceProperties) + var managedDatabaseProperties ManagedDatabaseProperties + err = json.Unmarshal(*v, &managedDatabaseProperties) if err != nil { return err } - mi.ManagedInstanceProperties = &managedInstanceProperties + md.ManagedDatabaseProperties = &managedDatabaseProperties } case "location": if v != nil { @@ -15158,7 +15685,7 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { if err != nil { return err } - mi.Location = &location + md.Location = &location } case "tags": if v != nil { @@ -15167,7 +15694,7 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { if err != nil { return err } - mi.Tags = tags + md.Tags = tags } case "id": if v != nil { @@ -15176,7 +15703,7 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { if err != nil { return err } - mi.ID = &ID + md.ID = &ID } case "name": if v != nil { @@ -15185,7 +15712,7 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { if err != nil { return err } - mi.Name = &name + md.Name = &name } case "type": if v != nil { @@ -15194,7 +15721,7 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { if err != nil { return err } - mi.Type = &typeVar + md.Type = &typeVar } } } @@ -15202,113 +15729,39 @@ func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { return nil } -// ManagedInstanceAdministrator an Azure SQL managed instance administrator. -type ManagedInstanceAdministrator struct { +// ManagedDatabaseListResult a list of managed databases. +type ManagedDatabaseListResult struct { autorest.Response `json:"-"` - // ManagedInstanceAdministratorProperties - Resource properties. - *ManagedInstanceAdministratorProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` + // Value - READ-ONLY; Array of results. + Value *[]ManagedDatabase `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceAdministrator. -func (mia ManagedInstanceAdministrator) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedDatabaseListResult. +func (mdlr ManagedDatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mia.ManagedInstanceAdministratorProperties != nil { - objectMap["properties"] = mia.ManagedInstanceAdministratorProperties - } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAdministrator struct. -func (mia *ManagedInstanceAdministrator) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedInstanceAdministratorProperties ManagedInstanceAdministratorProperties - err = json.Unmarshal(*v, &managedInstanceAdministratorProperties) - if err != nil { - return err - } - mia.ManagedInstanceAdministratorProperties = &managedInstanceAdministratorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mia.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mia.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mia.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstanceAdministratorListResult a list of managed instance administrators. -type ManagedInstanceAdministratorListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceAdministrator `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceAdministratorListResult. -func (mialr ManagedInstanceAdministratorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstanceAdministratorListResultIterator provides access to a complete listing of -// ManagedInstanceAdministrator values. -type ManagedInstanceAdministratorListResultIterator struct { - i int - page ManagedInstanceAdministratorListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceAdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() +// ManagedDatabaseListResultIterator provides access to a complete listing of ManagedDatabase values. +type ManagedDatabaseListResultIterator struct { + i int + page ManagedDatabaseListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() } iter.i++ if iter.i < len(iter.page.Values()) { @@ -15326,67 +15779,67 @@ func (iter *ManagedInstanceAdministratorListResultIterator) NextWithContext(ctx // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceAdministratorListResultIterator) Next() error { +func (iter *ManagedDatabaseListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceAdministratorListResultIterator) NotDone() bool { +func (iter ManagedDatabaseListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceAdministratorListResultIterator) Response() ManagedInstanceAdministratorListResult { +func (iter ManagedDatabaseListResultIterator) Response() ManagedDatabaseListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceAdministratorListResultIterator) Value() ManagedInstanceAdministrator { +func (iter ManagedDatabaseListResultIterator) Value() ManagedDatabase { if !iter.page.NotDone() { - return ManagedInstanceAdministrator{} + return ManagedDatabase{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceAdministratorListResultIterator type. -func NewManagedInstanceAdministratorListResultIterator(page ManagedInstanceAdministratorListResultPage) ManagedInstanceAdministratorListResultIterator { - return ManagedInstanceAdministratorListResultIterator{page: page} +// Creates a new instance of the ManagedDatabaseListResultIterator type. +func NewManagedDatabaseListResultIterator(page ManagedDatabaseListResultPage) ManagedDatabaseListResultIterator { + return ManagedDatabaseListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (mialr ManagedInstanceAdministratorListResult) IsEmpty() bool { - return mialr.Value == nil || len(*mialr.Value) == 0 +func (mdlr ManagedDatabaseListResult) IsEmpty() bool { + return mdlr.Value == nil || len(*mdlr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (mialr ManagedInstanceAdministratorListResult) hasNextLink() bool { - return mialr.NextLink != nil && len(*mialr.NextLink) != 0 +func (mdlr ManagedDatabaseListResult) hasNextLink() bool { + return mdlr.NextLink != nil && len(*mdlr.NextLink) != 0 } -// managedInstanceAdministratorListResultPreparer prepares a request to retrieve the next set of results. +// managedDatabaseListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (mialr ManagedInstanceAdministratorListResult) managedInstanceAdministratorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mialr.hasNextLink() { +func (mdlr ManagedDatabaseListResult) managedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mdlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(mialr.NextLink))) + autorest.WithBaseURL(to.String(mdlr.NextLink))) } -// ManagedInstanceAdministratorListResultPage contains a page of ManagedInstanceAdministrator values. -type ManagedInstanceAdministratorListResultPage struct { - fn func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error) - mialr ManagedInstanceAdministratorListResult +// ManagedDatabaseListResultPage contains a page of ManagedDatabase values. +type ManagedDatabaseListResultPage struct { + fn func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error) + mdlr ManagedDatabaseListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -15396,11 +15849,11 @@ func (page *ManagedInstanceAdministratorListResultPage) NextWithContext(ctx cont }() } for { - next, err := page.fn(ctx, page.mialr) + next, err := page.fn(ctx, page.mdlr) if err != nil { return err } - page.mialr = next + page.mdlr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -15411,133 +15864,151 @@ func (page *ManagedInstanceAdministratorListResultPage) NextWithContext(ctx cont // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceAdministratorListResultPage) Next() error { +func (page *ManagedDatabaseListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceAdministratorListResultPage) NotDone() bool { - return !page.mialr.IsEmpty() +func (page ManagedDatabaseListResultPage) NotDone() bool { + return !page.mdlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstanceAdministratorListResultPage) Response() ManagedInstanceAdministratorListResult { - return page.mialr +func (page ManagedDatabaseListResultPage) Response() ManagedDatabaseListResult { + return page.mdlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceAdministratorListResultPage) Values() []ManagedInstanceAdministrator { - if page.mialr.IsEmpty() { +func (page ManagedDatabaseListResultPage) Values() []ManagedDatabase { + if page.mdlr.IsEmpty() { return nil } - return *page.mialr.Value + return *page.mdlr.Value } -// Creates a new instance of the ManagedInstanceAdministratorListResultPage type. -func NewManagedInstanceAdministratorListResultPage(cur ManagedInstanceAdministratorListResult, getNextPage func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error)) ManagedInstanceAdministratorListResultPage { - return ManagedInstanceAdministratorListResultPage{ - fn: getNextPage, - mialr: cur, +// Creates a new instance of the ManagedDatabaseListResultPage type. +func NewManagedDatabaseListResultPage(cur ManagedDatabaseListResult, getNextPage func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error)) ManagedDatabaseListResultPage { + return ManagedDatabaseListResultPage{ + fn: getNextPage, + mdlr: cur, } } -// ManagedInstanceAdministratorProperties the properties of a managed instance administrator. -type ManagedInstanceAdministratorProperties struct { - // AdministratorType - Type of the managed instance administrator. - AdministratorType *string `json:"administratorType,omitempty"` - // Login - Login name of the managed instance administrator. - Login *string `json:"login,omitempty"` - // Sid - SID (object ID) of the managed instance administrator. - Sid *uuid.UUID `json:"sid,omitempty"` - // TenantID - Tenant ID of the managed instance administrator. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// ManagedInstanceAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceAdministratorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceAdministratorsClient) (ManagedInstanceAdministrator, error) +// ManagedDatabaseProperties the managed database's properties. +type ManagedDatabaseProperties struct { + // Collation - Collation of the managed database. + Collation *string `json:"collation,omitempty"` + // Status - READ-ONLY; Status of the database. Possible values include: 'ManagedDatabaseStatusOnline', 'ManagedDatabaseStatusOffline', 'ManagedDatabaseStatusShutdown', 'ManagedDatabaseStatusCreating', 'ManagedDatabaseStatusInaccessible', 'ManagedDatabaseStatusRestoring', 'ManagedDatabaseStatusUpdating' + Status ManagedDatabaseStatus `json:"status,omitempty"` + // CreationDate - READ-ONLY; Creation date of the database. + CreationDate *date.Time `json:"creationDate,omitempty"` + // EarliestRestorePoint - READ-ONLY; Earliest restore point in time for point in time restore. + EarliestRestorePoint *date.Time `json:"earliestRestorePoint,omitempty"` + // 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. + RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` + // DefaultSecondaryLocation - READ-ONLY; Geo paired region. + DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` + // CatalogCollation - Collation of the metadata catalog. Possible values include: 'CatalogCollationTypeDATABASEDEFAULT', 'CatalogCollationTypeSQLLatin1GeneralCP1CIAS' + CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` + // 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required). Possible values include: 'ManagedDatabaseCreateModeDefault', 'ManagedDatabaseCreateModeRestoreExternalBackup', 'ManagedDatabaseCreateModePointInTimeRestore', 'ManagedDatabaseCreateModeRecovery', 'ManagedDatabaseCreateModeRestoreLongTermRetentionBackup' + CreateMode ManagedDatabaseCreateMode `json:"createMode,omitempty"` + // StorageContainerURI - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. + StorageContainerURI *string `json:"storageContainerUri,omitempty"` + // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. + SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + // RestorableDroppedDatabaseID - The restorable dropped database resource id to restore when creating this database. + RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` + // StorageContainerSasToken - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. + StorageContainerSasToken *string `json:"storageContainerSasToken,omitempty"` + // FailoverGroupID - READ-ONLY; Instance Failover Group resource identifier that this managed database belongs to. + FailoverGroupID *string `json:"failoverGroupId,omitempty"` + // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. + RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` + // LongTermRetentionBackupResourceID - The name of the Long Term Retention backup to be used for restore of this managed database. + LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` + // AutoCompleteRestore - Whether to auto complete restore of this managed database. + AutoCompleteRestore *bool `json:"autoCompleteRestore,omitempty"` + // LastBackupName - Last backup file name for restore of this managed database. + LastBackupName *string `json:"lastBackupName,omitempty"` } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// MarshalJSON is the custom marshaler for ManagedDatabaseProperties. +func (mdp ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mdp.Collation != nil { + objectMap["collation"] = mdp.Collation } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedInstanceAdministratorsCreateOrUpdateFuture.Result. -func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) result(client ManagedInstanceAdministratorsClient) (mia ManagedInstanceAdministrator, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return + if mdp.RestorePointInTime != nil { + objectMap["restorePointInTime"] = mdp.RestorePointInTime } - if !done { - mia.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsCreateOrUpdateFuture") - return + if mdp.CatalogCollation != "" { + objectMap["catalogCollation"] = mdp.CatalogCollation } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mia.Response.Response, err = future.GetResult(sender); err == nil && mia.Response.Response.StatusCode != http.StatusNoContent { - mia, err = client.CreateOrUpdateResponder(mia.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", mia.Response.Response, "Failure responding to request") - } + if mdp.CreateMode != "" { + objectMap["createMode"] = mdp.CreateMode } - return -} - -// ManagedInstanceAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceAdministratorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstanceAdministratorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceAdministratorsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err + if mdp.StorageContainerURI != nil { + objectMap["storageContainerUri"] = mdp.StorageContainerURI } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedInstanceAdministratorsDeleteFuture.Result. -func (future *ManagedInstanceAdministratorsDeleteFuture) result(client ManagedInstanceAdministratorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") - return + if mdp.SourceDatabaseID != nil { + objectMap["sourceDatabaseId"] = mdp.SourceDatabaseID } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsDeleteFuture") - return + if mdp.RestorableDroppedDatabaseID != nil { + objectMap["restorableDroppedDatabaseId"] = mdp.RestorableDroppedDatabaseID } - ar.Response = future.Response() - return + if mdp.StorageContainerSasToken != nil { + objectMap["storageContainerSasToken"] = mdp.StorageContainerSasToken + } + if mdp.RecoverableDatabaseID != nil { + objectMap["recoverableDatabaseId"] = mdp.RecoverableDatabaseID + } + if mdp.LongTermRetentionBackupResourceID != nil { + objectMap["longTermRetentionBackupResourceId"] = mdp.LongTermRetentionBackupResourceID + } + if mdp.AutoCompleteRestore != nil { + objectMap["autoCompleteRestore"] = mdp.AutoCompleteRestore + } + if mdp.LastBackupName != nil { + objectMap["lastBackupName"] = mdp.LastBackupName + } + return json.Marshal(objectMap) } -// ManagedInstanceAzureADOnlyAuthentication azure Active Directory only authentication. -type ManagedInstanceAzureADOnlyAuthentication struct { +// ManagedDatabaseRestoreDetailsProperties the managed database's restore details properties. +type ManagedDatabaseRestoreDetailsProperties struct { + // Status - READ-ONLY; Restore status. + Status *string `json:"status,omitempty"` + // CurrentRestoringFileName - READ-ONLY; Current restoring file name. + CurrentRestoringFileName *string `json:"currentRestoringFileName,omitempty"` + // LastRestoredFileName - READ-ONLY; Last restored file name. + LastRestoredFileName *string `json:"lastRestoredFileName,omitempty"` + // LastRestoredFileTime - READ-ONLY; Last restored file time. + LastRestoredFileTime *date.Time `json:"lastRestoredFileTime,omitempty"` + // PercentCompleted - READ-ONLY; Percent completed. + PercentCompleted *float64 `json:"percentCompleted,omitempty"` + // UnrestorableFiles - READ-ONLY; List of unrestorable files. + UnrestorableFiles *[]string `json:"unrestorableFiles,omitempty"` + // NumberOfFilesDetected - READ-ONLY; Number of files detected. + NumberOfFilesDetected *int64 `json:"numberOfFilesDetected,omitempty"` + // LastUploadedFileName - READ-ONLY; Last uploaded file name. + LastUploadedFileName *string `json:"lastUploadedFileName,omitempty"` + // LastUploadedFileTime - READ-ONLY; Last uploaded file time. + LastUploadedFileTime *date.Time `json:"lastUploadedFileTime,omitempty"` + // BlockReason - READ-ONLY; The reason why restore is in Blocked state. + BlockReason *string `json:"blockReason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsProperties. +func (mdrdp ManagedDatabaseRestoreDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedDatabaseRestoreDetailsResult a managed database restore details. +type ManagedDatabaseRestoreDetailsResult struct { autorest.Response `json:"-"` - // ManagedInstanceAzureADOnlyAuthProperties - Resource properties. - *ManagedInstanceAzureADOnlyAuthProperties `json:"properties,omitempty"` + // ManagedDatabaseRestoreDetailsProperties - Resource properties. + *ManagedDatabaseRestoreDetailsProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -15546,17 +16017,17 @@ type ManagedInstanceAzureADOnlyAuthentication struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceAzureADOnlyAuthentication. -func (miaaoa ManagedInstanceAzureADOnlyAuthentication) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsResult. +func (mdrdr ManagedDatabaseRestoreDetailsResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if miaaoa.ManagedInstanceAzureADOnlyAuthProperties != nil { - objectMap["properties"] = miaaoa.ManagedInstanceAzureADOnlyAuthProperties + if mdrdr.ManagedDatabaseRestoreDetailsProperties != nil { + objectMap["properties"] = mdrdr.ManagedDatabaseRestoreDetailsProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAzureADOnlyAuthentication struct. -func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseRestoreDetailsResult struct. +func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -15566,12 +16037,12 @@ func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(body []byt switch k { case "properties": if v != nil { - var managedInstanceAzureADOnlyAuthProperties ManagedInstanceAzureADOnlyAuthProperties - err = json.Unmarshal(*v, &managedInstanceAzureADOnlyAuthProperties) + var managedDatabaseRestoreDetailsProperties ManagedDatabaseRestoreDetailsProperties + err = json.Unmarshal(*v, &managedDatabaseRestoreDetailsProperties) if err != nil { return err } - miaaoa.ManagedInstanceAzureADOnlyAuthProperties = &managedInstanceAzureADOnlyAuthProperties + mdrdr.ManagedDatabaseRestoreDetailsProperties = &managedDatabaseRestoreDetailsProperties } case "id": if v != nil { @@ -15580,7 +16051,7 @@ func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(body []byt if err != nil { return err } - miaaoa.ID = &ID + mdrdr.ID = &ID } case "name": if v != nil { @@ -15589,7 +16060,7 @@ func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(body []byt if err != nil { return err } - miaaoa.Name = &name + mdrdr.Name = &name } case "type": if v != nil { @@ -15598,7 +16069,7 @@ func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(body []byt if err != nil { return err } - miaaoa.Type = &typeVar + mdrdr.Type = &typeVar } } } @@ -15606,17 +16077,17 @@ func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(body []byt return nil } -// ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture struct { +// ManagedDatabasesCompleteRestoreFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedDatabasesCompleteRestoreFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstanceAzureADOnlyAuthenticationsClient) (ManagedInstanceAzureADOnlyAuthentication, error) + Result func(ManagedDatabasesClient) (autorest.Response, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedDatabasesCompleteRestoreFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -15626,40 +16097,77 @@ func (future *ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture) Unm return nil } -// result is the default implementation for ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture.Result. -func (future *ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture) result(client ManagedInstanceAzureADOnlyAuthenticationsClient) (miaaoa ManagedInstanceAzureADOnlyAuthentication, err error) { +// result is the default implementation for ManagedDatabasesCompleteRestoreFuture.Result. +func (future *ManagedDatabasesCompleteRestoreFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCompleteRestoreFuture", "Result", future.Response(), "Polling failure") return } if !done { - miaaoa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture") + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCompleteRestoreFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedDatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedDatabasesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedDatabasesClient) (ManagedDatabase, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedDatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedDatabasesCreateOrUpdateFuture.Result. +func (future *ManagedDatabasesCreateOrUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + md.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miaaoa.Response.Response, err = future.GetResult(sender); err == nil && miaaoa.Response.Response.StatusCode != http.StatusNoContent { - miaaoa, err = client.CreateOrUpdateResponder(miaaoa.Response.Response) + if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { + md, err = client.CreateOrUpdateResponder(md.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", miaaoa.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", md.Response.Response, "Failure responding to request") } } return } -// ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture struct { +// ManagedDatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedDatabasesDeleteFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstanceAzureADOnlyAuthenticationsClient) (autorest.Response, error) + Result func(ManagedDatabasesClient) (autorest.Response, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedDatabasesDeleteFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -15669,272 +16177,62 @@ func (future *ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture) UnmarshalJS return nil } -// result is the default implementation for ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture.Result. -func (future *ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture) result(client ManagedInstanceAzureADOnlyAuthenticationsClient) (ar autorest.Response, err error) { +// result is the default implementation for ManagedDatabasesDeleteFuture.Result. +func (future *ManagedDatabasesDeleteFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesDeleteFuture", "Result", future.Response(), "Polling failure") return } if !done { ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture") + err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesDeleteFuture") return } ar.Response = future.Response() return } -// ManagedInstanceAzureADOnlyAuthListResult a list of active directory only authentications. -type ManagedInstanceAzureADOnlyAuthListResult struct { +// ManagedDatabaseSecurityAlertPolicy a managed database security alert policy. +type ManagedDatabaseSecurityAlertPolicy struct { autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceAzureADOnlyAuthentication `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` + // SecurityAlertPolicyProperties - Resource properties. + *SecurityAlertPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceAzureADOnlyAuthListResult. -func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedDatabaseSecurityAlertPolicy. +func (mdsap ManagedDatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if mdsap.SecurityAlertPolicyProperties != nil { + objectMap["properties"] = mdsap.SecurityAlertPolicyProperties + } return json.Marshal(objectMap) } -// ManagedInstanceAzureADOnlyAuthListResultIterator provides access to a complete listing of -// ManagedInstanceAzureADOnlyAuthentication values. -type ManagedInstanceAzureADOnlyAuthListResultIterator struct { - i int - page ManagedInstanceAzureADOnlyAuthListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceAzureADOnlyAuthListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceAzureADOnlyAuthListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) Response() ManagedInstanceAzureADOnlyAuthListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) Value() ManagedInstanceAzureADOnlyAuthentication { - if !iter.page.NotDone() { - return ManagedInstanceAzureADOnlyAuthentication{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedInstanceAzureADOnlyAuthListResultIterator type. -func NewManagedInstanceAzureADOnlyAuthListResultIterator(page ManagedInstanceAzureADOnlyAuthListResultPage) ManagedInstanceAzureADOnlyAuthListResultIterator { - return ManagedInstanceAzureADOnlyAuthListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) IsEmpty() bool { - return miaaoalr.Value == nil || len(*miaaoalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) hasNextLink() bool { - return miaaoalr.NextLink != nil && len(*miaaoalr.NextLink) != 0 -} - -// managedInstanceAzureADOnlyAuthListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) managedInstanceAzureADOnlyAuthListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miaaoalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(miaaoalr.NextLink))) -} - -// ManagedInstanceAzureADOnlyAuthListResultPage contains a page of ManagedInstanceAzureADOnlyAuthentication -// values. -type ManagedInstanceAzureADOnlyAuthListResultPage struct { - fn func(context.Context, ManagedInstanceAzureADOnlyAuthListResult) (ManagedInstanceAzureADOnlyAuthListResult, error) - miaaoalr ManagedInstanceAzureADOnlyAuthListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ManagedInstanceAzureADOnlyAuthListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.miaaoalr) - if err != nil { - return err - } - page.miaaoalr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceAzureADOnlyAuthListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceAzureADOnlyAuthListResultPage) NotDone() bool { - return !page.miaaoalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceAzureADOnlyAuthListResultPage) Response() ManagedInstanceAzureADOnlyAuthListResult { - return page.miaaoalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceAzureADOnlyAuthListResultPage) Values() []ManagedInstanceAzureADOnlyAuthentication { - if page.miaaoalr.IsEmpty() { - return nil - } - return *page.miaaoalr.Value -} - -// Creates a new instance of the ManagedInstanceAzureADOnlyAuthListResultPage type. -func NewManagedInstanceAzureADOnlyAuthListResultPage(cur ManagedInstanceAzureADOnlyAuthListResult, getNextPage func(context.Context, ManagedInstanceAzureADOnlyAuthListResult) (ManagedInstanceAzureADOnlyAuthListResult, error)) ManagedInstanceAzureADOnlyAuthListResultPage { - return ManagedInstanceAzureADOnlyAuthListResultPage{ - fn: getNextPage, - miaaoalr: cur, - } -} - -// ManagedInstanceAzureADOnlyAuthProperties properties of a active directory only authentication for -// Managed Instance. -type ManagedInstanceAzureADOnlyAuthProperties struct { - // AzureADOnlyAuthentication - Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` -} - -// ManagedInstanceEditionCapability the managed server capability -type ManagedInstanceEditionCapability struct { - // Name - READ-ONLY; The managed server version name. - Name *string `json:"name,omitempty"` - // SupportedFamilies - READ-ONLY; The supported families. - SupportedFamilies *[]ManagedInstanceFamilyCapability `json:"supportedFamilies,omitempty"` - // SupportedStorageCapabilities - READ-ONLY; The list of supported storage capabilities for this edition - SupportedStorageCapabilities *[]StorageCapability `json:"supportedStorageCapabilities,omitempty"` - // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEditionCapability. -func (miec ManagedInstanceEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miec.Reason != nil { - objectMap["reason"] = miec.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceEncryptionProtector the managed instance encryption protector. -type ManagedInstanceEncryptionProtector struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedInstanceEncryptionProtectorProperties - Resource properties. - *ManagedInstanceEncryptionProtectorProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtector. -func (miep ManagedInstanceEncryptionProtector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miep.ManagedInstanceEncryptionProtectorProperties != nil { - objectMap["properties"] = miep.ManagedInstanceEncryptionProtectorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceEncryptionProtector struct. -func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) +// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseSecurityAlertPolicy struct. +func (mdsap *ManagedDatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { return err } for k, v := range m { switch k { - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - miep.Kind = &kind - } case "properties": if v != nil { - var managedInstanceEncryptionProtectorProperties ManagedInstanceEncryptionProtectorProperties - err = json.Unmarshal(*v, &managedInstanceEncryptionProtectorProperties) + var securityAlertPolicyProperties SecurityAlertPolicyProperties + err = json.Unmarshal(*v, &securityAlertPolicyProperties) if err != nil { return err } - miep.ManagedInstanceEncryptionProtectorProperties = &managedInstanceEncryptionProtectorProperties + mdsap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties } case "id": if v != nil { @@ -15943,7 +16241,7 @@ func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error if err != nil { return err } - miep.ID = &ID + mdsap.ID = &ID } case "name": if v != nil { @@ -15952,7 +16250,7 @@ func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error if err != nil { return err } - miep.Name = &name + mdsap.Name = &name } case "type": if v != nil { @@ -15961,7 +16259,7 @@ func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error if err != nil { return err } - miep.Type = &typeVar + mdsap.Type = &typeVar } } } @@ -15969,33 +16267,33 @@ func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error return nil } -// ManagedInstanceEncryptionProtectorListResult a list of managed instance encryption protectors. -type ManagedInstanceEncryptionProtectorListResult struct { +// ManagedDatabaseSecurityAlertPolicyListResult a list of the managed database's security alert policies. +type ManagedDatabaseSecurityAlertPolicyListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceEncryptionProtector `json:"value,omitempty"` + Value *[]ManagedDatabaseSecurityAlertPolicy `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtectorListResult. -func (mieplr ManagedInstanceEncryptionProtectorListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedDatabaseSecurityAlertPolicyListResult. +func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstanceEncryptionProtectorListResultIterator provides access to a complete listing of -// ManagedInstanceEncryptionProtector values. -type ManagedInstanceEncryptionProtectorListResultIterator struct { +// ManagedDatabaseSecurityAlertPolicyListResultIterator provides access to a complete listing of +// ManagedDatabaseSecurityAlertPolicy values. +type ManagedDatabaseSecurityAlertPolicyListResultIterator struct { i int - page ManagedInstanceEncryptionProtectorListResultPage + page ManagedDatabaseSecurityAlertPolicyListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceEncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedDatabaseSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPolicyListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -16020,68 +16318,68 @@ func (iter *ManagedInstanceEncryptionProtectorListResultIterator) NextWithContex // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceEncryptionProtectorListResultIterator) Next() error { +func (iter *ManagedDatabaseSecurityAlertPolicyListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceEncryptionProtectorListResultIterator) NotDone() bool { +func (iter ManagedDatabaseSecurityAlertPolicyListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceEncryptionProtectorListResultIterator) Response() ManagedInstanceEncryptionProtectorListResult { +func (iter ManagedDatabaseSecurityAlertPolicyListResultIterator) Response() ManagedDatabaseSecurityAlertPolicyListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceEncryptionProtectorListResultIterator) Value() ManagedInstanceEncryptionProtector { +func (iter ManagedDatabaseSecurityAlertPolicyListResultIterator) Value() ManagedDatabaseSecurityAlertPolicy { if !iter.page.NotDone() { - return ManagedInstanceEncryptionProtector{} + return ManagedDatabaseSecurityAlertPolicy{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultIterator type. -func NewManagedInstanceEncryptionProtectorListResultIterator(page ManagedInstanceEncryptionProtectorListResultPage) ManagedInstanceEncryptionProtectorListResultIterator { - return ManagedInstanceEncryptionProtectorListResultIterator{page: page} +// Creates a new instance of the ManagedDatabaseSecurityAlertPolicyListResultIterator type. +func NewManagedDatabaseSecurityAlertPolicyListResultIterator(page ManagedDatabaseSecurityAlertPolicyListResultPage) ManagedDatabaseSecurityAlertPolicyListResultIterator { + return ManagedDatabaseSecurityAlertPolicyListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (mieplr ManagedInstanceEncryptionProtectorListResult) IsEmpty() bool { - return mieplr.Value == nil || len(*mieplr.Value) == 0 +func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) IsEmpty() bool { + return mdsaplr.Value == nil || len(*mdsaplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (mieplr ManagedInstanceEncryptionProtectorListResult) hasNextLink() bool { - return mieplr.NextLink != nil && len(*mieplr.NextLink) != 0 +func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) hasNextLink() bool { + return mdsaplr.NextLink != nil && len(*mdsaplr.NextLink) != 0 } -// managedInstanceEncryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. +// managedDatabaseSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (mieplr ManagedInstanceEncryptionProtectorListResult) managedInstanceEncryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mieplr.hasNextLink() { +func (mdsaplr ManagedDatabaseSecurityAlertPolicyListResult) managedDatabaseSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mdsaplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(mieplr.NextLink))) + autorest.WithBaseURL(to.String(mdsaplr.NextLink))) } -// ManagedInstanceEncryptionProtectorListResultPage contains a page of ManagedInstanceEncryptionProtector +// ManagedDatabaseSecurityAlertPolicyListResultPage contains a page of ManagedDatabaseSecurityAlertPolicy // values. -type ManagedInstanceEncryptionProtectorListResultPage struct { - fn func(context.Context, ManagedInstanceEncryptionProtectorListResult) (ManagedInstanceEncryptionProtectorListResult, error) - mieplr ManagedInstanceEncryptionProtectorListResult +type ManagedDatabaseSecurityAlertPolicyListResultPage struct { + fn func(context.Context, ManagedDatabaseSecurityAlertPolicyListResult) (ManagedDatabaseSecurityAlertPolicyListResult, error) + mdsaplr ManagedDatabaseSecurityAlertPolicyListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceEncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedDatabaseSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseSecurityAlertPolicyListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -16091,11 +16389,11 @@ func (page *ManagedInstanceEncryptionProtectorListResultPage) NextWithContext(ct }() } for { - next, err := page.fn(ctx, page.mieplr) + next, err := page.fn(ctx, page.mdsaplr) if err != nil { return err } - page.mieplr = next + page.mdsaplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -16106,76 +16404,47 @@ func (page *ManagedInstanceEncryptionProtectorListResultPage) NextWithContext(ct // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceEncryptionProtectorListResultPage) Next() error { +func (page *ManagedDatabaseSecurityAlertPolicyListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceEncryptionProtectorListResultPage) NotDone() bool { - return !page.mieplr.IsEmpty() +func (page ManagedDatabaseSecurityAlertPolicyListResultPage) NotDone() bool { + return !page.mdsaplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstanceEncryptionProtectorListResultPage) Response() ManagedInstanceEncryptionProtectorListResult { - return page.mieplr +func (page ManagedDatabaseSecurityAlertPolicyListResultPage) Response() ManagedDatabaseSecurityAlertPolicyListResult { + return page.mdsaplr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceEncryptionProtectorListResultPage) Values() []ManagedInstanceEncryptionProtector { - if page.mieplr.IsEmpty() { +func (page ManagedDatabaseSecurityAlertPolicyListResultPage) Values() []ManagedDatabaseSecurityAlertPolicy { + if page.mdsaplr.IsEmpty() { return nil } - return *page.mieplr.Value -} - -// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultPage type. -func NewManagedInstanceEncryptionProtectorListResultPage(cur ManagedInstanceEncryptionProtectorListResult, getNextPage func(context.Context, ManagedInstanceEncryptionProtectorListResult) (ManagedInstanceEncryptionProtectorListResult, error)) ManagedInstanceEncryptionProtectorListResultPage { - return ManagedInstanceEncryptionProtectorListResultPage{ - fn: getNextPage, - mieplr: cur, - } -} - -// ManagedInstanceEncryptionProtectorProperties properties for an encryption protector execution. -type ManagedInstanceEncryptionProtectorProperties struct { - // ServerKeyName - The name of the managed instance key. - ServerKeyName *string `json:"serverKeyName,omitempty"` - // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServerKeyTypeServiceManaged', 'ServerKeyTypeAzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty"` - // AutoRotationEnabled - Key auto rotation opt-in flag. Either true or false. - AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty"` + return *page.mdsaplr.Value } -// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtectorProperties. -func (miepp ManagedInstanceEncryptionProtectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miepp.ServerKeyName != nil { - objectMap["serverKeyName"] = miepp.ServerKeyName - } - if miepp.ServerKeyType != "" { - objectMap["serverKeyType"] = miepp.ServerKeyType - } - if miepp.AutoRotationEnabled != nil { - objectMap["autoRotationEnabled"] = miepp.AutoRotationEnabled +// Creates a new instance of the ManagedDatabaseSecurityAlertPolicyListResultPage type. +func NewManagedDatabaseSecurityAlertPolicyListResultPage(cur ManagedDatabaseSecurityAlertPolicyListResult, getNextPage func(context.Context, ManagedDatabaseSecurityAlertPolicyListResult) (ManagedDatabaseSecurityAlertPolicyListResult, error)) ManagedDatabaseSecurityAlertPolicyListResultPage { + return ManagedDatabaseSecurityAlertPolicyListResultPage{ + fn: getNextPage, + mdsaplr: cur, } - return json.Marshal(objectMap) } -// ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture struct { +// ManagedDatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedDatabasesUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstanceEncryptionProtectorsClient) (ManagedInstanceEncryptionProtector, error) + Result func(ManagedDatabasesClient) (ManagedDatabase, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedDatabasesUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -16185,40 +16454,93 @@ func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) Unmarshal return nil } -// result is the default implementation for ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture.Result. -func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) result(client ManagedInstanceEncryptionProtectorsClient) (miep ManagedInstanceEncryptionProtector, err error) { +// result is the default implementation for ManagedDatabasesUpdateFuture.Result. +func (future *ManagedDatabasesUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - miep.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture") + md.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miep.Response.Response, err = future.GetResult(sender); err == nil && miep.Response.Response.StatusCode != http.StatusNoContent { - miep, err = client.CreateOrUpdateResponder(miep.Response.Response) + if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { + md, err = client.UpdateResponder(md.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture", "Result", miep.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", md.Response.Response, "Failure responding to request") } } return } -// ManagedInstanceEncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstanceEncryptionProtectorsRevalidateFuture struct { +// ManagedDatabaseUpdate an managed database update. +type ManagedDatabaseUpdate struct { + // ManagedDatabaseProperties - Resource properties. + *ManagedDatabaseProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ManagedDatabaseUpdate. +func (mdu ManagedDatabaseUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mdu.ManagedDatabaseProperties != nil { + objectMap["properties"] = mdu.ManagedDatabaseProperties + } + if mdu.Tags != nil { + objectMap["tags"] = mdu.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseUpdate struct. +func (mdu *ManagedDatabaseUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedDatabaseProperties ManagedDatabaseProperties + err = json.Unmarshal(*v, &managedDatabaseProperties) + if err != nil { + return err + } + mdu.ManagedDatabaseProperties = &managedDatabaseProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mdu.Tags = tags + } + } + } + + return nil +} + +// ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstanceEncryptionProtectorsClient) (autorest.Response, error) + Result func(ManagedDatabaseVulnerabilityAssessmentScansClient) (autorest.Response, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -16228,71 +16550,36 @@ func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) UnmarshalJSON return nil } -// result is the default implementation for ManagedInstanceEncryptionProtectorsRevalidateFuture.Result. -func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) result(client ManagedInstanceEncryptionProtectorsClient) (ar autorest.Response, err error) { +// result is the default implementation for ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture.Result. +func (future *ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture) result(client ManagedDatabaseVulnerabilityAssessmentScansClient) (ar autorest.Response, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture", "Result", future.Response(), "Polling failure") return } if !done { ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsRevalidateFuture") + err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabaseVulnerabilityAssessmentScansInitiateScanFuture") return } ar.Response = future.Response() return } -// ManagedInstanceExternalAdministrator properties of a active directory administrator. -type ManagedInstanceExternalAdministrator struct { - // AdministratorType - Type of the sever administrator. Possible values include: 'AdministratorTypeActiveDirectory' - AdministratorType AdministratorType `json:"administratorType,omitempty"` - // PrincipalType - Principal Type of the sever administrator. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeApplication' - PrincipalType PrincipalType `json:"principalType,omitempty"` - // Login - Login name of the server administrator. - Login *string `json:"login,omitempty"` - // Sid - SID (object ID) of the server administrator. - Sid *uuid.UUID `json:"sid,omitempty"` - // TenantID - Tenant ID of the administrator. - TenantID *uuid.UUID `json:"tenantId,omitempty"` - // AzureADOnlyAuthentication - Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` -} - -// ManagedInstanceFamilyCapability the managed server family capability. -type ManagedInstanceFamilyCapability struct { - // Name - READ-ONLY; Family name. - Name *string `json:"name,omitempty"` - // Sku - READ-ONLY; SKU name. - Sku *string `json:"sku,omitempty"` - // SupportedLicenseTypes - READ-ONLY; List of supported license types. - SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` - // SupportedVcoresValues - READ-ONLY; List of supported virtual cores values. - SupportedVcoresValues *[]ManagedInstanceVcoresCapability `json:"supportedVcoresValues,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceFamilyCapability. -func (mifc ManagedInstanceFamilyCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mifc.Reason != nil { - objectMap["reason"] = mifc.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceKey a managed instance key. -type ManagedInstanceKey struct { +// ManagedInstance an Azure SQL managed instance. +type ManagedInstance struct { autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` - // ManagedInstanceKeyProperties - Resource properties. - *ManagedInstanceKeyProperties `json:"properties,omitempty"` + // Identity - The Azure Active Directory identity of the managed instance. + Identity *ResourceIdentity `json:"identity,omitempty"` + // Sku - Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 + Sku *Sku `json:"sku,omitempty"` + // ManagedInstanceProperties - Resource properties. + *ManagedInstanceProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -16301,17 +16588,29 @@ type ManagedInstanceKey struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceKey. -func (mik ManagedInstanceKey) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstance. +func (mi ManagedInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mik.ManagedInstanceKeyProperties != nil { - objectMap["properties"] = mik.ManagedInstanceKeyProperties + if mi.Identity != nil { + objectMap["identity"] = mi.Identity + } + if mi.Sku != nil { + objectMap["sku"] = mi.Sku + } + if mi.ManagedInstanceProperties != nil { + objectMap["properties"] = mi.ManagedInstanceProperties + } + if mi.Location != nil { + objectMap["location"] = mi.Location + } + if mi.Tags != nil { + objectMap["tags"] = mi.Tags } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceKey struct. -func (mik *ManagedInstanceKey) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedInstance struct. +func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -16319,23 +16618,50 @@ func (mik *ManagedInstanceKey) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "kind": + case "identity": if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) if err != nil { return err } - mik.Kind = &kind + mi.Identity = &identity } - case "properties": + case "sku": if v != nil { - var managedInstanceKeyProperties ManagedInstanceKeyProperties - err = json.Unmarshal(*v, &managedInstanceKeyProperties) + var sku Sku + err = json.Unmarshal(*v, &sku) if err != nil { return err } - mik.ManagedInstanceKeyProperties = &managedInstanceKeyProperties + mi.Sku = &sku + } + case "properties": + if v != nil { + var managedInstanceProperties ManagedInstanceProperties + err = json.Unmarshal(*v, &managedInstanceProperties) + if err != nil { + return err + } + mi.ManagedInstanceProperties = &managedInstanceProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mi.Tags = tags } case "id": if v != nil { @@ -16344,7 +16670,7 @@ func (mik *ManagedInstanceKey) UnmarshalJSON(body []byte) error { if err != nil { return err } - mik.ID = &ID + mi.ID = &ID } case "name": if v != nil { @@ -16353,7 +16679,7 @@ func (mik *ManagedInstanceKey) UnmarshalJSON(body []byte) error { if err != nil { return err } - mik.Name = &name + mi.Name = &name } case "type": if v != nil { @@ -16362,7 +16688,7 @@ func (mik *ManagedInstanceKey) UnmarshalJSON(body []byte) error { if err != nil { return err } - mik.Type = &typeVar + mi.Type = &typeVar } } } @@ -16370,32 +16696,106 @@ func (mik *ManagedInstanceKey) UnmarshalJSON(body []byte) error { return nil } -// ManagedInstanceKeyListResult a list of managed instance keys. -type ManagedInstanceKeyListResult struct { +// ManagedInstanceAdministrator an Azure SQL managed instance administrator. +type ManagedInstanceAdministrator struct { + autorest.Response `json:"-"` + // ManagedInstanceAdministratorProperties - Resource properties. + *ManagedInstanceAdministratorProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceAdministrator. +func (mia ManagedInstanceAdministrator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mia.ManagedInstanceAdministratorProperties != nil { + objectMap["properties"] = mia.ManagedInstanceAdministratorProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAdministrator struct. +func (mia *ManagedInstanceAdministrator) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedInstanceAdministratorProperties ManagedInstanceAdministratorProperties + err = json.Unmarshal(*v, &managedInstanceAdministratorProperties) + if err != nil { + return err + } + mia.ManagedInstanceAdministratorProperties = &managedInstanceAdministratorProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mia.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mia.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mia.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstanceAdministratorListResult a list of managed instance administrators. +type ManagedInstanceAdministratorListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceKey `json:"value,omitempty"` + Value *[]ManagedInstanceAdministrator `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceKeyListResult. -func (miklr ManagedInstanceKeyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceAdministratorListResult. +func (mialr ManagedInstanceAdministratorListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstanceKeyListResultIterator provides access to a complete listing of ManagedInstanceKey values. -type ManagedInstanceKeyListResultIterator struct { +// ManagedInstanceAdministratorListResultIterator provides access to a complete listing of +// ManagedInstanceAdministrator values. +type ManagedInstanceAdministratorListResultIterator struct { i int - page ManagedInstanceKeyListResultPage + page ManagedInstanceAdministratorListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceAdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeyListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -16420,67 +16820,67 @@ func (iter *ManagedInstanceKeyListResultIterator) NextWithContext(ctx context.Co // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceKeyListResultIterator) Next() error { +func (iter *ManagedInstanceAdministratorListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceKeyListResultIterator) NotDone() bool { +func (iter ManagedInstanceAdministratorListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceKeyListResultIterator) Response() ManagedInstanceKeyListResult { +func (iter ManagedInstanceAdministratorListResultIterator) Response() ManagedInstanceAdministratorListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceKeyListResultIterator) Value() ManagedInstanceKey { +func (iter ManagedInstanceAdministratorListResultIterator) Value() ManagedInstanceAdministrator { if !iter.page.NotDone() { - return ManagedInstanceKey{} + return ManagedInstanceAdministrator{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceKeyListResultIterator type. -func NewManagedInstanceKeyListResultIterator(page ManagedInstanceKeyListResultPage) ManagedInstanceKeyListResultIterator { - return ManagedInstanceKeyListResultIterator{page: page} +// Creates a new instance of the ManagedInstanceAdministratorListResultIterator type. +func NewManagedInstanceAdministratorListResultIterator(page ManagedInstanceAdministratorListResultPage) ManagedInstanceAdministratorListResultIterator { + return ManagedInstanceAdministratorListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (miklr ManagedInstanceKeyListResult) IsEmpty() bool { - return miklr.Value == nil || len(*miklr.Value) == 0 +func (mialr ManagedInstanceAdministratorListResult) IsEmpty() bool { + return mialr.Value == nil || len(*mialr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (miklr ManagedInstanceKeyListResult) hasNextLink() bool { - return miklr.NextLink != nil && len(*miklr.NextLink) != 0 +func (mialr ManagedInstanceAdministratorListResult) hasNextLink() bool { + return mialr.NextLink != nil && len(*mialr.NextLink) != 0 } -// managedInstanceKeyListResultPreparer prepares a request to retrieve the next set of results. +// managedInstanceAdministratorListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (miklr ManagedInstanceKeyListResult) managedInstanceKeyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miklr.hasNextLink() { +func (mialr ManagedInstanceAdministratorListResult) managedInstanceAdministratorListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mialr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(miklr.NextLink))) + autorest.WithBaseURL(to.String(mialr.NextLink))) } -// ManagedInstanceKeyListResultPage contains a page of ManagedInstanceKey values. -type ManagedInstanceKeyListResultPage struct { - fn func(context.Context, ManagedInstanceKeyListResult) (ManagedInstanceKeyListResult, error) - miklr ManagedInstanceKeyListResult +// ManagedInstanceAdministratorListResultPage contains a page of ManagedInstanceAdministrator values. +type ManagedInstanceAdministratorListResultPage struct { + fn func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error) + mialr ManagedInstanceAdministratorListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceKeyListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedInstanceAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeyListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -16490,11 +16890,11 @@ func (page *ManagedInstanceKeyListResultPage) NextWithContext(ctx context.Contex }() } for { - next, err := page.fn(ctx, page.miklr) + next, err := page.fn(ctx, page.mialr) if err != nil { return err } - page.miklr = next + page.mialr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -16505,73 +16905,59 @@ func (page *ManagedInstanceKeyListResultPage) NextWithContext(ctx context.Contex // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceKeyListResultPage) Next() error { +func (page *ManagedInstanceAdministratorListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceKeyListResultPage) NotDone() bool { - return !page.miklr.IsEmpty() +func (page ManagedInstanceAdministratorListResultPage) NotDone() bool { + return !page.mialr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstanceKeyListResultPage) Response() ManagedInstanceKeyListResult { - return page.miklr +func (page ManagedInstanceAdministratorListResultPage) Response() ManagedInstanceAdministratorListResult { + return page.mialr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceKeyListResultPage) Values() []ManagedInstanceKey { - if page.miklr.IsEmpty() { +func (page ManagedInstanceAdministratorListResultPage) Values() []ManagedInstanceAdministrator { + if page.mialr.IsEmpty() { return nil } - return *page.miklr.Value + return *page.mialr.Value } -// Creates a new instance of the ManagedInstanceKeyListResultPage type. -func NewManagedInstanceKeyListResultPage(cur ManagedInstanceKeyListResult, getNextPage func(context.Context, ManagedInstanceKeyListResult) (ManagedInstanceKeyListResult, error)) ManagedInstanceKeyListResultPage { - return ManagedInstanceKeyListResultPage{ +// Creates a new instance of the ManagedInstanceAdministratorListResultPage type. +func NewManagedInstanceAdministratorListResultPage(cur ManagedInstanceAdministratorListResult, getNextPage func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error)) ManagedInstanceAdministratorListResultPage { + return ManagedInstanceAdministratorListResultPage{ fn: getNextPage, - miklr: cur, + mialr: cur, } } -// ManagedInstanceKeyProperties properties for a key execution. -type ManagedInstanceKeyProperties struct { - // ServerKeyType - The key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServerKeyTypeServiceManaged', 'ServerKeyTypeAzureKeyVault' - ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` - // URI - The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. - URI *string `json:"uri,omitempty"` - // Thumbprint - READ-ONLY; Thumbprint of the key. - Thumbprint *string `json:"thumbprint,omitempty"` - // CreationDate - READ-ONLY; The key creation date. - CreationDate *date.Time `json:"creationDate,omitempty"` - // AutoRotationEnabled - READ-ONLY; Key auto rotation opt-in flag. Either true or false. - AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceKeyProperties. -func (mikp ManagedInstanceKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mikp.ServerKeyType != "" { - objectMap["serverKeyType"] = mikp.ServerKeyType - } - if mikp.URI != nil { - objectMap["uri"] = mikp.URI - } - return json.Marshal(objectMap) +// ManagedInstanceAdministratorProperties the properties of a managed instance administrator. +type ManagedInstanceAdministratorProperties struct { + // AdministratorType - Type of the managed instance administrator. + AdministratorType *string `json:"administratorType,omitempty"` + // Login - Login name of the managed instance administrator. + Login *string `json:"login,omitempty"` + // Sid - SID (object ID) of the managed instance administrator. + Sid *uuid.UUID `json:"sid,omitempty"` + // TenantID - Tenant ID of the managed instance administrator. + TenantID *uuid.UUID `json:"tenantId,omitempty"` } -// ManagedInstanceKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceKeysCreateOrUpdateFuture struct { +// ManagedInstanceAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedInstanceAdministratorsCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstanceKeysClient) (ManagedInstanceKey, error) + Result func(ManagedInstanceAdministratorsClient) (ManagedInstanceAdministrator, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceKeysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -16581,40 +16967,40 @@ func (future *ManagedInstanceKeysCreateOrUpdateFuture) UnmarshalJSON(body []byte return nil } -// result is the default implementation for ManagedInstanceKeysCreateOrUpdateFuture.Result. -func (future *ManagedInstanceKeysCreateOrUpdateFuture) result(client ManagedInstanceKeysClient) (mik ManagedInstanceKey, err error) { +// result is the default implementation for ManagedInstanceAdministratorsCreateOrUpdateFuture.Result. +func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) result(client ManagedInstanceAdministratorsClient) (mia ManagedInstanceAdministrator, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - mik.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceKeysCreateOrUpdateFuture") + mia.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mik.Response.Response, err = future.GetResult(sender); err == nil && mik.Response.Response.StatusCode != http.StatusNoContent { - mik, err = client.CreateOrUpdateResponder(mik.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysCreateOrUpdateFuture", "Result", mik.Response.Response, "Failure responding to request") + if mia.Response.Response, err = future.GetResult(sender); err == nil && mia.Response.Response.StatusCode != http.StatusNoContent { + mia, err = client.CreateOrUpdateResponder(mia.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", mia.Response.Response, "Failure responding to request") } } return } -// ManagedInstanceKeysDeleteFuture an abstraction for monitoring and retrieving the results of a +// ManagedInstanceAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a // long-running operation. -type ManagedInstanceKeysDeleteFuture struct { +type ManagedInstanceAdministratorsDeleteFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstanceKeysClient) (autorest.Response, error) + Result func(ManagedInstanceAdministratorsClient) (autorest.Response, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceKeysDeleteFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedInstanceAdministratorsDeleteFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -16624,49 +17010,203 @@ func (future *ManagedInstanceKeysDeleteFuture) UnmarshalJSON(body []byte) error return nil } -// result is the default implementation for ManagedInstanceKeysDeleteFuture.Result. -func (future *ManagedInstanceKeysDeleteFuture) result(client ManagedInstanceKeysClient) (ar autorest.Response, err error) { +// result is the default implementation for ManagedInstanceAdministratorsDeleteFuture.Result. +func (future *ManagedInstanceAdministratorsDeleteFuture) result(client ManagedInstanceAdministratorsClient) (ar autorest.Response, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysDeleteFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") return } if !done { ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceKeysDeleteFuture") + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsDeleteFuture") return } ar.Response = future.Response() return } -// ManagedInstanceListResult a list of managed instances. -type ManagedInstanceListResult struct { +// ManagedInstanceAzureADOnlyAuthentication azure Active Directory only authentication. +type ManagedInstanceAzureADOnlyAuthentication struct { + autorest.Response `json:"-"` + // ManagedInstanceAzureADOnlyAuthProperties - Resource properties. + *ManagedInstanceAzureADOnlyAuthProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceAzureADOnlyAuthentication. +func (miaaoa ManagedInstanceAzureADOnlyAuthentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miaaoa.ManagedInstanceAzureADOnlyAuthProperties != nil { + objectMap["properties"] = miaaoa.ManagedInstanceAzureADOnlyAuthProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAzureADOnlyAuthentication struct. +func (miaaoa *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedInstanceAzureADOnlyAuthProperties ManagedInstanceAzureADOnlyAuthProperties + err = json.Unmarshal(*v, &managedInstanceAzureADOnlyAuthProperties) + if err != nil { + return err + } + miaaoa.ManagedInstanceAzureADOnlyAuthProperties = &managedInstanceAzureADOnlyAuthProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + miaaoa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + miaaoa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + miaaoa.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstanceAzureADOnlyAuthenticationsClient) (ManagedInstanceAzureADOnlyAuthentication, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture.Result. +func (future *ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture) result(client ManagedInstanceAzureADOnlyAuthenticationsClient) (miaaoa ManagedInstanceAzureADOnlyAuthentication, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + miaaoa.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if miaaoa.Response.Response, err = future.GetResult(sender); err == nil && miaaoa.Response.Response.StatusCode != http.StatusNoContent { + miaaoa, err = client.CreateOrUpdateResponder(miaaoa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateFuture", "Result", miaaoa.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstanceAzureADOnlyAuthenticationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture.Result. +func (future *ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture) result(client ManagedInstanceAzureADOnlyAuthenticationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAzureADOnlyAuthenticationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedInstanceAzureADOnlyAuthListResult a list of active directory only authentications. +type ManagedInstanceAzureADOnlyAuthListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstance `json:"value,omitempty"` + Value *[]ManagedInstanceAzureADOnlyAuthentication `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceListResult. -func (milr ManagedInstanceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceAzureADOnlyAuthListResult. +func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstanceListResultIterator provides access to a complete listing of ManagedInstance values. -type ManagedInstanceListResultIterator struct { +// ManagedInstanceAzureADOnlyAuthListResultIterator provides access to a complete listing of +// ManagedInstanceAzureADOnlyAuthentication values. +type ManagedInstanceAzureADOnlyAuthListResultIterator struct { i int - page ManagedInstanceListResultPage + page ManagedInstanceAzureADOnlyAuthListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceAzureADOnlyAuthListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -16691,67 +17231,68 @@ func (iter *ManagedInstanceListResultIterator) NextWithContext(ctx context.Conte // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceListResultIterator) Next() error { +func (iter *ManagedInstanceAzureADOnlyAuthListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceListResultIterator) NotDone() bool { +func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceListResultIterator) Response() ManagedInstanceListResult { +func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) Response() ManagedInstanceAzureADOnlyAuthListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceListResultIterator) Value() ManagedInstance { +func (iter ManagedInstanceAzureADOnlyAuthListResultIterator) Value() ManagedInstanceAzureADOnlyAuthentication { if !iter.page.NotDone() { - return ManagedInstance{} + return ManagedInstanceAzureADOnlyAuthentication{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceListResultIterator type. -func NewManagedInstanceListResultIterator(page ManagedInstanceListResultPage) ManagedInstanceListResultIterator { - return ManagedInstanceListResultIterator{page: page} +// Creates a new instance of the ManagedInstanceAzureADOnlyAuthListResultIterator type. +func NewManagedInstanceAzureADOnlyAuthListResultIterator(page ManagedInstanceAzureADOnlyAuthListResultPage) ManagedInstanceAzureADOnlyAuthListResultIterator { + return ManagedInstanceAzureADOnlyAuthListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (milr ManagedInstanceListResult) IsEmpty() bool { - return milr.Value == nil || len(*milr.Value) == 0 +func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) IsEmpty() bool { + return miaaoalr.Value == nil || len(*miaaoalr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (milr ManagedInstanceListResult) hasNextLink() bool { - return milr.NextLink != nil && len(*milr.NextLink) != 0 +func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) hasNextLink() bool { + return miaaoalr.NextLink != nil && len(*miaaoalr.NextLink) != 0 } -// managedInstanceListResultPreparer prepares a request to retrieve the next set of results. +// managedInstanceAzureADOnlyAuthListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (milr ManagedInstanceListResult) managedInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !milr.hasNextLink() { +func (miaaoalr ManagedInstanceAzureADOnlyAuthListResult) managedInstanceAzureADOnlyAuthListResultPreparer(ctx context.Context) (*http.Request, error) { + if !miaaoalr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(milr.NextLink))) + autorest.WithBaseURL(to.String(miaaoalr.NextLink))) } -// ManagedInstanceListResultPage contains a page of ManagedInstance values. -type ManagedInstanceListResultPage struct { - fn func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error) - milr ManagedInstanceListResult +// ManagedInstanceAzureADOnlyAuthListResultPage contains a page of ManagedInstanceAzureADOnlyAuthentication +// values. +type ManagedInstanceAzureADOnlyAuthListResultPage struct { + fn func(context.Context, ManagedInstanceAzureADOnlyAuthListResult) (ManagedInstanceAzureADOnlyAuthListResult, error) + miaaoalr ManagedInstanceAzureADOnlyAuthListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedInstanceAzureADOnlyAuthListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAzureADOnlyAuthListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -16761,11 +17302,11 @@ func (page *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) }() } for { - next, err := page.fn(ctx, page.milr) + next, err := page.fn(ctx, page.miaaoalr) if err != nil { return err } - page.milr = next + page.miaaoalr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -16776,41 +17317,48 @@ func (page *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceListResultPage) Next() error { +func (page *ManagedInstanceAzureADOnlyAuthListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceListResultPage) NotDone() bool { - return !page.milr.IsEmpty() +func (page ManagedInstanceAzureADOnlyAuthListResultPage) NotDone() bool { + return !page.miaaoalr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstanceListResultPage) Response() ManagedInstanceListResult { - return page.milr +func (page ManagedInstanceAzureADOnlyAuthListResultPage) Response() ManagedInstanceAzureADOnlyAuthListResult { + return page.miaaoalr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceListResultPage) Values() []ManagedInstance { - if page.milr.IsEmpty() { +func (page ManagedInstanceAzureADOnlyAuthListResultPage) Values() []ManagedInstanceAzureADOnlyAuthentication { + if page.miaaoalr.IsEmpty() { return nil } - return *page.milr.Value + return *page.miaaoalr.Value } -// Creates a new instance of the ManagedInstanceListResultPage type. -func NewManagedInstanceListResultPage(cur ManagedInstanceListResult, getNextPage func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error)) ManagedInstanceListResultPage { - return ManagedInstanceListResultPage{ - fn: getNextPage, - milr: cur, +// Creates a new instance of the ManagedInstanceAzureADOnlyAuthListResultPage type. +func NewManagedInstanceAzureADOnlyAuthListResultPage(cur ManagedInstanceAzureADOnlyAuthListResult, getNextPage func(context.Context, ManagedInstanceAzureADOnlyAuthListResult) (ManagedInstanceAzureADOnlyAuthListResult, error)) ManagedInstanceAzureADOnlyAuthListResultPage { + return ManagedInstanceAzureADOnlyAuthListResultPage{ + fn: getNextPage, + miaaoalr: cur, } } -// ManagedInstanceLongTermRetentionBackup a long term retention backup for a managed database. -type ManagedInstanceLongTermRetentionBackup struct { +// ManagedInstanceAzureADOnlyAuthProperties properties of a active directory only authentication for +// Managed Instance. +type ManagedInstanceAzureADOnlyAuthProperties struct { + // AzureADOnlyAuthentication - Azure Active Directory only Authentication enabled. + AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` +} + +// ManagedInstanceDtc SQL Managed Instance DTC +type ManagedInstanceDtc struct { autorest.Response `json:"-"` - // ManagedInstanceLongTermRetentionBackupProperties - Resource properties. - *ManagedInstanceLongTermRetentionBackupProperties `json:"properties,omitempty"` + // ManagedInstanceDtcProperties - Resource properties. + *ManagedInstanceDtcProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -16819,17 +17367,17 @@ type ManagedInstanceLongTermRetentionBackup struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackup. -func (miltrb ManagedInstanceLongTermRetentionBackup) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceDtc. +func (mid ManagedInstanceDtc) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if miltrb.ManagedInstanceLongTermRetentionBackupProperties != nil { - objectMap["properties"] = miltrb.ManagedInstanceLongTermRetentionBackupProperties + if mid.ManagedInstanceDtcProperties != nil { + objectMap["properties"] = mid.ManagedInstanceDtcProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionBackup struct. -func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceDtc struct. +func (mid *ManagedInstanceDtc) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -16839,12 +17387,12 @@ func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) switch k { case "properties": if v != nil { - var managedInstanceLongTermRetentionBackupProperties ManagedInstanceLongTermRetentionBackupProperties - err = json.Unmarshal(*v, &managedInstanceLongTermRetentionBackupProperties) + var managedInstanceDtcProperties ManagedInstanceDtcProperties + err = json.Unmarshal(*v, &managedInstanceDtcProperties) if err != nil { return err } - miltrb.ManagedInstanceLongTermRetentionBackupProperties = &managedInstanceLongTermRetentionBackupProperties + mid.ManagedInstanceDtcProperties = &managedInstanceDtcProperties } case "id": if v != nil { @@ -16853,7 +17401,7 @@ func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) if err != nil { return err } - miltrb.ID = &ID + mid.ID = &ID } case "name": if v != nil { @@ -16862,7 +17410,7 @@ func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) if err != nil { return err } - miltrb.Name = &name + mid.Name = &name } case "type": if v != nil { @@ -16871,7 +17419,7 @@ func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) if err != nil { return err } - miltrb.Type = &typeVar + mid.Type = &typeVar } } } @@ -16879,34 +17427,32 @@ func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) return nil } -// ManagedInstanceLongTermRetentionBackupListResult a list of long term retention backups for managed -// database(s). -type ManagedInstanceLongTermRetentionBackupListResult struct { +// ManagedInstanceDtcListResult a list of managed instance's DTCs. +type ManagedInstanceDtcListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceLongTermRetentionBackup `json:"value,omitempty"` + Value *[]ManagedInstanceDtc `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackupListResult. -func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceDtcListResult. +func (midlr ManagedInstanceDtcListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstanceLongTermRetentionBackupListResultIterator provides access to a complete listing of -// ManagedInstanceLongTermRetentionBackup values. -type ManagedInstanceLongTermRetentionBackupListResultIterator struct { +// ManagedInstanceDtcListResultIterator provides access to a complete listing of ManagedInstanceDtc values. +type ManagedInstanceDtcListResultIterator struct { i int - page ManagedInstanceLongTermRetentionBackupListResultPage + page ManagedInstanceDtcListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceDtcListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceDtcListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -16931,68 +17477,67 @@ func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) NextWithCo // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) Next() error { +func (iter *ManagedInstanceDtcListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) NotDone() bool { +func (iter ManagedInstanceDtcListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) Response() ManagedInstanceLongTermRetentionBackupListResult { +func (iter ManagedInstanceDtcListResultIterator) Response() ManagedInstanceDtcListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) Value() ManagedInstanceLongTermRetentionBackup { +func (iter ManagedInstanceDtcListResultIterator) Value() ManagedInstanceDtc { if !iter.page.NotDone() { - return ManagedInstanceLongTermRetentionBackup{} + return ManagedInstanceDtc{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultIterator type. -func NewManagedInstanceLongTermRetentionBackupListResultIterator(page ManagedInstanceLongTermRetentionBackupListResultPage) ManagedInstanceLongTermRetentionBackupListResultIterator { - return ManagedInstanceLongTermRetentionBackupListResultIterator{page: page} +// Creates a new instance of the ManagedInstanceDtcListResultIterator type. +func NewManagedInstanceDtcListResultIterator(page ManagedInstanceDtcListResultPage) ManagedInstanceDtcListResultIterator { + return ManagedInstanceDtcListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) IsEmpty() bool { - return miltrblr.Value == nil || len(*miltrblr.Value) == 0 +func (midlr ManagedInstanceDtcListResult) IsEmpty() bool { + return midlr.Value == nil || len(*midlr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) hasNextLink() bool { - return miltrblr.NextLink != nil && len(*miltrblr.NextLink) != 0 +func (midlr ManagedInstanceDtcListResult) hasNextLink() bool { + return midlr.NextLink != nil && len(*midlr.NextLink) != 0 } -// managedInstanceLongTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. +// managedInstanceDtcListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) managedInstanceLongTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miltrblr.hasNextLink() { +func (midlr ManagedInstanceDtcListResult) managedInstanceDtcListResultPreparer(ctx context.Context) (*http.Request, error) { + if !midlr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(miltrblr.NextLink))) + autorest.WithBaseURL(to.String(midlr.NextLink))) } -// ManagedInstanceLongTermRetentionBackupListResultPage contains a page of -// ManagedInstanceLongTermRetentionBackup values. -type ManagedInstanceLongTermRetentionBackupListResultPage struct { - fn func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error) - miltrblr ManagedInstanceLongTermRetentionBackupListResult +// ManagedInstanceDtcListResultPage contains a page of ManagedInstanceDtc values. +type ManagedInstanceDtcListResultPage struct { + fn func(context.Context, ManagedInstanceDtcListResult) (ManagedInstanceDtcListResult, error) + midlr ManagedInstanceDtcListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceLongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedInstanceDtcListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceDtcListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -17002,11 +17547,11 @@ func (page *ManagedInstanceLongTermRetentionBackupListResultPage) NextWithContex }() } for { - next, err := page.fn(ctx, page.miltrblr) + next, err := page.fn(ctx, page.midlr) if err != nil { return err } - page.miltrblr = next + page.midlr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -17017,71 +17562,76 @@ func (page *ManagedInstanceLongTermRetentionBackupListResultPage) NextWithContex // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceLongTermRetentionBackupListResultPage) Next() error { +func (page *ManagedInstanceDtcListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceLongTermRetentionBackupListResultPage) NotDone() bool { - return !page.miltrblr.IsEmpty() +func (page ManagedInstanceDtcListResultPage) NotDone() bool { + return !page.midlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstanceLongTermRetentionBackupListResultPage) Response() ManagedInstanceLongTermRetentionBackupListResult { - return page.miltrblr +func (page ManagedInstanceDtcListResultPage) Response() ManagedInstanceDtcListResult { + return page.midlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceLongTermRetentionBackupListResultPage) Values() []ManagedInstanceLongTermRetentionBackup { - if page.miltrblr.IsEmpty() { +func (page ManagedInstanceDtcListResultPage) Values() []ManagedInstanceDtc { + if page.midlr.IsEmpty() { return nil } - return *page.miltrblr.Value + return *page.midlr.Value } -// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultPage type. -func NewManagedInstanceLongTermRetentionBackupListResultPage(cur ManagedInstanceLongTermRetentionBackupListResult, getNextPage func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error)) ManagedInstanceLongTermRetentionBackupListResultPage { - return ManagedInstanceLongTermRetentionBackupListResultPage{ - fn: getNextPage, - miltrblr: cur, +// Creates a new instance of the ManagedInstanceDtcListResultPage type. +func NewManagedInstanceDtcListResultPage(cur ManagedInstanceDtcListResult, getNextPage func(context.Context, ManagedInstanceDtcListResult) (ManagedInstanceDtcListResult, error)) ManagedInstanceDtcListResultPage { + return ManagedInstanceDtcListResultPage{ + fn: getNextPage, + midlr: cur, } } -// ManagedInstanceLongTermRetentionBackupProperties properties of a long term retention backup -type ManagedInstanceLongTermRetentionBackupProperties struct { - // ManagedInstanceName - READ-ONLY; The managed instance that the backup database belongs to. - ManagedInstanceName *string `json:"managedInstanceName,omitempty"` - // ManagedInstanceCreateTime - READ-ONLY; The create time of the instance. - ManagedInstanceCreateTime *date.Time `json:"managedInstanceCreateTime,omitempty"` - // DatabaseName - READ-ONLY; The name of the database the backup belong to - DatabaseName *string `json:"databaseName,omitempty"` - // DatabaseDeletionTime - READ-ONLY; The delete time of the database - DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` - // BackupTime - READ-ONLY; The time the backup was taken - BackupTime *date.Time `json:"backupTime,omitempty"` - // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. - BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` - // BackupStorageRedundancy - READ-ONLY; The storage redundancy type of the backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone' - BackupStorageRedundancy BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty"` +// ManagedInstanceDtcProperties the properties of managed instance DTC. +type ManagedInstanceDtcProperties struct { + // DtcEnabled - Active status of managed instance DTC. + DtcEnabled *bool `json:"dtcEnabled,omitempty"` + // SecuritySettings - Security settings of managed instance DTC. + SecuritySettings *ManagedInstanceDtcSecuritySettings `json:"securitySettings,omitempty"` + // ExternalDNSSuffixSearchList - External dns suffix search list of managed instance DTC. + ExternalDNSSuffixSearchList *[]string `json:"externalDnsSuffixSearchList,omitempty"` + // DtcHostNameDNSSuffix - READ-ONLY; Host name dns suffix of managed instance DTC. + DtcHostNameDNSSuffix *string `json:"dtcHostNameDnsSuffix,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of managed instance DTC. Possible values include: 'ProvisioningStateCreated', 'ProvisioningStateInProgress', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackupProperties. -func (miltrbp ManagedInstanceLongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceDtcProperties. +func (midp ManagedInstanceDtcProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if midp.DtcEnabled != nil { + objectMap["dtcEnabled"] = midp.DtcEnabled + } + if midp.SecuritySettings != nil { + objectMap["securitySettings"] = midp.SecuritySettings + } + if midp.ExternalDNSSuffixSearchList != nil { + objectMap["externalDnsSuffixSearchList"] = midp.ExternalDNSSuffixSearchList + } return json.Marshal(objectMap) } -// ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture struct { +// ManagedInstanceDtcsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedInstanceDtcsCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstanceLongTermRetentionPoliciesClient) (ManagedInstanceLongTermRetentionPolicy, error) + Result func(ManagedInstanceDtcsClient) (ManagedInstanceDtc, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedInstanceDtcsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -17091,34 +17641,83 @@ func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) Unma return nil } -// result is the default implementation for ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedInstanceLongTermRetentionPoliciesClient) (miltrp ManagedInstanceLongTermRetentionPolicy, err error) { +// result is the default implementation for ManagedInstanceDtcsCreateOrUpdateFuture.Result. +func (future *ManagedInstanceDtcsCreateOrUpdateFuture) result(client ManagedInstanceDtcsClient) (mid ManagedInstanceDtc, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - miltrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture") + mid.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceDtcsCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if miltrp.Response.Response, err = future.GetResult(sender); err == nil && miltrp.Response.Response.StatusCode != http.StatusNoContent { - miltrp, err = client.CreateOrUpdateResponder(miltrp.Response.Response) + if mid.Response.Response, err = future.GetResult(sender); err == nil && mid.Response.Response.StatusCode != http.StatusNoContent { + mid, err = client.CreateOrUpdateResponder(mid.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", miltrp.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceDtcsCreateOrUpdateFuture", "Result", mid.Response.Response, "Failure responding to request") } } return } -// ManagedInstanceLongTermRetentionPolicy a long term retention policy. -type ManagedInstanceLongTermRetentionPolicy struct { +// ManagedInstanceDtcSecuritySettings the Transaction Manager Communication Settings of the DTC tied to +// managed instance. +type ManagedInstanceDtcSecuritySettings struct { + // TransactionManagerCommunicationSettings - Transaction Manager communication settings of managed instance DTC. + TransactionManagerCommunicationSettings *ManagedInstanceDtcTransactionManagerCommunicationSettings `json:"transactionManagerCommunicationSettings,omitempty"` + // XaTransactionsEnabled - Allow XA Transactions to managed instance DTC. + XaTransactionsEnabled *bool `json:"xaTransactionsEnabled,omitempty"` + // SnaLu6point2TransactionsEnabled - Allow SNA LU 6.2 to managed instance DTC. + SnaLu6point2TransactionsEnabled *bool `json:"snaLu6point2TransactionsEnabled,omitempty"` +} + +// ManagedInstanceDtcTransactionManagerCommunicationSettings the Transaction Manager Communication Settings +// of the DTC tied to managed instance. +type ManagedInstanceDtcTransactionManagerCommunicationSettings struct { + // AllowInboundEnabled - Allow Inbound traffic to managed instance DTC. + AllowInboundEnabled *bool `json:"allowInboundEnabled,omitempty"` + // AllowOutboundEnabled - Allow Outbound traffic of managed instance DTC. + AllowOutboundEnabled *bool `json:"allowOutboundEnabled,omitempty"` + // Authentication - Authentication type of managed instance DTC. + Authentication *string `json:"authentication,omitempty"` +} + +// ManagedInstanceEditionCapability the managed server capability +type ManagedInstanceEditionCapability struct { + // Name - READ-ONLY; The managed server version name. + Name *string `json:"name,omitempty"` + // SupportedFamilies - READ-ONLY; The supported families. + SupportedFamilies *[]ManagedInstanceFamilyCapability `json:"supportedFamilies,omitempty"` + // SupportedStorageCapabilities - READ-ONLY; The list of supported storage capabilities for this edition + SupportedStorageCapabilities *[]StorageCapability `json:"supportedStorageCapabilities,omitempty"` + // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceEditionCapability. +func (miec ManagedInstanceEditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miec.Reason != nil { + objectMap["reason"] = miec.Reason + } + return json.Marshal(objectMap) +} + +// ManagedInstanceEncryptionProtector the managed instance encryption protector. +type ManagedInstanceEncryptionProtector struct { autorest.Response `json:"-"` - // BaseLongTermRetentionPolicyProperties - Resource properties. - *BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // ManagedInstanceEncryptionProtectorProperties - Resource properties. + *ManagedInstanceEncryptionProtectorProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -17127,17 +17726,17 @@ type ManagedInstanceLongTermRetentionPolicy struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicy. -func (miltrp ManagedInstanceLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtector. +func (miep ManagedInstanceEncryptionProtector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if miltrp.BaseLongTermRetentionPolicyProperties != nil { - objectMap["properties"] = miltrp.BaseLongTermRetentionPolicyProperties + if miep.ManagedInstanceEncryptionProtectorProperties != nil { + objectMap["properties"] = miep.ManagedInstanceEncryptionProtectorProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionPolicy struct. -func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceEncryptionProtector struct. +func (miep *ManagedInstanceEncryptionProtector) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -17145,14 +17744,23 @@ func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) } for k, v := range m { switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + miep.Kind = &kind + } case "properties": if v != nil { - var baseLongTermRetentionPolicyProperties BaseLongTermRetentionPolicyProperties - err = json.Unmarshal(*v, &baseLongTermRetentionPolicyProperties) + var managedInstanceEncryptionProtectorProperties ManagedInstanceEncryptionProtectorProperties + err = json.Unmarshal(*v, &managedInstanceEncryptionProtectorProperties) if err != nil { return err } - miltrp.BaseLongTermRetentionPolicyProperties = &baseLongTermRetentionPolicyProperties + miep.ManagedInstanceEncryptionProtectorProperties = &managedInstanceEncryptionProtectorProperties } case "id": if v != nil { @@ -17161,7 +17769,7 @@ func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) if err != nil { return err } - miltrp.ID = &ID + miep.ID = &ID } case "name": if v != nil { @@ -17170,7 +17778,7 @@ func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) if err != nil { return err } - miltrp.Name = &name + miep.Name = &name } case "type": if v != nil { @@ -17179,7 +17787,7 @@ func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) if err != nil { return err } - miltrp.Type = &typeVar + miep.Type = &typeVar } } } @@ -17187,33 +17795,33 @@ func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) return nil } -// ManagedInstanceLongTermRetentionPolicyListResult a list of long term retention policies. -type ManagedInstanceLongTermRetentionPolicyListResult struct { +// ManagedInstanceEncryptionProtectorListResult a list of managed instance encryption protectors. +type ManagedInstanceEncryptionProtectorListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceLongTermRetentionPolicy `json:"value,omitempty"` + Value *[]ManagedInstanceEncryptionProtector `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicyListResult. -func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtectorListResult. +func (mieplr ManagedInstanceEncryptionProtectorListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstanceLongTermRetentionPolicyListResultIterator provides access to a complete listing of -// ManagedInstanceLongTermRetentionPolicy values. -type ManagedInstanceLongTermRetentionPolicyListResultIterator struct { +// ManagedInstanceEncryptionProtectorListResultIterator provides access to a complete listing of +// ManagedInstanceEncryptionProtector values. +type ManagedInstanceEncryptionProtectorListResultIterator struct { i int - page ManagedInstanceLongTermRetentionPolicyListResultPage + page ManagedInstanceEncryptionProtectorListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceEncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -17238,68 +17846,68 @@ func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) NextWithCo // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) Next() error { +func (iter *ManagedInstanceEncryptionProtectorListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) NotDone() bool { +func (iter ManagedInstanceEncryptionProtectorListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) Response() ManagedInstanceLongTermRetentionPolicyListResult { +func (iter ManagedInstanceEncryptionProtectorListResultIterator) Response() ManagedInstanceEncryptionProtectorListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) Value() ManagedInstanceLongTermRetentionPolicy { +func (iter ManagedInstanceEncryptionProtectorListResultIterator) Value() ManagedInstanceEncryptionProtector { if !iter.page.NotDone() { - return ManagedInstanceLongTermRetentionPolicy{} + return ManagedInstanceEncryptionProtector{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultIterator type. -func NewManagedInstanceLongTermRetentionPolicyListResultIterator(page ManagedInstanceLongTermRetentionPolicyListResultPage) ManagedInstanceLongTermRetentionPolicyListResultIterator { - return ManagedInstanceLongTermRetentionPolicyListResultIterator{page: page} +// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultIterator type. +func NewManagedInstanceEncryptionProtectorListResultIterator(page ManagedInstanceEncryptionProtectorListResultPage) ManagedInstanceEncryptionProtectorListResultIterator { + return ManagedInstanceEncryptionProtectorListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) IsEmpty() bool { - return miltrplr.Value == nil || len(*miltrplr.Value) == 0 +func (mieplr ManagedInstanceEncryptionProtectorListResult) IsEmpty() bool { + return mieplr.Value == nil || len(*mieplr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) hasNextLink() bool { - return miltrplr.NextLink != nil && len(*miltrplr.NextLink) != 0 +func (mieplr ManagedInstanceEncryptionProtectorListResult) hasNextLink() bool { + return mieplr.NextLink != nil && len(*mieplr.NextLink) != 0 } -// managedInstanceLongTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. +// managedInstanceEncryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) managedInstanceLongTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miltrplr.hasNextLink() { +func (mieplr ManagedInstanceEncryptionProtectorListResult) managedInstanceEncryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mieplr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(miltrplr.NextLink))) -} - -// ManagedInstanceLongTermRetentionPolicyListResultPage contains a page of -// ManagedInstanceLongTermRetentionPolicy values. -type ManagedInstanceLongTermRetentionPolicyListResultPage struct { - fn func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error) - miltrplr ManagedInstanceLongTermRetentionPolicyListResult + autorest.WithBaseURL(to.String(mieplr.NextLink))) +} + +// ManagedInstanceEncryptionProtectorListResultPage contains a page of ManagedInstanceEncryptionProtector +// values. +type ManagedInstanceEncryptionProtectorListResultPage struct { + fn func(context.Context, ManagedInstanceEncryptionProtectorListResult) (ManagedInstanceEncryptionProtectorListResult, error) + mieplr ManagedInstanceEncryptionProtectorListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedInstanceEncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceEncryptionProtectorListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -17309,11 +17917,11 @@ func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) NextWithContex }() } for { - next, err := page.fn(ctx, page.miltrplr) + next, err := page.fn(ctx, page.mieplr) if err != nil { return err } - page.miltrplr = next + page.mieplr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -17324,60 +17932,193 @@ func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) NextWithContex // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) Next() error { +func (page *ManagedInstanceEncryptionProtectorListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceLongTermRetentionPolicyListResultPage) NotDone() bool { - return !page.miltrplr.IsEmpty() +func (page ManagedInstanceEncryptionProtectorListResultPage) NotDone() bool { + return !page.mieplr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Response() ManagedInstanceLongTermRetentionPolicyListResult { - return page.miltrplr +func (page ManagedInstanceEncryptionProtectorListResultPage) Response() ManagedInstanceEncryptionProtectorListResult { + return page.mieplr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Values() []ManagedInstanceLongTermRetentionPolicy { - if page.miltrplr.IsEmpty() { +func (page ManagedInstanceEncryptionProtectorListResultPage) Values() []ManagedInstanceEncryptionProtector { + if page.mieplr.IsEmpty() { return nil } - return *page.miltrplr.Value + return *page.mieplr.Value } -// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultPage type. -func NewManagedInstanceLongTermRetentionPolicyListResultPage(cur ManagedInstanceLongTermRetentionPolicyListResult, getNextPage func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error)) ManagedInstanceLongTermRetentionPolicyListResultPage { - return ManagedInstanceLongTermRetentionPolicyListResultPage{ - fn: getNextPage, - miltrplr: cur, +// Creates a new instance of the ManagedInstanceEncryptionProtectorListResultPage type. +func NewManagedInstanceEncryptionProtectorListResultPage(cur ManagedInstanceEncryptionProtectorListResult, getNextPage func(context.Context, ManagedInstanceEncryptionProtectorListResult) (ManagedInstanceEncryptionProtectorListResult, error)) ManagedInstanceEncryptionProtectorListResultPage { + return ManagedInstanceEncryptionProtectorListResultPage{ + fn: getNextPage, + mieplr: cur, } } -// ManagedInstanceMaintenanceConfigurationCapability the maintenance configuration capability -type ManagedInstanceMaintenanceConfigurationCapability struct { - // Name - READ-ONLY; Maintenance configuration name +// ManagedInstanceEncryptionProtectorProperties properties for an encryption protector execution. +type ManagedInstanceEncryptionProtectorProperties struct { + // ServerKeyName - The name of the managed instance key. + ServerKeyName *string `json:"serverKeyName,omitempty"` + // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServerKeyTypeServiceManaged', 'ServerKeyTypeAzureKeyVault' + ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` + // URI - READ-ONLY; The URI of the server key. + URI *string `json:"uri,omitempty"` + // Thumbprint - READ-ONLY; Thumbprint of the server key. + Thumbprint *string `json:"thumbprint,omitempty"` + // AutoRotationEnabled - Key auto rotation opt-in flag. Either true or false. + AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceEncryptionProtectorProperties. +func (miepp ManagedInstanceEncryptionProtectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miepp.ServerKeyName != nil { + objectMap["serverKeyName"] = miepp.ServerKeyName + } + if miepp.ServerKeyType != "" { + objectMap["serverKeyType"] = miepp.ServerKeyType + } + if miepp.AutoRotationEnabled != nil { + objectMap["autoRotationEnabled"] = miepp.AutoRotationEnabled + } + return json.Marshal(objectMap) +} + +// ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstanceEncryptionProtectorsClient) (ManagedInstanceEncryptionProtector, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture.Result. +func (future *ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture) result(client ManagedInstanceEncryptionProtectorsClient) (miep ManagedInstanceEncryptionProtector, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + miep.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if miep.Response.Response, err = future.GetResult(sender); err == nil && miep.Response.Response.StatusCode != http.StatusNoContent { + miep, err = client.CreateOrUpdateResponder(miep.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsCreateOrUpdateFuture", "Result", miep.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedInstanceEncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedInstanceEncryptionProtectorsRevalidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstanceEncryptionProtectorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstanceEncryptionProtectorsRevalidateFuture.Result. +func (future *ManagedInstanceEncryptionProtectorsRevalidateFuture) result(client ManagedInstanceEncryptionProtectorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceEncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceEncryptionProtectorsRevalidateFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedInstanceExternalAdministrator properties of a active directory administrator. +type ManagedInstanceExternalAdministrator struct { + // AdministratorType - Type of the sever administrator. Possible values include: 'AdministratorTypeActiveDirectory' + AdministratorType AdministratorType `json:"administratorType,omitempty"` + // PrincipalType - Principal Type of the sever administrator. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeApplication' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // Login - Login name of the server administrator. + Login *string `json:"login,omitempty"` + // Sid - SID (object ID) of the server administrator. + Sid *uuid.UUID `json:"sid,omitempty"` + // TenantID - Tenant ID of the administrator. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // AzureADOnlyAuthentication - Azure Active Directory only Authentication enabled. + AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` +} + +// ManagedInstanceFamilyCapability the managed server family capability. +type ManagedInstanceFamilyCapability struct { + // Name - READ-ONLY; Family name. Name *string `json:"name,omitempty"` + // Sku - READ-ONLY; SKU name. + Sku *string `json:"sku,omitempty"` + // SupportedLicenseTypes - READ-ONLY; List of supported license types. + SupportedLicenseTypes *[]LicenseTypeCapability `json:"supportedLicenseTypes,omitempty"` + // SupportedVcoresValues - READ-ONLY; List of supported virtual cores values. + SupportedVcoresValues *[]ManagedInstanceVcoresCapability `json:"supportedVcoresValues,omitempty"` // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' Status CapabilityStatus `json:"status,omitempty"` // Reason - The reason for the capability not being available. Reason *string `json:"reason,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceMaintenanceConfigurationCapability. -func (mimcc ManagedInstanceMaintenanceConfigurationCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceFamilyCapability. +func (mifc ManagedInstanceFamilyCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mimcc.Reason != nil { - objectMap["reason"] = mimcc.Reason + if mifc.Reason != nil { + objectMap["reason"] = mifc.Reason } return json.Marshal(objectMap) } -// ManagedInstanceOperation a managed instance operation. -type ManagedInstanceOperation struct { +// ManagedInstanceKey a managed instance key. +type ManagedInstanceKey struct { autorest.Response `json:"-"` - // ManagedInstanceOperationProperties - Resource properties. - *ManagedInstanceOperationProperties `json:"properties,omitempty"` + // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // ManagedInstanceKeyProperties - Resource properties. + *ManagedInstanceKeyProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -17386,17 +18127,17 @@ type ManagedInstanceOperation struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceOperation. -func (mio ManagedInstanceOperation) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceKey. +func (mik ManagedInstanceKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mio.ManagedInstanceOperationProperties != nil { - objectMap["properties"] = mio.ManagedInstanceOperationProperties + if mik.ManagedInstanceKeyProperties != nil { + objectMap["properties"] = mik.ManagedInstanceKeyProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceOperation struct. -func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceKey struct. +func (mik *ManagedInstanceKey) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -17404,14 +18145,23 @@ func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mik.Kind = &kind + } case "properties": if v != nil { - var managedInstanceOperationProperties ManagedInstanceOperationProperties - err = json.Unmarshal(*v, &managedInstanceOperationProperties) + var managedInstanceKeyProperties ManagedInstanceKeyProperties + err = json.Unmarshal(*v, &managedInstanceKeyProperties) if err != nil { return err } - mio.ManagedInstanceOperationProperties = &managedInstanceOperationProperties + mik.ManagedInstanceKeyProperties = &managedInstanceKeyProperties } case "id": if v != nil { @@ -17420,7 +18170,7 @@ func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error { if err != nil { return err } - mio.ID = &ID + mik.ID = &ID } case "name": if v != nil { @@ -17429,7 +18179,7 @@ func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error { if err != nil { return err } - mio.Name = &name + mik.Name = &name } case "type": if v != nil { @@ -17438,7 +18188,7 @@ func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error { if err != nil { return err } - mio.Type = &typeVar + mik.Type = &typeVar } } } @@ -17446,33 +18196,32 @@ func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error { return nil } -// ManagedInstanceOperationListResult the response to a list managed instance operations request -type ManagedInstanceOperationListResult struct { +// ManagedInstanceKeyListResult a list of managed instance keys. +type ManagedInstanceKeyListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceOperation `json:"value,omitempty"` + Value *[]ManagedInstanceKey `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceOperationListResult. -func (miolr ManagedInstanceOperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceKeyListResult. +func (miklr ManagedInstanceKeyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstanceOperationListResultIterator provides access to a complete listing of -// ManagedInstanceOperation values. -type ManagedInstanceOperationListResultIterator struct { +// ManagedInstanceKeyListResultIterator provides access to a complete listing of ManagedInstanceKey values. +type ManagedInstanceKeyListResultIterator struct { i int - page ManagedInstanceOperationListResultPage + page ManagedInstanceKeyListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeyListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -17497,67 +18246,67 @@ func (iter *ManagedInstanceOperationListResultIterator) NextWithContext(ctx cont // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceOperationListResultIterator) Next() error { +func (iter *ManagedInstanceKeyListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceOperationListResultIterator) NotDone() bool { +func (iter ManagedInstanceKeyListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceOperationListResultIterator) Response() ManagedInstanceOperationListResult { +func (iter ManagedInstanceKeyListResultIterator) Response() ManagedInstanceKeyListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceOperationListResultIterator) Value() ManagedInstanceOperation { +func (iter ManagedInstanceKeyListResultIterator) Value() ManagedInstanceKey { if !iter.page.NotDone() { - return ManagedInstanceOperation{} + return ManagedInstanceKey{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceOperationListResultIterator type. -func NewManagedInstanceOperationListResultIterator(page ManagedInstanceOperationListResultPage) ManagedInstanceOperationListResultIterator { - return ManagedInstanceOperationListResultIterator{page: page} +// Creates a new instance of the ManagedInstanceKeyListResultIterator type. +func NewManagedInstanceKeyListResultIterator(page ManagedInstanceKeyListResultPage) ManagedInstanceKeyListResultIterator { + return ManagedInstanceKeyListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (miolr ManagedInstanceOperationListResult) IsEmpty() bool { - return miolr.Value == nil || len(*miolr.Value) == 0 +func (miklr ManagedInstanceKeyListResult) IsEmpty() bool { + return miklr.Value == nil || len(*miklr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (miolr ManagedInstanceOperationListResult) hasNextLink() bool { - return miolr.NextLink != nil && len(*miolr.NextLink) != 0 +func (miklr ManagedInstanceKeyListResult) hasNextLink() bool { + return miklr.NextLink != nil && len(*miklr.NextLink) != 0 } -// managedInstanceOperationListResultPreparer prepares a request to retrieve the next set of results. +// managedInstanceKeyListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (miolr ManagedInstanceOperationListResult) managedInstanceOperationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !miolr.hasNextLink() { +func (miklr ManagedInstanceKeyListResult) managedInstanceKeyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !miklr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(miolr.NextLink))) + autorest.WithBaseURL(to.String(miklr.NextLink))) } -// ManagedInstanceOperationListResultPage contains a page of ManagedInstanceOperation values. -type ManagedInstanceOperationListResultPage struct { - fn func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error) - miolr ManagedInstanceOperationListResult +// ManagedInstanceKeyListResultPage contains a page of ManagedInstanceKey values. +type ManagedInstanceKeyListResultPage struct { + fn func(context.Context, ManagedInstanceKeyListResult) (ManagedInstanceKeyListResult, error) + miklr ManagedInstanceKeyListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceOperationListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedInstanceKeyListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceKeyListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -17567,11 +18316,11 @@ func (page *ManagedInstanceOperationListResultPage) NextWithContext(ctx context. }() } for { - next, err := page.fn(ctx, page.miolr) + next, err := page.fn(ctx, page.miklr) if err != nil { return err } - page.miolr = next + page.miklr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -17582,228 +18331,168 @@ func (page *ManagedInstanceOperationListResultPage) NextWithContext(ctx context. // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceOperationListResultPage) Next() error { +func (page *ManagedInstanceKeyListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceOperationListResultPage) NotDone() bool { - return !page.miolr.IsEmpty() +func (page ManagedInstanceKeyListResultPage) NotDone() bool { + return !page.miklr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstanceOperationListResultPage) Response() ManagedInstanceOperationListResult { - return page.miolr +func (page ManagedInstanceKeyListResultPage) Response() ManagedInstanceKeyListResult { + return page.miklr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceOperationListResultPage) Values() []ManagedInstanceOperation { - if page.miolr.IsEmpty() { +func (page ManagedInstanceKeyListResultPage) Values() []ManagedInstanceKey { + if page.miklr.IsEmpty() { return nil } - return *page.miolr.Value + return *page.miklr.Value } -// Creates a new instance of the ManagedInstanceOperationListResultPage type. -func NewManagedInstanceOperationListResultPage(cur ManagedInstanceOperationListResult, getNextPage func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error)) ManagedInstanceOperationListResultPage { - return ManagedInstanceOperationListResultPage{ +// Creates a new instance of the ManagedInstanceKeyListResultPage type. +func NewManagedInstanceKeyListResultPage(cur ManagedInstanceKeyListResult, getNextPage func(context.Context, ManagedInstanceKeyListResult) (ManagedInstanceKeyListResult, error)) ManagedInstanceKeyListResultPage { + return ManagedInstanceKeyListResultPage{ fn: getNextPage, - miolr: cur, + miklr: cur, } } -// ManagedInstanceOperationParametersPair the parameters of a managed instance operation. -type ManagedInstanceOperationParametersPair struct { - // CurrentParameters - READ-ONLY; The current parameters. - CurrentParameters *UpsertManagedServerOperationParameters `json:"currentParameters,omitempty"` - // RequestedParameters - READ-ONLY; The requested parameters. - RequestedParameters *UpsertManagedServerOperationParameters `json:"requestedParameters,omitempty"` +// ManagedInstanceKeyProperties properties for a key execution. +type ManagedInstanceKeyProperties struct { + // ServerKeyType - The key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServerKeyTypeServiceManaged', 'ServerKeyTypeAzureKeyVault' + ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` + // URI - The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + URI *string `json:"uri,omitempty"` + // Thumbprint - READ-ONLY; Thumbprint of the key. + Thumbprint *string `json:"thumbprint,omitempty"` + // CreationDate - READ-ONLY; The key creation date. + CreationDate *date.Time `json:"creationDate,omitempty"` + // AutoRotationEnabled - READ-ONLY; Key auto rotation opt-in flag. Either true or false. + AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceOperationParametersPair. -func (miopp ManagedInstanceOperationParametersPair) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceKeyProperties. +func (mikp ManagedInstanceKeyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if mikp.ServerKeyType != "" { + objectMap["serverKeyType"] = mikp.ServerKeyType + } + if mikp.URI != nil { + objectMap["uri"] = mikp.URI + } return json.Marshal(objectMap) } -// ManagedInstanceOperationProperties the properties of a managed instance operation. -type ManagedInstanceOperationProperties struct { - // ManagedInstanceName - READ-ONLY; The name of the managed instance the operation is being performed on. - ManagedInstanceName *string `json:"managedInstanceName,omitempty"` - // Operation - READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty"` - // OperationFriendlyName - READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` - // PercentComplete - READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty"` - // StartTime - READ-ONLY; The operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // State - READ-ONLY; The operation state. Possible values include: 'ManagementOperationStatePending', 'ManagementOperationStateInProgress', 'ManagementOperationStateSucceeded', 'ManagementOperationStateFailed', 'ManagementOperationStateCancelInProgress', 'ManagementOperationStateCancelled' - State ManagementOperationState `json:"state,omitempty"` - // ErrorCode - READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty"` - // ErrorDescription - READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty"` - // ErrorSeverity - READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - // IsUserError - READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty"` - // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` - // Description - READ-ONLY; The operation description. - Description *string `json:"description,omitempty"` - // IsCancellable - READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty"` - // OperationParameters - READ-ONLY; The operation parameters. - OperationParameters *ManagedInstanceOperationParametersPair `json:"operationParameters,omitempty"` - // OperationSteps - READ-ONLY; The operation steps. - OperationSteps *ManagedInstanceOperationSteps `json:"operationSteps,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceOperationProperties. -func (miop ManagedInstanceOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) +// ManagedInstanceKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedInstanceKeysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstanceKeysClient) (ManagedInstanceKey, error) } -// ManagedInstanceOperationSteps the steps of a managed instance operation. -type ManagedInstanceOperationSteps struct { - // TotalSteps - READ-ONLY; The total number of operation steps. - TotalSteps *string `json:"totalSteps,omitempty"` - // CurrentStep - READ-ONLY; The number of current operation steps. - CurrentStep *int32 `json:"currentStep,omitempty"` - // StepsList - READ-ONLY; The operation steps list. - StepsList *[]UpsertManagedServerOperationStep `json:"stepsList,omitempty"` +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstanceKeysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// MarshalJSON is the custom marshaler for ManagedInstanceOperationSteps. -func (mios ManagedInstanceOperationSteps) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) +// result is the default implementation for ManagedInstanceKeysCreateOrUpdateFuture.Result. +func (future *ManagedInstanceKeysCreateOrUpdateFuture) result(client ManagedInstanceKeysClient) (mik ManagedInstanceKey, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mik.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceKeysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mik.Response.Response, err = future.GetResult(sender); err == nil && mik.Response.Response.StatusCode != http.StatusNoContent { + mik, err = client.CreateOrUpdateResponder(mik.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysCreateOrUpdateFuture", "Result", mik.Response.Response, "Failure responding to request") + } + } + return } -// ManagedInstancePairInfo pairs of Managed Instances in the failover group. -type ManagedInstancePairInfo struct { - // PrimaryManagedInstanceID - Id of Primary Managed Instance in pair. - PrimaryManagedInstanceID *string `json:"primaryManagedInstanceId,omitempty"` - // PartnerManagedInstanceID - Id of Partner Managed Instance in pair. - PartnerManagedInstanceID *string `json:"partnerManagedInstanceId,omitempty"` +// ManagedInstanceKeysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedInstanceKeysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstanceKeysClient) (autorest.Response, error) } -// ManagedInstancePecProperty a private endpoint connection under a managed instance -type ManagedInstancePecProperty struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Properties - READ-ONLY; Private endpoint connection properties - Properties *ManagedInstancePrivateEndpointConnectionProperties `json:"properties,omitempty"` +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstanceKeysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// MarshalJSON is the custom marshaler for ManagedInstancePecProperty. -func (mipp ManagedInstancePecProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) +// result is the default implementation for ManagedInstanceKeysDeleteFuture.Result. +func (future *ManagedInstanceKeysDeleteFuture) result(client ManagedInstanceKeysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceKeysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceKeysDeleteFuture") + return + } + ar.Response = future.Response() + return } -// ManagedInstancePrivateEndpointConnection a private endpoint connection -type ManagedInstancePrivateEndpointConnection struct { +// ManagedInstanceListResult a list of managed instances. +type ManagedInstanceListResult struct { autorest.Response `json:"-"` - // ManagedInstancePrivateEndpointConnectionProperties - Resource properties. - *ManagedInstancePrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` + // Value - READ-ONLY; Array of results. + Value *[]ManagedInstance `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstancePrivateEndpointConnection. -func (mipec ManagedInstancePrivateEndpointConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceListResult. +func (milr ManagedInstanceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mipec.ManagedInstancePrivateEndpointConnectionProperties != nil { - objectMap["properties"] = mipec.ManagedInstancePrivateEndpointConnectionProperties - } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstancePrivateEndpointConnection struct. -func (mipec *ManagedInstancePrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedInstancePrivateEndpointConnectionProperties ManagedInstancePrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &managedInstancePrivateEndpointConnectionProperties) - if err != nil { - return err - } - mipec.ManagedInstancePrivateEndpointConnectionProperties = &managedInstancePrivateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mipec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mipec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mipec.Type = &typeVar - } - } - } - - return nil -} - -// ManagedInstancePrivateEndpointConnectionListResult a list of private endpoint connections. -type ManagedInstancePrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ManagedInstancePrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstancePrivateEndpointConnectionListResult. -func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstancePrivateEndpointConnectionListResultIterator provides access to a complete listing of -// ManagedInstancePrivateEndpointConnection values. -type ManagedInstancePrivateEndpointConnectionListResultIterator struct { +// ManagedInstanceListResultIterator provides access to a complete listing of ManagedInstance values. +type ManagedInstanceListResultIterator struct { i int - page ManagedInstancePrivateEndpointConnectionListResultPage + page ManagedInstanceListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstancePrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancePrivateEndpointConnectionListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -17828,68 +18517,67 @@ func (iter *ManagedInstancePrivateEndpointConnectionListResultIterator) NextWith // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstancePrivateEndpointConnectionListResultIterator) Next() error { +func (iter *ManagedInstanceListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstancePrivateEndpointConnectionListResultIterator) NotDone() bool { +func (iter ManagedInstanceListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstancePrivateEndpointConnectionListResultIterator) Response() ManagedInstancePrivateEndpointConnectionListResult { +func (iter ManagedInstanceListResultIterator) Response() ManagedInstanceListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstancePrivateEndpointConnectionListResultIterator) Value() ManagedInstancePrivateEndpointConnection { +func (iter ManagedInstanceListResultIterator) Value() ManagedInstance { if !iter.page.NotDone() { - return ManagedInstancePrivateEndpointConnection{} + return ManagedInstance{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstancePrivateEndpointConnectionListResultIterator type. -func NewManagedInstancePrivateEndpointConnectionListResultIterator(page ManagedInstancePrivateEndpointConnectionListResultPage) ManagedInstancePrivateEndpointConnectionListResultIterator { - return ManagedInstancePrivateEndpointConnectionListResultIterator{page: page} +// Creates a new instance of the ManagedInstanceListResultIterator type. +func NewManagedInstanceListResultIterator(page ManagedInstanceListResultPage) ManagedInstanceListResultIterator { + return ManagedInstanceListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) IsEmpty() bool { - return mipeclr.Value == nil || len(*mipeclr.Value) == 0 +func (milr ManagedInstanceListResult) IsEmpty() bool { + return milr.Value == nil || len(*milr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) hasNextLink() bool { - return mipeclr.NextLink != nil && len(*mipeclr.NextLink) != 0 +func (milr ManagedInstanceListResult) hasNextLink() bool { + return milr.NextLink != nil && len(*milr.NextLink) != 0 } -// managedInstancePrivateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// managedInstanceListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) managedInstancePrivateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mipeclr.hasNextLink() { +func (milr ManagedInstanceListResult) managedInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !milr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(mipeclr.NextLink))) + autorest.WithBaseURL(to.String(milr.NextLink))) } -// ManagedInstancePrivateEndpointConnectionListResultPage contains a page of -// ManagedInstancePrivateEndpointConnection values. -type ManagedInstancePrivateEndpointConnectionListResultPage struct { - fn func(context.Context, ManagedInstancePrivateEndpointConnectionListResult) (ManagedInstancePrivateEndpointConnectionListResult, error) - mipeclr ManagedInstancePrivateEndpointConnectionListResult +// ManagedInstanceListResultPage contains a page of ManagedInstance values. +type ManagedInstanceListResultPage struct { + fn func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error) + milr ManagedInstanceListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstancePrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancePrivateEndpointConnectionListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -17899,11 +18587,11 @@ func (page *ManagedInstancePrivateEndpointConnectionListResultPage) NextWithCont }() } for { - next, err := page.fn(ctx, page.mipeclr) + next, err := page.fn(ctx, page.milr) if err != nil { return err } - page.mipeclr = next + page.milr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -17914,190 +18602,137 @@ func (page *ManagedInstancePrivateEndpointConnectionListResultPage) NextWithCont // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstancePrivateEndpointConnectionListResultPage) Next() error { +func (page *ManagedInstanceListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstancePrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.mipeclr.IsEmpty() +func (page ManagedInstanceListResultPage) NotDone() bool { + return !page.milr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstancePrivateEndpointConnectionListResultPage) Response() ManagedInstancePrivateEndpointConnectionListResult { - return page.mipeclr +func (page ManagedInstanceListResultPage) Response() ManagedInstanceListResult { + return page.milr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstancePrivateEndpointConnectionListResultPage) Values() []ManagedInstancePrivateEndpointConnection { - if page.mipeclr.IsEmpty() { +func (page ManagedInstanceListResultPage) Values() []ManagedInstance { + if page.milr.IsEmpty() { return nil } - return *page.mipeclr.Value + return *page.milr.Value } -// Creates a new instance of the ManagedInstancePrivateEndpointConnectionListResultPage type. -func NewManagedInstancePrivateEndpointConnectionListResultPage(cur ManagedInstancePrivateEndpointConnectionListResult, getNextPage func(context.Context, ManagedInstancePrivateEndpointConnectionListResult) (ManagedInstancePrivateEndpointConnectionListResult, error)) ManagedInstancePrivateEndpointConnectionListResultPage { - return ManagedInstancePrivateEndpointConnectionListResultPage{ - fn: getNextPage, - mipeclr: cur, +// Creates a new instance of the ManagedInstanceListResultPage type. +func NewManagedInstanceListResultPage(cur ManagedInstanceListResult, getNextPage func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error)) ManagedInstanceListResultPage { + return ManagedInstanceListResultPage{ + fn: getNextPage, + milr: cur, } } -// ManagedInstancePrivateEndpointConnectionProperties properties of a private endpoint connection. -type ManagedInstancePrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *ManagedInstancePrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *ManagedInstancePrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the Private Endpoint Connection. - ProvisioningState *string `json:"provisioningState,omitempty"` +// ManagedInstanceLongTermRetentionBackup a long term retention backup for a managed database. +type ManagedInstanceLongTermRetentionBackup struct { + autorest.Response `json:"-"` + // ManagedInstanceLongTermRetentionBackupProperties - Resource properties. + *ManagedInstanceLongTermRetentionBackupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstancePrivateEndpointConnectionProperties. -func (mipecp ManagedInstancePrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackup. +func (miltrb ManagedInstanceLongTermRetentionBackup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if mipecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = mipecp.PrivateEndpoint - } - if mipecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = mipecp.PrivateLinkServiceConnectionState + if miltrb.ManagedInstanceLongTermRetentionBackupProperties != nil { + objectMap["properties"] = miltrb.ManagedInstanceLongTermRetentionBackupProperties } return json.Marshal(objectMap) } -// ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and -// retrieving the results of a long-running operation. -type ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancePrivateEndpointConnectionsClient) (ManagedInstancePrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionBackup struct. +func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { return err } - future.FutureAPI = &azFuture - future.Result = future.result + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedInstanceLongTermRetentionBackupProperties ManagedInstanceLongTermRetentionBackupProperties + err = json.Unmarshal(*v, &managedInstanceLongTermRetentionBackupProperties) + if err != nil { + return err + } + miltrb.ManagedInstanceLongTermRetentionBackupProperties = &managedInstanceLongTermRetentionBackupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + miltrb.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + miltrb.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + miltrb.Type = &typeVar + } + } + } + return nil } -// result is the default implementation for ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture) result(client ManagedInstancePrivateEndpointConnectionsClient) (mipec ManagedInstancePrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mipec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mipec.Response.Response, err = future.GetResult(sender); err == nil && mipec.Response.Response.StatusCode != http.StatusNoContent { - mipec, err = client.CreateOrUpdateResponder(mipec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture", "Result", mipec.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstancePrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedInstancePrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancePrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancePrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedInstancePrivateEndpointConnectionsDeleteFuture.Result. -func (future *ManagedInstancePrivateEndpointConnectionsDeleteFuture) result(client ManagedInstancePrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancePrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancePrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedInstancePrivateEndpointProperty ... -type ManagedInstancePrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// ManagedInstancePrivateLink a private link resource -type ManagedInstancePrivateLink struct { - autorest.Response `json:"-"` - // Properties - READ-ONLY; The private link resource group id. - Properties *ManagedInstancePrivateLinkProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstancePrivateLink. -func (mipl ManagedInstancePrivateLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedInstancePrivateLinkListResult a list of private link resources -type ManagedInstancePrivateLinkListResult struct { +// ManagedInstanceLongTermRetentionBackupListResult a list of long term retention backups for managed +// database(s). +type ManagedInstanceLongTermRetentionBackupListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstancePrivateLink `json:"value,omitempty"` + Value *[]ManagedInstanceLongTermRetentionBackup `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstancePrivateLinkListResult. -func (mipllr ManagedInstancePrivateLinkListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackupListResult. +func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstancePrivateLinkListResultIterator provides access to a complete listing of -// ManagedInstancePrivateLink values. -type ManagedInstancePrivateLinkListResultIterator struct { +// ManagedInstanceLongTermRetentionBackupListResultIterator provides access to a complete listing of +// ManagedInstanceLongTermRetentionBackup values. +type ManagedInstanceLongTermRetentionBackupListResultIterator struct { i int - page ManagedInstancePrivateLinkListResultPage + page ManagedInstanceLongTermRetentionBackupListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstancePrivateLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancePrivateLinkListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -18122,67 +18757,68 @@ func (iter *ManagedInstancePrivateLinkListResultIterator) NextWithContext(ctx co // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstancePrivateLinkListResultIterator) Next() error { +func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstancePrivateLinkListResultIterator) NotDone() bool { +func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstancePrivateLinkListResultIterator) Response() ManagedInstancePrivateLinkListResult { +func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) Response() ManagedInstanceLongTermRetentionBackupListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstancePrivateLinkListResultIterator) Value() ManagedInstancePrivateLink { +func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) Value() ManagedInstanceLongTermRetentionBackup { if !iter.page.NotDone() { - return ManagedInstancePrivateLink{} + return ManagedInstanceLongTermRetentionBackup{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstancePrivateLinkListResultIterator type. -func NewManagedInstancePrivateLinkListResultIterator(page ManagedInstancePrivateLinkListResultPage) ManagedInstancePrivateLinkListResultIterator { - return ManagedInstancePrivateLinkListResultIterator{page: page} +// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultIterator type. +func NewManagedInstanceLongTermRetentionBackupListResultIterator(page ManagedInstanceLongTermRetentionBackupListResultPage) ManagedInstanceLongTermRetentionBackupListResultIterator { + return ManagedInstanceLongTermRetentionBackupListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (mipllr ManagedInstancePrivateLinkListResult) IsEmpty() bool { - return mipllr.Value == nil || len(*mipllr.Value) == 0 +func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) IsEmpty() bool { + return miltrblr.Value == nil || len(*miltrblr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (mipllr ManagedInstancePrivateLinkListResult) hasNextLink() bool { - return mipllr.NextLink != nil && len(*mipllr.NextLink) != 0 +func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) hasNextLink() bool { + return miltrblr.NextLink != nil && len(*miltrblr.NextLink) != 0 } -// managedInstancePrivateLinkListResultPreparer prepares a request to retrieve the next set of results. +// managedInstanceLongTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (mipllr ManagedInstancePrivateLinkListResult) managedInstancePrivateLinkListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mipllr.hasNextLink() { +func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) managedInstanceLongTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !miltrblr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(mipllr.NextLink))) + autorest.WithBaseURL(to.String(miltrblr.NextLink))) } -// ManagedInstancePrivateLinkListResultPage contains a page of ManagedInstancePrivateLink values. -type ManagedInstancePrivateLinkListResultPage struct { - fn func(context.Context, ManagedInstancePrivateLinkListResult) (ManagedInstancePrivateLinkListResult, error) - mipllr ManagedInstancePrivateLinkListResult +// ManagedInstanceLongTermRetentionBackupListResultPage contains a page of +// ManagedInstanceLongTermRetentionBackup values. +type ManagedInstanceLongTermRetentionBackupListResultPage struct { + fn func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error) + miltrblr ManagedInstanceLongTermRetentionBackupListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstancePrivateLinkListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedInstanceLongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancePrivateLinkListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -18192,11 +18828,11 @@ func (page *ManagedInstancePrivateLinkListResultPage) NextWithContext(ctx contex }() } for { - next, err := page.fn(ctx, page.mipllr) + next, err := page.fn(ctx, page.miltrblr) if err != nil { return err } - page.mipllr = next + page.miltrblr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -18207,86 +18843,1276 @@ func (page *ManagedInstancePrivateLinkListResultPage) NextWithContext(ctx contex // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstancePrivateLinkListResultPage) Next() error { +func (page *ManagedInstanceLongTermRetentionBackupListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstancePrivateLinkListResultPage) NotDone() bool { - return !page.mipllr.IsEmpty() +func (page ManagedInstanceLongTermRetentionBackupListResultPage) NotDone() bool { + return !page.miltrblr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstancePrivateLinkListResultPage) Response() ManagedInstancePrivateLinkListResult { - return page.mipllr +func (page ManagedInstanceLongTermRetentionBackupListResultPage) Response() ManagedInstanceLongTermRetentionBackupListResult { + return page.miltrblr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstancePrivateLinkListResultPage) Values() []ManagedInstancePrivateLink { - if page.mipllr.IsEmpty() { +func (page ManagedInstanceLongTermRetentionBackupListResultPage) Values() []ManagedInstanceLongTermRetentionBackup { + if page.miltrblr.IsEmpty() { return nil } - return *page.mipllr.Value + return *page.miltrblr.Value } -// Creates a new instance of the ManagedInstancePrivateLinkListResultPage type. -func NewManagedInstancePrivateLinkListResultPage(cur ManagedInstancePrivateLinkListResult, getNextPage func(context.Context, ManagedInstancePrivateLinkListResult) (ManagedInstancePrivateLinkListResult, error)) ManagedInstancePrivateLinkListResultPage { - return ManagedInstancePrivateLinkListResultPage{ - fn: getNextPage, - mipllr: cur, +// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultPage type. +func NewManagedInstanceLongTermRetentionBackupListResultPage(cur ManagedInstanceLongTermRetentionBackupListResult, getNextPage func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error)) ManagedInstanceLongTermRetentionBackupListResultPage { + return ManagedInstanceLongTermRetentionBackupListResultPage{ + fn: getNextPage, + miltrblr: cur, } } -// ManagedInstancePrivateLinkProperties properties of a private link resource. -type ManagedInstancePrivateLinkProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` +// ManagedInstanceLongTermRetentionBackupProperties properties of a long term retention backup +type ManagedInstanceLongTermRetentionBackupProperties struct { + // ManagedInstanceName - READ-ONLY; The managed instance that the backup database belongs to. + ManagedInstanceName *string `json:"managedInstanceName,omitempty"` + // ManagedInstanceCreateTime - READ-ONLY; The create time of the instance. + ManagedInstanceCreateTime *date.Time `json:"managedInstanceCreateTime,omitempty"` + // DatabaseName - READ-ONLY; The name of the database the backup belong to + DatabaseName *string `json:"databaseName,omitempty"` + // DatabaseDeletionTime - READ-ONLY; The delete time of the database + DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` + // BackupTime - READ-ONLY; The time the backup was taken + BackupTime *date.Time `json:"backupTime,omitempty"` + // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. + BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` + // BackupStorageRedundancy - READ-ONLY; The storage redundancy type of the backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + BackupStorageRedundancy BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstancePrivateLinkProperties. -func (miplp ManagedInstancePrivateLinkProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackupProperties. +func (miltrbp ManagedInstanceLongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstancePrivateLinkServiceConnectionStateProperty ... -type ManagedInstancePrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The private link service connection description. - ActionsRequired *string `json:"actionsRequired,omitempty"` +// ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstanceLongTermRetentionPoliciesClient) (ManagedInstanceLongTermRetentionPolicy, error) } -// MarshalJSON is the custom marshaler for ManagedInstancePrivateLinkServiceConnectionStateProperty. -func (miplscsp ManagedInstancePrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miplscsp.Status != nil { - objectMap["status"] = miplscsp.Status +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - if miplscsp.Description != nil { - objectMap["description"] = miplscsp.Description + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture.Result. +func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedInstanceLongTermRetentionPoliciesClient) (miltrp ManagedInstanceLongTermRetentionPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return } - return json.Marshal(objectMap) + if !done { + miltrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if miltrp.Response.Response, err = future.GetResult(sender); err == nil && miltrp.Response.Response.StatusCode != http.StatusNoContent { + miltrp, err = client.CreateOrUpdateResponder(miltrp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", miltrp.Response.Response, "Failure responding to request") + } + } + return } -// ManagedInstanceProperties the properties of a managed instance. -type ManagedInstanceProperties struct { - // ProvisioningState - READ-ONLY; Possible values include: 'ProvisioningState1Creating', 'ProvisioningState1Deleting', 'ProvisioningState1Updating', 'ProvisioningState1Unknown', 'ProvisioningState1Succeeded', 'ProvisioningState1Failed' - ProvisioningState ProvisioningState1 `json:"provisioningState,omitempty"` - // ManagedInstanceCreateMode - Specifies the mode of database creation. - // - // Default: Regular instance creation. - // - // 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' - ManagedInstanceCreateMode ManagedServerCreateMode `json:"managedInstanceCreateMode,omitempty"` - // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the managed instance. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // AdministratorLogin - Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` +// ManagedInstanceLongTermRetentionPolicy a long term retention policy. +type ManagedInstanceLongTermRetentionPolicy struct { + autorest.Response `json:"-"` + // BaseLongTermRetentionPolicyProperties - Resource properties. + *BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicy. +func (miltrp ManagedInstanceLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miltrp.BaseLongTermRetentionPolicyProperties != nil { + objectMap["properties"] = miltrp.BaseLongTermRetentionPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionPolicy struct. +func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var baseLongTermRetentionPolicyProperties BaseLongTermRetentionPolicyProperties + err = json.Unmarshal(*v, &baseLongTermRetentionPolicyProperties) + if err != nil { + return err + } + miltrp.BaseLongTermRetentionPolicyProperties = &baseLongTermRetentionPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + miltrp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + miltrp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + miltrp.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstanceLongTermRetentionPolicyListResult a list of long term retention policies. +type ManagedInstanceLongTermRetentionPolicyListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ManagedInstanceLongTermRetentionPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicyListResult. +func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstanceLongTermRetentionPolicyListResultIterator provides access to a complete listing of +// ManagedInstanceLongTermRetentionPolicy values. +type ManagedInstanceLongTermRetentionPolicyListResultIterator struct { + i int + page ManagedInstanceLongTermRetentionPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) Response() ManagedInstanceLongTermRetentionPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) Value() ManagedInstanceLongTermRetentionPolicy { + if !iter.page.NotDone() { + return ManagedInstanceLongTermRetentionPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultIterator type. +func NewManagedInstanceLongTermRetentionPolicyListResultIterator(page ManagedInstanceLongTermRetentionPolicyListResultPage) ManagedInstanceLongTermRetentionPolicyListResultIterator { + return ManagedInstanceLongTermRetentionPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) IsEmpty() bool { + return miltrplr.Value == nil || len(*miltrplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) hasNextLink() bool { + return miltrplr.NextLink != nil && len(*miltrplr.NextLink) != 0 +} + +// managedInstanceLongTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) managedInstanceLongTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !miltrplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(miltrplr.NextLink))) +} + +// ManagedInstanceLongTermRetentionPolicyListResultPage contains a page of +// ManagedInstanceLongTermRetentionPolicy values. +type ManagedInstanceLongTermRetentionPolicyListResultPage struct { + fn func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error) + miltrplr ManagedInstanceLongTermRetentionPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.miltrplr) + if err != nil { + return err + } + page.miltrplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstanceLongTermRetentionPolicyListResultPage) NotDone() bool { + return !page.miltrplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Response() ManagedInstanceLongTermRetentionPolicyListResult { + return page.miltrplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Values() []ManagedInstanceLongTermRetentionPolicy { + if page.miltrplr.IsEmpty() { + return nil + } + return *page.miltrplr.Value +} + +// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultPage type. +func NewManagedInstanceLongTermRetentionPolicyListResultPage(cur ManagedInstanceLongTermRetentionPolicyListResult, getNextPage func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error)) ManagedInstanceLongTermRetentionPolicyListResultPage { + return ManagedInstanceLongTermRetentionPolicyListResultPage{ + fn: getNextPage, + miltrplr: cur, + } +} + +// ManagedInstanceMaintenanceConfigurationCapability the maintenance configuration capability +type ManagedInstanceMaintenanceConfigurationCapability struct { + // Name - READ-ONLY; Maintenance configuration name + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceMaintenanceConfigurationCapability. +func (mimcc ManagedInstanceMaintenanceConfigurationCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mimcc.Reason != nil { + objectMap["reason"] = mimcc.Reason + } + return json.Marshal(objectMap) +} + +// ManagedInstanceOperation a managed instance operation. +type ManagedInstanceOperation struct { + autorest.Response `json:"-"` + // ManagedInstanceOperationProperties - Resource properties. + *ManagedInstanceOperationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceOperation. +func (mio ManagedInstanceOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mio.ManagedInstanceOperationProperties != nil { + objectMap["properties"] = mio.ManagedInstanceOperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceOperation struct. +func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedInstanceOperationProperties ManagedInstanceOperationProperties + err = json.Unmarshal(*v, &managedInstanceOperationProperties) + if err != nil { + return err + } + mio.ManagedInstanceOperationProperties = &managedInstanceOperationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mio.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mio.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mio.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstanceOperationListResult the response to a list managed instance operations request +type ManagedInstanceOperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ManagedInstanceOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceOperationListResult. +func (miolr ManagedInstanceOperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstanceOperationListResultIterator provides access to a complete listing of +// ManagedInstanceOperation values. +type ManagedInstanceOperationListResultIterator struct { + i int + page ManagedInstanceOperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedInstanceOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedInstanceOperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedInstanceOperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedInstanceOperationListResultIterator) Response() ManagedInstanceOperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedInstanceOperationListResultIterator) Value() ManagedInstanceOperation { + if !iter.page.NotDone() { + return ManagedInstanceOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedInstanceOperationListResultIterator type. +func NewManagedInstanceOperationListResultIterator(page ManagedInstanceOperationListResultPage) ManagedInstanceOperationListResultIterator { + return ManagedInstanceOperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (miolr ManagedInstanceOperationListResult) IsEmpty() bool { + return miolr.Value == nil || len(*miolr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (miolr ManagedInstanceOperationListResult) hasNextLink() bool { + return miolr.NextLink != nil && len(*miolr.NextLink) != 0 +} + +// managedInstanceOperationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (miolr ManagedInstanceOperationListResult) managedInstanceOperationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !miolr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(miolr.NextLink))) +} + +// ManagedInstanceOperationListResultPage contains a page of ManagedInstanceOperation values. +type ManagedInstanceOperationListResultPage struct { + fn func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error) + miolr ManagedInstanceOperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedInstanceOperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.miolr) + if err != nil { + return err + } + page.miolr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedInstanceOperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstanceOperationListResultPage) NotDone() bool { + return !page.miolr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedInstanceOperationListResultPage) Response() ManagedInstanceOperationListResult { + return page.miolr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstanceOperationListResultPage) Values() []ManagedInstanceOperation { + if page.miolr.IsEmpty() { + return nil + } + return *page.miolr.Value +} + +// Creates a new instance of the ManagedInstanceOperationListResultPage type. +func NewManagedInstanceOperationListResultPage(cur ManagedInstanceOperationListResult, getNextPage func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error)) ManagedInstanceOperationListResultPage { + return ManagedInstanceOperationListResultPage{ + fn: getNextPage, + miolr: cur, + } +} + +// ManagedInstanceOperationParametersPair the parameters of a managed instance operation. +type ManagedInstanceOperationParametersPair struct { + // CurrentParameters - READ-ONLY; The current parameters. + CurrentParameters *UpsertManagedServerOperationParameters `json:"currentParameters,omitempty"` + // RequestedParameters - READ-ONLY; The requested parameters. + RequestedParameters *UpsertManagedServerOperationParameters `json:"requestedParameters,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceOperationParametersPair. +func (miopp ManagedInstanceOperationParametersPair) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstanceOperationProperties the properties of a managed instance operation. +type ManagedInstanceOperationProperties struct { + // ManagedInstanceName - READ-ONLY; The name of the managed instance the operation is being performed on. + ManagedInstanceName *string `json:"managedInstanceName,omitempty"` + // Operation - READ-ONLY; The name of operation. + Operation *string `json:"operation,omitempty"` + // OperationFriendlyName - READ-ONLY; The friendly name of operation. + OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` + // PercentComplete - READ-ONLY; The percentage of the operation completed. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // StartTime - READ-ONLY; The operation start time. + StartTime *date.Time `json:"startTime,omitempty"` + // State - READ-ONLY; The operation state. Possible values include: 'ManagementOperationStatePending', 'ManagementOperationStateInProgress', 'ManagementOperationStateSucceeded', 'ManagementOperationStateFailed', 'ManagementOperationStateCancelInProgress', 'ManagementOperationStateCancelled' + State ManagementOperationState `json:"state,omitempty"` + // ErrorCode - READ-ONLY; The operation error code. + ErrorCode *int32 `json:"errorCode,omitempty"` + // ErrorDescription - READ-ONLY; The operation error description. + ErrorDescription *string `json:"errorDescription,omitempty"` + // ErrorSeverity - READ-ONLY; The operation error severity. + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + // IsUserError - READ-ONLY; Whether or not the error is a user error. + IsUserError *bool `json:"isUserError,omitempty"` + // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. + EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` + // Description - READ-ONLY; The operation description. + Description *string `json:"description,omitempty"` + // IsCancellable - READ-ONLY; Whether the operation can be cancelled. + IsCancellable *bool `json:"isCancellable,omitempty"` + // OperationParameters - READ-ONLY; The operation parameters. + OperationParameters *ManagedInstanceOperationParametersPair `json:"operationParameters,omitempty"` + // OperationSteps - READ-ONLY; The operation steps. + OperationSteps *ManagedInstanceOperationSteps `json:"operationSteps,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceOperationProperties. +func (miop ManagedInstanceOperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstanceOperationSteps the steps of a managed instance operation. +type ManagedInstanceOperationSteps struct { + // TotalSteps - READ-ONLY; The total number of operation steps. + TotalSteps *string `json:"totalSteps,omitempty"` + // CurrentStep - READ-ONLY; The number of current operation steps. + CurrentStep *int32 `json:"currentStep,omitempty"` + // StepsList - READ-ONLY; The operation steps list. + StepsList *[]UpsertManagedServerOperationStep `json:"stepsList,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceOperationSteps. +func (mios ManagedInstanceOperationSteps) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstancePairInfo pairs of Managed Instances in the failover group. +type ManagedInstancePairInfo struct { + // PrimaryManagedInstanceID - Id of Primary Managed Instance in pair. + PrimaryManagedInstanceID *string `json:"primaryManagedInstanceId,omitempty"` + // PartnerManagedInstanceID - Id of Partner Managed Instance in pair. + PartnerManagedInstanceID *string `json:"partnerManagedInstanceId,omitempty"` +} + +// ManagedInstancePecProperty a private endpoint connection under a managed instance +type ManagedInstancePecProperty struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Properties - READ-ONLY; Private endpoint connection properties + Properties *ManagedInstancePrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePecProperty. +func (mipp ManagedInstancePecProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstancePrivateEndpointConnection a private endpoint connection +type ManagedInstancePrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ManagedInstancePrivateEndpointConnectionProperties - Resource properties. + *ManagedInstancePrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateEndpointConnection. +func (mipec ManagedInstancePrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mipec.ManagedInstancePrivateEndpointConnectionProperties != nil { + objectMap["properties"] = mipec.ManagedInstancePrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstancePrivateEndpointConnection struct. +func (mipec *ManagedInstancePrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedInstancePrivateEndpointConnectionProperties ManagedInstancePrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &managedInstancePrivateEndpointConnectionProperties) + if err != nil { + return err + } + mipec.ManagedInstancePrivateEndpointConnectionProperties = &managedInstancePrivateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mipec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mipec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mipec.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstancePrivateEndpointConnectionListResult a list of private endpoint connections. +type ManagedInstancePrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ManagedInstancePrivateEndpointConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateEndpointConnectionListResult. +func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstancePrivateEndpointConnectionListResultIterator provides access to a complete listing of +// ManagedInstancePrivateEndpointConnection values. +type ManagedInstancePrivateEndpointConnectionListResultIterator struct { + i int + page ManagedInstancePrivateEndpointConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedInstancePrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancePrivateEndpointConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedInstancePrivateEndpointConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedInstancePrivateEndpointConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedInstancePrivateEndpointConnectionListResultIterator) Response() ManagedInstancePrivateEndpointConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedInstancePrivateEndpointConnectionListResultIterator) Value() ManagedInstancePrivateEndpointConnection { + if !iter.page.NotDone() { + return ManagedInstancePrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedInstancePrivateEndpointConnectionListResultIterator type. +func NewManagedInstancePrivateEndpointConnectionListResultIterator(page ManagedInstancePrivateEndpointConnectionListResultPage) ManagedInstancePrivateEndpointConnectionListResultIterator { + return ManagedInstancePrivateEndpointConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) IsEmpty() bool { + return mipeclr.Value == nil || len(*mipeclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) hasNextLink() bool { + return mipeclr.NextLink != nil && len(*mipeclr.NextLink) != 0 +} + +// managedInstancePrivateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mipeclr ManagedInstancePrivateEndpointConnectionListResult) managedInstancePrivateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mipeclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mipeclr.NextLink))) +} + +// ManagedInstancePrivateEndpointConnectionListResultPage contains a page of +// ManagedInstancePrivateEndpointConnection values. +type ManagedInstancePrivateEndpointConnectionListResultPage struct { + fn func(context.Context, ManagedInstancePrivateEndpointConnectionListResult) (ManagedInstancePrivateEndpointConnectionListResult, error) + mipeclr ManagedInstancePrivateEndpointConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedInstancePrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancePrivateEndpointConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mipeclr) + if err != nil { + return err + } + page.mipeclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedInstancePrivateEndpointConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstancePrivateEndpointConnectionListResultPage) NotDone() bool { + return !page.mipeclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedInstancePrivateEndpointConnectionListResultPage) Response() ManagedInstancePrivateEndpointConnectionListResult { + return page.mipeclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstancePrivateEndpointConnectionListResultPage) Values() []ManagedInstancePrivateEndpointConnection { + if page.mipeclr.IsEmpty() { + return nil + } + return *page.mipeclr.Value +} + +// Creates a new instance of the ManagedInstancePrivateEndpointConnectionListResultPage type. +func NewManagedInstancePrivateEndpointConnectionListResultPage(cur ManagedInstancePrivateEndpointConnectionListResult, getNextPage func(context.Context, ManagedInstancePrivateEndpointConnectionListResult) (ManagedInstancePrivateEndpointConnectionListResult, error)) ManagedInstancePrivateEndpointConnectionListResultPage { + return ManagedInstancePrivateEndpointConnectionListResultPage{ + fn: getNextPage, + mipeclr: cur, + } +} + +// ManagedInstancePrivateEndpointConnectionProperties properties of a private endpoint connection. +type ManagedInstancePrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint which the connection belongs to. + PrivateEndpoint *ManagedInstancePrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. + PrivateLinkServiceConnectionState *ManagedInstancePrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; State of the Private Endpoint Connection. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateEndpointConnectionProperties. +func (mipecp ManagedInstancePrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mipecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = mipecp.PrivateEndpoint + } + if mipecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = mipecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstancePrivateEndpointConnectionsClient) (ManagedInstancePrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture.Result. +func (future *ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture) result(client ManagedInstancePrivateEndpointConnectionsClient) (mipec ManagedInstancePrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mipec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mipec.Response.Response, err = future.GetResult(sender); err == nil && mipec.Response.Response.StatusCode != http.StatusNoContent { + mipec, err = client.CreateOrUpdateResponder(mipec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancePrivateEndpointConnectionsCreateOrUpdateFuture", "Result", mipec.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedInstancePrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedInstancePrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstancePrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstancePrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstancePrivateEndpointConnectionsDeleteFuture.Result. +func (future *ManagedInstancePrivateEndpointConnectionsDeleteFuture) result(client ManagedInstancePrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancePrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancePrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedInstancePrivateEndpointProperty ... +type ManagedInstancePrivateEndpointProperty struct { + // ID - Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + +// ManagedInstancePrivateLink a private link resource +type ManagedInstancePrivateLink struct { + autorest.Response `json:"-"` + // Properties - READ-ONLY; The private link resource group id. + Properties *ManagedInstancePrivateLinkProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateLink. +func (mipl ManagedInstancePrivateLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstancePrivateLinkListResult a list of private link resources +type ManagedInstancePrivateLinkListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ManagedInstancePrivateLink `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateLinkListResult. +func (mipllr ManagedInstancePrivateLinkListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstancePrivateLinkListResultIterator provides access to a complete listing of +// ManagedInstancePrivateLink values. +type ManagedInstancePrivateLinkListResultIterator struct { + i int + page ManagedInstancePrivateLinkListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedInstancePrivateLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancePrivateLinkListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedInstancePrivateLinkListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedInstancePrivateLinkListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedInstancePrivateLinkListResultIterator) Response() ManagedInstancePrivateLinkListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedInstancePrivateLinkListResultIterator) Value() ManagedInstancePrivateLink { + if !iter.page.NotDone() { + return ManagedInstancePrivateLink{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedInstancePrivateLinkListResultIterator type. +func NewManagedInstancePrivateLinkListResultIterator(page ManagedInstancePrivateLinkListResultPage) ManagedInstancePrivateLinkListResultIterator { + return ManagedInstancePrivateLinkListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mipllr ManagedInstancePrivateLinkListResult) IsEmpty() bool { + return mipllr.Value == nil || len(*mipllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mipllr ManagedInstancePrivateLinkListResult) hasNextLink() bool { + return mipllr.NextLink != nil && len(*mipllr.NextLink) != 0 +} + +// managedInstancePrivateLinkListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mipllr ManagedInstancePrivateLinkListResult) managedInstancePrivateLinkListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mipllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mipllr.NextLink))) +} + +// ManagedInstancePrivateLinkListResultPage contains a page of ManagedInstancePrivateLink values. +type ManagedInstancePrivateLinkListResultPage struct { + fn func(context.Context, ManagedInstancePrivateLinkListResult) (ManagedInstancePrivateLinkListResult, error) + mipllr ManagedInstancePrivateLinkListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedInstancePrivateLinkListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstancePrivateLinkListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mipllr) + if err != nil { + return err + } + page.mipllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedInstancePrivateLinkListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstancePrivateLinkListResultPage) NotDone() bool { + return !page.mipllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedInstancePrivateLinkListResultPage) Response() ManagedInstancePrivateLinkListResult { + return page.mipllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstancePrivateLinkListResultPage) Values() []ManagedInstancePrivateLink { + if page.mipllr.IsEmpty() { + return nil + } + return *page.mipllr.Value +} + +// Creates a new instance of the ManagedInstancePrivateLinkListResultPage type. +func NewManagedInstancePrivateLinkListResultPage(cur ManagedInstancePrivateLinkListResult, getNextPage func(context.Context, ManagedInstancePrivateLinkListResult) (ManagedInstancePrivateLinkListResult, error)) ManagedInstancePrivateLinkListResultPage { + return ManagedInstancePrivateLinkListResultPage{ + fn: getNextPage, + mipllr: cur, + } +} + +// ManagedInstancePrivateLinkProperties properties of a private link resource. +type ManagedInstancePrivateLinkProperties struct { + // GroupID - READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; The private link resource required member names. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateLinkProperties. +func (miplp ManagedInstancePrivateLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstancePrivateLinkServiceConnectionStateProperty ... +type ManagedInstancePrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. + Status *string `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; The private link service connection description. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstancePrivateLinkServiceConnectionStateProperty. +func (miplscsp ManagedInstancePrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miplscsp.Status != nil { + objectMap["status"] = miplscsp.Status + } + if miplscsp.Description != nil { + objectMap["description"] = miplscsp.Description + } + return json.Marshal(objectMap) +} + +// ManagedInstanceProperties the properties of a managed instance. +type ManagedInstanceProperties struct { + // ProvisioningState - READ-ONLY; Possible values include: 'ProvisioningState1Creating', 'ProvisioningState1Deleting', 'ProvisioningState1Updating', 'ProvisioningState1Unknown', 'ProvisioningState1Succeeded', 'ProvisioningState1Failed', 'ProvisioningState1Accepted', 'ProvisioningState1Created', 'ProvisioningState1Deleted', 'ProvisioningState1Unrecognized', 'ProvisioningState1Running', 'ProvisioningState1Canceled', 'ProvisioningState1NotSpecified', 'ProvisioningState1Registering', 'ProvisioningState1TimedOut' + ProvisioningState ProvisioningState1 `json:"provisioningState,omitempty"` + // ManagedInstanceCreateMode - Specifies the mode of database creation. + // + // Default: Regular instance creation. + // + // 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' + ManagedInstanceCreateMode ManagedServerCreateMode `json:"managedInstanceCreateMode,omitempty"` + // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the managed instance. + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + // AdministratorLogin - Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). + AdministratorLogin *string `json:"administratorLogin,omitempty"` // AdministratorLoginPassword - The administrator login password (required for managed instance creation). AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` // SubnetID - Subnet resource ID for the managed instance. @@ -18328,8 +20154,10 @@ type ManagedInstanceProperties struct { PrivateEndpointConnections *[]ManagedInstancePecProperty `json:"privateEndpointConnections,omitempty"` // MinimalTLSVersion - Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` - // StorageAccountType - The storage account type used to store backups for this instance. The options are LRS (LocallyRedundantStorage), ZRS (ZoneRedundantStorage) and GRS (GeoRedundantStorage). Possible values include: 'StorageAccountTypeGRS', 'StorageAccountTypeLRS', 'StorageAccountTypeZRS' - StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` + // CurrentBackupStorageRedundancy - READ-ONLY; The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + CurrentBackupStorageRedundancy BackupStorageRedundancy `json:"currentBackupStorageRedundancy,omitempty"` + // RequestedBackupStorageRedundancy - The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + RequestedBackupStorageRedundancy BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` // ZoneRedundant - Whether or not the multi-az is enabled. ZoneRedundant *bool `json:"zoneRedundant,omitempty"` // PrimaryUserAssignedIdentityID - The resource id of a user assigned identity to be used by default. @@ -18338,85 +20166,660 @@ type ManagedInstanceProperties struct { KeyID *string `json:"keyId,omitempty"` // Administrators - The Azure Active Directory administrator of the server. Administrators *ManagedInstanceExternalAdministrator `json:"administrators,omitempty"` + // ServicePrincipal - The managed instance's service principal. + ServicePrincipal *ServicePrincipal `json:"servicePrincipal,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceProperties. +func (mip ManagedInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mip.ManagedInstanceCreateMode != "" { + objectMap["managedInstanceCreateMode"] = mip.ManagedInstanceCreateMode + } + if mip.AdministratorLogin != nil { + objectMap["administratorLogin"] = mip.AdministratorLogin + } + if mip.AdministratorLoginPassword != nil { + objectMap["administratorLoginPassword"] = mip.AdministratorLoginPassword + } + if mip.SubnetID != nil { + objectMap["subnetId"] = mip.SubnetID + } + if mip.LicenseType != "" { + objectMap["licenseType"] = mip.LicenseType + } + if mip.VCores != nil { + objectMap["vCores"] = mip.VCores + } + if mip.StorageSizeInGB != nil { + objectMap["storageSizeInGB"] = mip.StorageSizeInGB + } + if mip.Collation != nil { + objectMap["collation"] = mip.Collation + } + if mip.DNSZonePartner != nil { + objectMap["dnsZonePartner"] = mip.DNSZonePartner + } + if mip.PublicDataEndpointEnabled != nil { + objectMap["publicDataEndpointEnabled"] = mip.PublicDataEndpointEnabled + } + if mip.SourceManagedInstanceID != nil { + objectMap["sourceManagedInstanceId"] = mip.SourceManagedInstanceID + } + if mip.RestorePointInTime != nil { + objectMap["restorePointInTime"] = mip.RestorePointInTime + } + if mip.ProxyOverride != "" { + objectMap["proxyOverride"] = mip.ProxyOverride + } + if mip.TimezoneID != nil { + objectMap["timezoneId"] = mip.TimezoneID + } + if mip.InstancePoolID != nil { + objectMap["instancePoolId"] = mip.InstancePoolID + } + if mip.MaintenanceConfigurationID != nil { + objectMap["maintenanceConfigurationId"] = mip.MaintenanceConfigurationID + } + if mip.MinimalTLSVersion != nil { + objectMap["minimalTlsVersion"] = mip.MinimalTLSVersion + } + if mip.RequestedBackupStorageRedundancy != "" { + objectMap["requestedBackupStorageRedundancy"] = mip.RequestedBackupStorageRedundancy + } + if mip.ZoneRedundant != nil { + objectMap["zoneRedundant"] = mip.ZoneRedundant + } + if mip.PrimaryUserAssignedIdentityID != nil { + objectMap["primaryUserAssignedIdentityId"] = mip.PrimaryUserAssignedIdentityID + } + if mip.KeyID != nil { + objectMap["keyId"] = mip.KeyID + } + if mip.Administrators != nil { + objectMap["administrators"] = mip.Administrators + } + if mip.ServicePrincipal != nil { + objectMap["servicePrincipal"] = mip.ServicePrincipal + } + return json.Marshal(objectMap) +} + +// ManagedInstanceQuery database query. +type ManagedInstanceQuery struct { + autorest.Response `json:"-"` + // QueryProperties - Resource properties. + *QueryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceQuery. +func (miq ManagedInstanceQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miq.QueryProperties != nil { + objectMap["properties"] = miq.QueryProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceQuery struct. +func (miq *ManagedInstanceQuery) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var queryProperties QueryProperties + err = json.Unmarshal(*v, &queryProperties) + if err != nil { + return err + } + miq.QueryProperties = &queryProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + miq.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + miq.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + miq.Type = &typeVar + } + } + } + + return nil +} + +// ManagedInstanceQueryStatistics execution statistics for one particular query +type ManagedInstanceQueryStatistics struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]QueryStatistics `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceQueryStatistics. +func (miqs ManagedInstanceQueryStatistics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedInstanceQueryStatisticsIterator provides access to a complete listing of QueryStatistics values. +type ManagedInstanceQueryStatisticsIterator struct { + i int + page ManagedInstanceQueryStatisticsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedInstanceQueryStatisticsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceQueryStatisticsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedInstanceQueryStatisticsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedInstanceQueryStatisticsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedInstanceQueryStatisticsIterator) Response() ManagedInstanceQueryStatistics { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedInstanceQueryStatisticsIterator) Value() QueryStatistics { + if !iter.page.NotDone() { + return QueryStatistics{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedInstanceQueryStatisticsIterator type. +func NewManagedInstanceQueryStatisticsIterator(page ManagedInstanceQueryStatisticsPage) ManagedInstanceQueryStatisticsIterator { + return ManagedInstanceQueryStatisticsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (miqs ManagedInstanceQueryStatistics) IsEmpty() bool { + return miqs.Value == nil || len(*miqs.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (miqs ManagedInstanceQueryStatistics) hasNextLink() bool { + return miqs.NextLink != nil && len(*miqs.NextLink) != 0 +} + +// managedInstanceQueryStatisticsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (miqs ManagedInstanceQueryStatistics) managedInstanceQueryStatisticsPreparer(ctx context.Context) (*http.Request, error) { + if !miqs.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(miqs.NextLink))) +} + +// ManagedInstanceQueryStatisticsPage contains a page of QueryStatistics values. +type ManagedInstanceQueryStatisticsPage struct { + fn func(context.Context, ManagedInstanceQueryStatistics) (ManagedInstanceQueryStatistics, error) + miqs ManagedInstanceQueryStatistics +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedInstanceQueryStatisticsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceQueryStatisticsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.miqs) + if err != nil { + return err + } + page.miqs = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedInstanceQueryStatisticsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstanceQueryStatisticsPage) NotDone() bool { + return !page.miqs.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedInstanceQueryStatisticsPage) Response() ManagedInstanceQueryStatistics { + return page.miqs +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstanceQueryStatisticsPage) Values() []QueryStatistics { + if page.miqs.IsEmpty() { + return nil + } + return *page.miqs.Value +} + +// Creates a new instance of the ManagedInstanceQueryStatisticsPage type. +func NewManagedInstanceQueryStatisticsPage(cur ManagedInstanceQueryStatistics, getNextPage func(context.Context, ManagedInstanceQueryStatistics) (ManagedInstanceQueryStatistics, error)) ManagedInstanceQueryStatisticsPage { + return ManagedInstanceQueryStatisticsPage{ + fn: getNextPage, + miqs: cur, + } +} + +// ManagedInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedInstancesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstancesClient) (ManagedInstance, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstancesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstancesCreateOrUpdateFuture.Result. +func (future *ManagedInstancesCreateOrUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mi.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { + mi, err = client.CreateOrUpdateResponder(mi.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedInstancesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstancesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstancesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil } -// MarshalJSON is the custom marshaler for ManagedInstanceProperties. -func (mip ManagedInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mip.ManagedInstanceCreateMode != "" { - objectMap["managedInstanceCreateMode"] = mip.ManagedInstanceCreateMode - } - if mip.AdministratorLogin != nil { - objectMap["administratorLogin"] = mip.AdministratorLogin - } - if mip.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = mip.AdministratorLoginPassword +// result is the default implementation for ManagedInstancesDeleteFuture.Result. +func (future *ManagedInstancesDeleteFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure") + return } - if mip.SubnetID != nil { - objectMap["subnetId"] = mip.SubnetID + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesDeleteFuture") + return } - if mip.LicenseType != "" { - objectMap["licenseType"] = mip.LicenseType + ar.Response = future.Response() + return +} + +// ManagedInstancesFailoverFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedInstancesFailoverFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstancesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstancesFailoverFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - if mip.VCores != nil { - objectMap["vCores"] = mip.VCores + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstancesFailoverFuture.Result. +func (future *ManagedInstancesFailoverFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesFailoverFuture", "Result", future.Response(), "Polling failure") + return } - if mip.StorageSizeInGB != nil { - objectMap["storageSizeInGB"] = mip.StorageSizeInGB + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesFailoverFuture") + return } - if mip.Collation != nil { - objectMap["collation"] = mip.Collation + ar.Response = future.Response() + return +} + +// ManagedInstancesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedInstancesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstancesClient) (ManagedInstance, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstancesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - if mip.DNSZonePartner != nil { - objectMap["dnsZonePartner"] = mip.DNSZonePartner + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstancesUpdateFuture.Result. +func (future *ManagedInstancesUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", future.Response(), "Polling failure") + return } - if mip.PublicDataEndpointEnabled != nil { - objectMap["publicDataEndpointEnabled"] = mip.PublicDataEndpointEnabled + if !done { + mi.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesUpdateFuture") + return } - if mip.SourceManagedInstanceID != nil { - objectMap["sourceManagedInstanceId"] = mip.SourceManagedInstanceID + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { + mi, err = client.UpdateResponder(mi.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") + } } - if mip.RestorePointInTime != nil { - objectMap["restorePointInTime"] = mip.RestorePointInTime + return +} + +// ManagedInstanceTdeCertificatesCreateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedInstanceTdeCertificatesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedInstanceTdeCertificatesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedInstanceTdeCertificatesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err } - if mip.ProxyOverride != "" { - objectMap["proxyOverride"] = mip.ProxyOverride + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedInstanceTdeCertificatesCreateFuture.Result. +func (future *ManagedInstanceTdeCertificatesCreateFuture) result(client ManagedInstanceTdeCertificatesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedInstanceTdeCertificatesCreateFuture", "Result", future.Response(), "Polling failure") + return } - if mip.TimezoneID != nil { - objectMap["timezoneId"] = mip.TimezoneID + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceTdeCertificatesCreateFuture") + return } - if mip.InstancePoolID != nil { - objectMap["instancePoolId"] = mip.InstancePoolID + ar.Response = future.Response() + return +} + +// ManagedInstanceUpdate an update request for an Azure SQL Database managed instance. +type ManagedInstanceUpdate struct { + // Sku - Managed instance sku + Sku *Sku `json:"sku,omitempty"` + // Identity - Managed instance identity + Identity *ResourceIdentity `json:"identity,omitempty"` + // ManagedInstanceProperties - Resource properties. + *ManagedInstanceProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceUpdate. +func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if miu.Sku != nil { + objectMap["sku"] = miu.Sku } - if mip.MaintenanceConfigurationID != nil { - objectMap["maintenanceConfigurationId"] = mip.MaintenanceConfigurationID + if miu.Identity != nil { + objectMap["identity"] = miu.Identity } - if mip.MinimalTLSVersion != nil { - objectMap["minimalTlsVersion"] = mip.MinimalTLSVersion + if miu.ManagedInstanceProperties != nil { + objectMap["properties"] = miu.ManagedInstanceProperties } - if mip.StorageAccountType != "" { - objectMap["storageAccountType"] = mip.StorageAccountType + if miu.Tags != nil { + objectMap["tags"] = miu.Tags } - if mip.ZoneRedundant != nil { - objectMap["zoneRedundant"] = mip.ZoneRedundant + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceUpdate struct. +func (miu *ManagedInstanceUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err } - if mip.PrimaryUserAssignedIdentityID != nil { - objectMap["primaryUserAssignedIdentityId"] = mip.PrimaryUserAssignedIdentityID + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + miu.Sku = &sku + } + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + miu.Identity = &identity + } + case "properties": + if v != nil { + var managedInstanceProperties ManagedInstanceProperties + err = json.Unmarshal(*v, &managedInstanceProperties) + if err != nil { + return err + } + miu.ManagedInstanceProperties = &managedInstanceProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + miu.Tags = tags + } + } } - if mip.KeyID != nil { - objectMap["keyId"] = mip.KeyID + + return nil +} + +// ManagedInstanceVcoresCapability the managed instance virtual cores capability. +type ManagedInstanceVcoresCapability struct { + // Name - READ-ONLY; The virtual cores identifier. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; The virtual cores value. + Value *int32 `json:"value,omitempty"` + // IncludedMaxSize - READ-ONLY; Included size. + IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` + // SupportedStorageSizes - READ-ONLY; Storage size ranges. + SupportedStorageSizes *[]MaxSizeRangeCapability `json:"supportedStorageSizes,omitempty"` + // InstancePoolSupported - READ-ONLY; True if this service objective is supported for managed instances in an instance pool. + InstancePoolSupported *bool `json:"instancePoolSupported,omitempty"` + // StandaloneSupported - READ-ONLY; True if this service objective is supported for standalone managed instances. + StandaloneSupported *bool `json:"standaloneSupported,omitempty"` + // SupportedMaintenanceConfigurations - READ-ONLY; List of supported maintenance configurations + SupportedMaintenanceConfigurations *[]ManagedInstanceMaintenanceConfigurationCapability `json:"supportedMaintenanceConfigurations,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceVcoresCapability. +func (mivc ManagedInstanceVcoresCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mivc.Reason != nil { + objectMap["reason"] = mivc.Reason } - if mip.Administrators != nil { - objectMap["administrators"] = mip.Administrators + return json.Marshal(objectMap) +} + +// ManagedInstanceVersionCapability the managed instance capability +type ManagedInstanceVersionCapability struct { + // Name - READ-ONLY; The server version name. + Name *string `json:"name,omitempty"` + // SupportedEditions - READ-ONLY; The list of supported managed instance editions. + SupportedEditions *[]ManagedInstanceEditionCapability `json:"supportedEditions,omitempty"` + // SupportedInstancePoolEditions - READ-ONLY; The list of supported instance pool editions. + SupportedInstancePoolEditions *[]InstancePoolEditionCapability `json:"supportedInstancePoolEditions,omitempty"` + // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' + Status CapabilityStatus `json:"status,omitempty"` + // Reason - The reason for the capability not being available. + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedInstanceVersionCapability. +func (mivc ManagedInstanceVersionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mivc.Reason != nil { + objectMap["reason"] = mivc.Reason } return json.Marshal(objectMap) } -// ManagedInstanceQuery database query. -type ManagedInstanceQuery struct { +// ManagedInstanceVulnerabilityAssessment a managed instance vulnerability assessment. +type ManagedInstanceVulnerabilityAssessment struct { autorest.Response `json:"-"` - // QueryProperties - Resource properties. - *QueryProperties `json:"properties,omitempty"` + // ManagedInstanceVulnerabilityAssessmentProperties - Resource properties. + *ManagedInstanceVulnerabilityAssessmentProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -18425,17 +20828,17 @@ type ManagedInstanceQuery struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceQuery. -func (miq ManagedInstanceQuery) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessment. +func (miva ManagedInstanceVulnerabilityAssessment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if miq.QueryProperties != nil { - objectMap["properties"] = miq.QueryProperties + if miva.ManagedInstanceVulnerabilityAssessmentProperties != nil { + objectMap["properties"] = miva.ManagedInstanceVulnerabilityAssessmentProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceQuery struct. -func (miq *ManagedInstanceQuery) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedInstanceVulnerabilityAssessment struct. +func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -18445,12 +20848,12 @@ func (miq *ManagedInstanceQuery) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var queryProperties QueryProperties - err = json.Unmarshal(*v, &queryProperties) + var managedInstanceVulnerabilityAssessmentProperties ManagedInstanceVulnerabilityAssessmentProperties + err = json.Unmarshal(*v, &managedInstanceVulnerabilityAssessmentProperties) if err != nil { return err } - miq.QueryProperties = &queryProperties + miva.ManagedInstanceVulnerabilityAssessmentProperties = &managedInstanceVulnerabilityAssessmentProperties } case "id": if v != nil { @@ -18459,7 +20862,7 @@ func (miq *ManagedInstanceQuery) UnmarshalJSON(body []byte) error { if err != nil { return err } - miq.ID = &ID + miva.ID = &ID } case "name": if v != nil { @@ -18468,7 +20871,7 @@ func (miq *ManagedInstanceQuery) UnmarshalJSON(body []byte) error { if err != nil { return err } - miq.Name = &name + miva.Name = &name } case "type": if v != nil { @@ -18477,7 +20880,7 @@ func (miq *ManagedInstanceQuery) UnmarshalJSON(body []byte) error { if err != nil { return err } - miq.Type = &typeVar + miva.Type = &typeVar } } } @@ -18485,32 +20888,34 @@ func (miq *ManagedInstanceQuery) UnmarshalJSON(body []byte) error { return nil } -// ManagedInstanceQueryStatistics execution statistics for one particular query -type ManagedInstanceQueryStatistics struct { +// ManagedInstanceVulnerabilityAssessmentListResult a list of the ManagedInstance's vulnerability +// assessments. +type ManagedInstanceVulnerabilityAssessmentListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]QueryStatistics `json:"value,omitempty"` + Value *[]ManagedInstanceVulnerabilityAssessment `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceQueryStatistics. -func (miqs ManagedInstanceQueryStatistics) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessmentListResult. +func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstanceQueryStatisticsIterator provides access to a complete listing of QueryStatistics values. -type ManagedInstanceQueryStatisticsIterator struct { +// ManagedInstanceVulnerabilityAssessmentListResultIterator provides access to a complete listing of +// ManagedInstanceVulnerabilityAssessment values. +type ManagedInstanceVulnerabilityAssessmentListResultIterator struct { i int - page ManagedInstanceQueryStatisticsPage + page ManagedInstanceVulnerabilityAssessmentListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceQueryStatisticsIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceQueryStatisticsIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -18535,67 +20940,68 @@ func (iter *ManagedInstanceQueryStatisticsIterator) NextWithContext(ctx context. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceQueryStatisticsIterator) Next() error { +func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceQueryStatisticsIterator) NotDone() bool { +func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceQueryStatisticsIterator) Response() ManagedInstanceQueryStatistics { +func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) Response() ManagedInstanceVulnerabilityAssessmentListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceQueryStatisticsIterator) Value() QueryStatistics { +func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) Value() ManagedInstanceVulnerabilityAssessment { if !iter.page.NotDone() { - return QueryStatistics{} + return ManagedInstanceVulnerabilityAssessment{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceQueryStatisticsIterator type. -func NewManagedInstanceQueryStatisticsIterator(page ManagedInstanceQueryStatisticsPage) ManagedInstanceQueryStatisticsIterator { - return ManagedInstanceQueryStatisticsIterator{page: page} +// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultIterator type. +func NewManagedInstanceVulnerabilityAssessmentListResultIterator(page ManagedInstanceVulnerabilityAssessmentListResultPage) ManagedInstanceVulnerabilityAssessmentListResultIterator { + return ManagedInstanceVulnerabilityAssessmentListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (miqs ManagedInstanceQueryStatistics) IsEmpty() bool { - return miqs.Value == nil || len(*miqs.Value) == 0 +func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) IsEmpty() bool { + return mivalr.Value == nil || len(*mivalr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (miqs ManagedInstanceQueryStatistics) hasNextLink() bool { - return miqs.NextLink != nil && len(*miqs.NextLink) != 0 +func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) hasNextLink() bool { + return mivalr.NextLink != nil && len(*mivalr.NextLink) != 0 } -// managedInstanceQueryStatisticsPreparer prepares a request to retrieve the next set of results. +// managedInstanceVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (miqs ManagedInstanceQueryStatistics) managedInstanceQueryStatisticsPreparer(ctx context.Context) (*http.Request, error) { - if !miqs.hasNextLink() { +func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) managedInstanceVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mivalr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(miqs.NextLink))) + autorest.WithBaseURL(to.String(mivalr.NextLink))) } -// ManagedInstanceQueryStatisticsPage contains a page of QueryStatistics values. -type ManagedInstanceQueryStatisticsPage struct { - fn func(context.Context, ManagedInstanceQueryStatistics) (ManagedInstanceQueryStatistics, error) - miqs ManagedInstanceQueryStatistics +// ManagedInstanceVulnerabilityAssessmentListResultPage contains a page of +// ManagedInstanceVulnerabilityAssessment values. +type ManagedInstanceVulnerabilityAssessmentListResultPage struct { + fn func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error) + mivalr ManagedInstanceVulnerabilityAssessmentListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceQueryStatisticsPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceQueryStatisticsPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -18605,11 +21011,11 @@ func (page *ManagedInstanceQueryStatisticsPage) NextWithContext(ctx context.Cont }() } for { - next, err := page.fn(ctx, page.miqs) + next, err := page.fn(ctx, page.mivalr) if err != nil { return err } - page.miqs = next + page.mivalr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -18617,167 +21023,63 @@ func (page *ManagedInstanceQueryStatisticsPage) NextWithContext(ctx context.Cont return nil } -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceQueryStatisticsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceQueryStatisticsPage) NotDone() bool { - return !page.miqs.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedInstanceQueryStatisticsPage) Response() ManagedInstanceQueryStatistics { - return page.miqs -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceQueryStatisticsPage) Values() []QueryStatistics { - if page.miqs.IsEmpty() { - return nil - } - return *page.miqs.Value -} - -// Creates a new instance of the ManagedInstanceQueryStatisticsPage type. -func NewManagedInstanceQueryStatisticsPage(cur ManagedInstanceQueryStatistics, getNextPage func(context.Context, ManagedInstanceQueryStatistics) (ManagedInstanceQueryStatistics, error)) ManagedInstanceQueryStatisticsPage { - return ManagedInstanceQueryStatisticsPage{ - fn: getNextPage, - miqs: cur, - } -} - -// ManagedInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstancesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (ManagedInstance, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedInstancesCreateOrUpdateFuture.Result. -func (future *ManagedInstancesCreateOrUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mi.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { - mi, err = client.CreateOrUpdateResponder(mi.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedInstancesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedInstancesDeleteFuture.Result. -func (future *ManagedInstancesDeleteFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesDeleteFuture") - return - } - ar.Response = future.Response() - return +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) Next() error { + return page.NextWithContext(context.Background()) } -// ManagedInstancesFailoverFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstancesFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (autorest.Response, error) +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedInstanceVulnerabilityAssessmentListResultPage) NotDone() bool { + return !page.mivalr.IsEmpty() } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesFailoverFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// Response returns the raw server response from the last page request. +func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Response() ManagedInstanceVulnerabilityAssessmentListResult { + return page.mivalr } -// result is the default implementation for ManagedInstancesFailoverFuture.Result. -func (future *ManagedInstancesFailoverFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesFailoverFuture", "Result", future.Response(), "Polling failure") - return +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Values() []ManagedInstanceVulnerabilityAssessment { + if page.mivalr.IsEmpty() { + return nil } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesFailoverFuture") - return + return *page.mivalr.Value +} + +// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultPage type. +func NewManagedInstanceVulnerabilityAssessmentListResultPage(cur ManagedInstanceVulnerabilityAssessmentListResult, getNextPage func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error)) ManagedInstanceVulnerabilityAssessmentListResultPage { + return ManagedInstanceVulnerabilityAssessmentListResultPage{ + fn: getNextPage, + mivalr: cur, } - ar.Response = future.Response() - return } -// ManagedInstancesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedInstancesUpdateFuture struct { +// ManagedInstanceVulnerabilityAssessmentProperties properties of a managed instance vulnerability +// assessment. +type ManagedInstanceVulnerabilityAssessmentProperties struct { + // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + StorageContainerPath *string `json:"storageContainerPath,omitempty"` + // StorageContainerSasKey - A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall + StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` + // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet or a firewall + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + // RecurringScans - The recurring scans settings + RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` +} + +// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for +// monitoring and retrieving the results of a long-running operation. +type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstancesClient) (ManagedInstance, error) + Result func(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstancesUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -18787,40 +21089,40 @@ func (future *ManagedInstancesUpdateFuture) UnmarshalJSON(body []byte) error { return nil } -// result is the default implementation for ManagedInstancesUpdateFuture.Result. -func (future *ManagedInstancesUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { +// result is the default implementation for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. +func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - mi.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesUpdateFuture") + mbstrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { - mi, err = client.UpdateResponder(mi.Response.Response) + if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { + mbstrp, err = client.CreateOrUpdateResponder(mbstrp.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") } } return } -// ManagedInstanceTdeCertificatesCreateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedInstanceTdeCertificatesCreateFuture struct { +// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture an abstraction for +// monitoring and retrieving the results of a long-running operation. +type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ManagedInstanceTdeCertificatesClient) (autorest.Response, error) + Result func(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedInstanceTdeCertificatesCreateFuture) UnmarshalJSON(body []byte) error { +func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -18830,163 +21132,34 @@ func (future *ManagedInstanceTdeCertificatesCreateFuture) UnmarshalJSON(body []b return nil } -// result is the default implementation for ManagedInstanceTdeCertificatesCreateFuture.Result. -func (future *ManagedInstanceTdeCertificatesCreateFuture) result(client ManagedInstanceTdeCertificatesClient) (ar autorest.Response, err error) { +// result is the default implementation for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture.Result. +func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture) result(client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedInstanceTdeCertificatesCreateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceTdeCertificatesCreateFuture") + mbstrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture") return } - ar.Response = future.Response() - return -} - -// ManagedInstanceUpdate an update request for an Azure SQL Database managed instance. -type ManagedInstanceUpdate struct { - // Sku - Managed instance sku - Sku *Sku `json:"sku,omitempty"` - // Identity - Managed instance identity - Identity *ResourceIdentity `json:"identity,omitempty"` - // ManagedInstanceProperties - Resource properties. - *ManagedInstanceProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceUpdate. -func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if miu.Sku != nil { - objectMap["sku"] = miu.Sku - } - if miu.Identity != nil { - objectMap["identity"] = miu.Identity - } - if miu.ManagedInstanceProperties != nil { - objectMap["properties"] = miu.ManagedInstanceProperties - } - if miu.Tags != nil { - objectMap["tags"] = miu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceUpdate struct. -func (miu *ManagedInstanceUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - miu.Sku = &sku - } - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - miu.Identity = &identity - } - case "properties": - if v != nil { - var managedInstanceProperties ManagedInstanceProperties - err = json.Unmarshal(*v, &managedInstanceProperties) - if err != nil { - return err - } - miu.ManagedInstanceProperties = &managedInstanceProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - miu.Tags = tags - } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { + mbstrp, err = client.UpdateResponder(mbstrp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") } } - - return nil -} - -// ManagedInstanceVcoresCapability the managed instance virtual cores capability. -type ManagedInstanceVcoresCapability struct { - // Name - READ-ONLY; The virtual cores identifier. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; The virtual cores value. - Value *int32 `json:"value,omitempty"` - // IncludedMaxSize - READ-ONLY; Included size. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - // SupportedStorageSizes - READ-ONLY; Storage size ranges. - SupportedStorageSizes *[]MaxSizeRangeCapability `json:"supportedStorageSizes,omitempty"` - // InstancePoolSupported - READ-ONLY; True if this service objective is supported for managed instances in an instance pool. - InstancePoolSupported *bool `json:"instancePoolSupported,omitempty"` - // StandaloneSupported - READ-ONLY; True if this service objective is supported for standalone managed instances. - StandaloneSupported *bool `json:"standaloneSupported,omitempty"` - // SupportedMaintenanceConfigurations - READ-ONLY; List of supported maintenance configurations - SupportedMaintenanceConfigurations *[]ManagedInstanceMaintenanceConfigurationCapability `json:"supportedMaintenanceConfigurations,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceVcoresCapability. -func (mivc ManagedInstanceVcoresCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mivc.Reason != nil { - objectMap["reason"] = mivc.Reason - } - return json.Marshal(objectMap) -} - -// ManagedInstanceVersionCapability the managed instance capability -type ManagedInstanceVersionCapability struct { - // Name - READ-ONLY; The server version name. - Name *string `json:"name,omitempty"` - // SupportedEditions - READ-ONLY; The list of supported managed instance editions. - SupportedEditions *[]ManagedInstanceEditionCapability `json:"supportedEditions,omitempty"` - // SupportedInstancePoolEditions - READ-ONLY; The list of supported instance pool editions. - SupportedInstancePoolEditions *[]InstancePoolEditionCapability `json:"supportedInstancePoolEditions,omitempty"` - // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' - Status CapabilityStatus `json:"status,omitempty"` - // Reason - The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedInstanceVersionCapability. -func (mivc ManagedInstanceVersionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mivc.Reason != nil { - objectMap["reason"] = mivc.Reason - } - return json.Marshal(objectMap) + return } -// ManagedInstanceVulnerabilityAssessment a managed instance vulnerability assessment. -type ManagedInstanceVulnerabilityAssessment struct { +// ManagedServerDNSAlias a managed server DNS alias. +type ManagedServerDNSAlias struct { autorest.Response `json:"-"` - // ManagedInstanceVulnerabilityAssessmentProperties - Resource properties. - *ManagedInstanceVulnerabilityAssessmentProperties `json:"properties,omitempty"` + // ManagedServerDNSAliasProperties - Resource properties. + *ManagedServerDNSAliasProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -18995,17 +21168,17 @@ type ManagedInstanceVulnerabilityAssessment struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessment. -func (miva ManagedInstanceVulnerabilityAssessment) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedServerDNSAlias. +func (msda ManagedServerDNSAlias) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if miva.ManagedInstanceVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = miva.ManagedInstanceVulnerabilityAssessmentProperties + if msda.ManagedServerDNSAliasProperties != nil { + objectMap["properties"] = msda.ManagedServerDNSAliasProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ManagedInstanceVulnerabilityAssessment struct. -func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ManagedServerDNSAlias struct. +func (msda *ManagedServerDNSAlias) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -19015,12 +21188,12 @@ func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) e switch k { case "properties": if v != nil { - var managedInstanceVulnerabilityAssessmentProperties ManagedInstanceVulnerabilityAssessmentProperties - err = json.Unmarshal(*v, &managedInstanceVulnerabilityAssessmentProperties) + var managedServerDNSAliasProperties ManagedServerDNSAliasProperties + err = json.Unmarshal(*v, &managedServerDNSAliasProperties) if err != nil { return err } - miva.ManagedInstanceVulnerabilityAssessmentProperties = &managedInstanceVulnerabilityAssessmentProperties + msda.ManagedServerDNSAliasProperties = &managedServerDNSAliasProperties } case "id": if v != nil { @@ -19029,7 +21202,7 @@ func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) e if err != nil { return err } - miva.ID = &ID + msda.ID = &ID } case "name": if v != nil { @@ -19038,7 +21211,7 @@ func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) e if err != nil { return err } - miva.Name = &name + msda.Name = &name } case "type": if v != nil { @@ -19047,7 +21220,7 @@ func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) e if err != nil { return err } - miva.Type = &typeVar + msda.Type = &typeVar } } } @@ -19055,34 +21228,168 @@ func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) e return nil } -// ManagedInstanceVulnerabilityAssessmentListResult a list of the ManagedInstance's vulnerability -// assessments. -type ManagedInstanceVulnerabilityAssessmentListResult struct { +// ManagedServerDNSAliasAcquisition a managed server DNS alias acquisition request. +type ManagedServerDNSAliasAcquisition struct { + // OldManagedServerDNSAliasResourceID - The resource ID of the managed server DNS alias that will be acquired to point to this managed server instead. + OldManagedServerDNSAliasResourceID *string `json:"oldManagedServerDnsAliasResourceId,omitempty"` +} + +// ManagedServerDNSAliasCreation a managed server dns alias creation request. +type ManagedServerDNSAliasCreation struct { + // CreateDNSRecord - Whether or not DNS record should be created for this alias. + CreateDNSRecord *bool `json:"createDnsRecord,omitempty"` +} + +// ManagedServerDNSAliasesAcquireFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedServerDNSAliasesAcquireFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedServerDNSAliasesClient) (ManagedServerDNSAlias, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedServerDNSAliasesAcquireFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedServerDNSAliasesAcquireFuture.Result. +func (future *ManagedServerDNSAliasesAcquireFuture) result(client ManagedServerDNSAliasesClient) (msda ManagedServerDNSAlias, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesAcquireFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + msda.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedServerDNSAliasesAcquireFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if msda.Response.Response, err = future.GetResult(sender); err == nil && msda.Response.Response.StatusCode != http.StatusNoContent { + msda, err = client.AcquireResponder(msda.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesAcquireFuture", "Result", msda.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedServerDNSAliasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ManagedServerDNSAliasesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedServerDNSAliasesClient) (ManagedServerDNSAlias, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedServerDNSAliasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedServerDNSAliasesCreateOrUpdateFuture.Result. +func (future *ManagedServerDNSAliasesCreateOrUpdateFuture) result(client ManagedServerDNSAliasesClient) (msda ManagedServerDNSAlias, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + msda.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedServerDNSAliasesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if msda.Response.Response, err = future.GetResult(sender); err == nil && msda.Response.Response.StatusCode != http.StatusNoContent { + msda, err = client.CreateOrUpdateResponder(msda.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesCreateOrUpdateFuture", "Result", msda.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedServerDNSAliasesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedServerDNSAliasesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedServerDNSAliasesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedServerDNSAliasesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedServerDNSAliasesDeleteFuture.Result. +func (future *ManagedServerDNSAliasesDeleteFuture) result(client ManagedServerDNSAliasesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ManagedServerDNSAliasesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ManagedServerDNSAliasesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedServerDNSAliasListResult a list of managed server DNS aliases. +type ManagedServerDNSAliasListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]ManagedInstanceVulnerabilityAssessment `json:"value,omitempty"` + Value *[]ManagedServerDNSAlias `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessmentListResult. -func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ManagedServerDNSAliasListResult. +func (msdalr ManagedServerDNSAliasListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// ManagedInstanceVulnerabilityAssessmentListResultIterator provides access to a complete listing of -// ManagedInstanceVulnerabilityAssessment values. -type ManagedInstanceVulnerabilityAssessmentListResultIterator struct { +// ManagedServerDNSAliasListResultIterator provides access to a complete listing of ManagedServerDNSAlias +// values. +type ManagedServerDNSAliasListResultIterator struct { i int - page ManagedInstanceVulnerabilityAssessmentListResultPage + page ManagedServerDNSAliasListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ManagedServerDNSAliasListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerDNSAliasListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -19107,68 +21414,67 @@ func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) NextWithCo // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) Next() error { +func (iter *ManagedServerDNSAliasListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) NotDone() bool { +func (iter ManagedServerDNSAliasListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) Response() ManagedInstanceVulnerabilityAssessmentListResult { +func (iter ManagedServerDNSAliasListResultIterator) Response() ManagedServerDNSAliasListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) Value() ManagedInstanceVulnerabilityAssessment { +func (iter ManagedServerDNSAliasListResultIterator) Value() ManagedServerDNSAlias { if !iter.page.NotDone() { - return ManagedInstanceVulnerabilityAssessment{} + return ManagedServerDNSAlias{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultIterator type. -func NewManagedInstanceVulnerabilityAssessmentListResultIterator(page ManagedInstanceVulnerabilityAssessmentListResultPage) ManagedInstanceVulnerabilityAssessmentListResultIterator { - return ManagedInstanceVulnerabilityAssessmentListResultIterator{page: page} +// Creates a new instance of the ManagedServerDNSAliasListResultIterator type. +func NewManagedServerDNSAliasListResultIterator(page ManagedServerDNSAliasListResultPage) ManagedServerDNSAliasListResultIterator { + return ManagedServerDNSAliasListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) IsEmpty() bool { - return mivalr.Value == nil || len(*mivalr.Value) == 0 +func (msdalr ManagedServerDNSAliasListResult) IsEmpty() bool { + return msdalr.Value == nil || len(*msdalr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) hasNextLink() bool { - return mivalr.NextLink != nil && len(*mivalr.NextLink) != 0 +func (msdalr ManagedServerDNSAliasListResult) hasNextLink() bool { + return msdalr.NextLink != nil && len(*msdalr.NextLink) != 0 } -// managedInstanceVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. +// managedServerDNSAliasListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) managedInstanceVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mivalr.hasNextLink() { +func (msdalr ManagedServerDNSAliasListResult) managedServerDNSAliasListResultPreparer(ctx context.Context) (*http.Request, error) { + if !msdalr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(mivalr.NextLink))) + autorest.WithBaseURL(to.String(msdalr.NextLink))) } -// ManagedInstanceVulnerabilityAssessmentListResultPage contains a page of -// ManagedInstanceVulnerabilityAssessment values. -type ManagedInstanceVulnerabilityAssessmentListResultPage struct { - fn func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error) - mivalr ManagedInstanceVulnerabilityAssessmentListResult +// ManagedServerDNSAliasListResultPage contains a page of ManagedServerDNSAlias values. +type ManagedServerDNSAliasListResultPage struct { + fn func(context.Context, ManagedServerDNSAliasListResult) (ManagedServerDNSAliasListResult, error) + msdalr ManagedServerDNSAliasListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ManagedServerDNSAliasListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedServerDNSAliasListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -19178,11 +21484,11 @@ func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) NextWithContex }() } for { - next, err := page.fn(ctx, page.mivalr) + next, err := page.fn(ctx, page.msdalr) if err != nil { return err } - page.mivalr = next + page.msdalr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -19193,133 +21499,46 @@ func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) NextWithContex // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) Next() error { +func (page *ManagedServerDNSAliasListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedInstanceVulnerabilityAssessmentListResultPage) NotDone() bool { - return !page.mivalr.IsEmpty() +func (page ManagedServerDNSAliasListResultPage) NotDone() bool { + return !page.msdalr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Response() ManagedInstanceVulnerabilityAssessmentListResult { - return page.mivalr +func (page ManagedServerDNSAliasListResultPage) Response() ManagedServerDNSAliasListResult { + return page.msdalr } // Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Values() []ManagedInstanceVulnerabilityAssessment { - if page.mivalr.IsEmpty() { +func (page ManagedServerDNSAliasListResultPage) Values() []ManagedServerDNSAlias { + if page.msdalr.IsEmpty() { return nil } - return *page.mivalr.Value + return *page.msdalr.Value } -// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultPage type. -func NewManagedInstanceVulnerabilityAssessmentListResultPage(cur ManagedInstanceVulnerabilityAssessmentListResult, getNextPage func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error)) ManagedInstanceVulnerabilityAssessmentListResultPage { - return ManagedInstanceVulnerabilityAssessmentListResultPage{ +// Creates a new instance of the ManagedServerDNSAliasListResultPage type. +func NewManagedServerDNSAliasListResultPage(cur ManagedServerDNSAliasListResult, getNextPage func(context.Context, ManagedServerDNSAliasListResult) (ManagedServerDNSAliasListResult, error)) ManagedServerDNSAliasListResultPage { + return ManagedServerDNSAliasListResultPage{ fn: getNextPage, - mivalr: cur, - } -} - -// ManagedInstanceVulnerabilityAssessmentProperties properties of a managed instance vulnerability -// assessment. -type ManagedInstanceVulnerabilityAssessmentProperties struct { - // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - // StorageContainerSasKey - A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet or a firewall - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RecurringScans - The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` -} - -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for -// monitoring and retrieving the results of a long-running operation. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. -func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mbstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { - mbstrp, err = client.CreateOrUpdateResponder(mbstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture an abstraction for -// monitoring and retrieving the results of a long-running operation. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture.Result. -func (future *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture) result(client ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mbstrp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture") - return + msdalr: cur, } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { - mbstrp, err = client.UpdateResponder(mbstrp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") - } - } - return +} + +// ManagedServerDNSAliasProperties properties of a managed server DNS alias. +type ManagedServerDNSAliasProperties struct { + // AzureDNSRecord - READ-ONLY; The fully qualified DNS record for managed server alias + AzureDNSRecord *string `json:"azureDnsRecord,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedServerDNSAliasProperties. +func (msdap ManagedServerDNSAliasProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) } // ManagedServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the @@ -20064,301 +22283,64 @@ func (o Operation) MarshalJSON() ([]byte, error) { type OperationDisplay struct { // Provider - READ-ONLY; The localized friendly form of the resource provider name. Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; The localized friendly name for the operation. - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; The localized friendly description for the operation. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationImpact the impact of an operation, both in absolute and relative terms. -type OperationImpact struct { - // Name - READ-ONLY; The name of the impact dimension. - Name *string `json:"name,omitempty"` - // Unit - READ-ONLY; The unit in which estimated impact to dimension is measured. - Unit *string `json:"unit,omitempty"` - // ChangeValueAbsolute - READ-ONLY; The absolute impact to dimension. - ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` - // ChangeValueRelative - READ-ONLY; The relative impact to dimension (null if not applicable) - ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationImpact. -func (oi OperationImpact) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult result of the request to list SQL operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationsHealth operations health status in a location. -type OperationsHealth struct { - // OperationsHealthProperties - Resource properties. - *OperationsHealthProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationsHealth. -func (oh OperationsHealth) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oh.OperationsHealthProperties != nil { - objectMap["properties"] = oh.OperationsHealthProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationsHealth struct. -func (oh *OperationsHealth) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var operationsHealthProperties OperationsHealthProperties - err = json.Unmarshal(*v, &operationsHealthProperties) - if err != nil { - return err - } - oh.OperationsHealthProperties = &operationsHealthProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - oh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - oh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - oh.Type = &typeVar - } - } - } + // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; The localized friendly name for the operation. + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; The localized friendly description for the operation. + Description *string `json:"description,omitempty"` +} - return nil +// MarshalJSON is the custom marshaler for OperationDisplay. +func (od OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationImpact the impact of an operation, both in absolute and relative terms. +type OperationImpact struct { + // Name - READ-ONLY; The name of the impact dimension. + Name *string `json:"name,omitempty"` + // Unit - READ-ONLY; The unit in which estimated impact to dimension is measured. + Unit *string `json:"unit,omitempty"` + // ChangeValueAbsolute - READ-ONLY; The absolute impact to dimension. + ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` + // ChangeValueRelative - READ-ONLY; The relative impact to dimension (null if not applicable) + ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` } -// OperationsHealthListResult a list of service health statuses in a location. -type OperationsHealthListResult struct { +// MarshalJSON is the custom marshaler for OperationImpact. +func (oi OperationImpact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResult result of the request to list SQL operations. +type OperationListResult struct { autorest.Response `json:"-"` // Value - READ-ONLY; Array of results. - Value *[]OperationsHealth `json:"value,omitempty"` + Value *[]Operation `json:"value,omitempty"` // NextLink - READ-ONLY; Link to retrieve next page of results. NextLink *string `json:"nextLink,omitempty"` } -// MarshalJSON is the custom marshaler for OperationsHealthListResult. -func (ohlr OperationsHealthListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// OperationsHealthListResultIterator provides access to a complete listing of OperationsHealth values. -type OperationsHealthListResultIterator struct { +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { i int - page OperationsHealthListResultPage + page OperationListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *OperationsHealthListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsHealthListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -20383,67 +22365,67 @@ func (iter *OperationsHealthListResultIterator) NextWithContext(ctx context.Cont // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *OperationsHealthListResultIterator) Next() error { +func (iter *OperationListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationsHealthListResultIterator) NotDone() bool { +func (iter OperationListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter OperationsHealthListResultIterator) Response() OperationsHealthListResult { +func (iter OperationListResultIterator) Response() OperationListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter OperationsHealthListResultIterator) Value() OperationsHealth { +func (iter OperationListResultIterator) Value() Operation { if !iter.page.NotDone() { - return OperationsHealth{} + return Operation{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the OperationsHealthListResultIterator type. -func NewOperationsHealthListResultIterator(page OperationsHealthListResultPage) OperationsHealthListResultIterator { - return OperationsHealthListResultIterator{page: page} +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (ohlr OperationsHealthListResult) IsEmpty() bool { - return ohlr.Value == nil || len(*ohlr.Value) == 0 +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 } // hasNextLink returns true if the NextLink is not empty. -func (ohlr OperationsHealthListResult) hasNextLink() bool { - return ohlr.NextLink != nil && len(*ohlr.NextLink) != 0 +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 } -// operationsHealthListResultPreparer prepares a request to retrieve the next set of results. +// operationListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (ohlr OperationsHealthListResult) operationsHealthListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ohlr.hasNextLink() { +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(ohlr.NextLink))) + autorest.WithBaseURL(to.String(olr.NextLink))) } -// OperationsHealthListResultPage contains a page of OperationsHealth values. -type OperationsHealthListResultPage struct { - fn func(context.Context, OperationsHealthListResult) (OperationsHealthListResult, error) - ohlr OperationsHealthListResult +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *OperationsHealthListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsHealthListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -20453,11 +22435,11 @@ func (page *OperationsHealthListResultPage) NextWithContext(ctx context.Context) }() } for { - next, err := page.fn(ctx, page.ohlr) + next, err := page.fn(ctx, page.olr) if err != nil { return err } - page.ohlr = next + page.olr = next if !next.hasNextLink() || !next.IsEmpty() { break } @@ -20468,52 +22450,36 @@ func (page *OperationsHealthListResultPage) NextWithContext(ctx context.Context) // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *OperationsHealthListResultPage) Next() error { +func (page *OperationListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationsHealthListResultPage) NotDone() bool { - return !page.ohlr.IsEmpty() +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page OperationsHealthListResultPage) Response() OperationsHealthListResult { - return page.ohlr +func (page OperationListResultPage) Response() OperationListResult { + return page.olr } // Values returns the slice of values for the current page or nil if there are no values. -func (page OperationsHealthListResultPage) Values() []OperationsHealth { - if page.ohlr.IsEmpty() { +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { return nil } - return *page.ohlr.Value + return *page.olr.Value } -// Creates a new instance of the OperationsHealthListResultPage type. -func NewOperationsHealthListResultPage(cur OperationsHealthListResult, getNextPage func(context.Context, OperationsHealthListResult) (OperationsHealthListResult, error)) OperationsHealthListResultPage { - return OperationsHealthListResultPage{ - fn: getNextPage, - ohlr: cur, +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, } } -// OperationsHealthProperties properties of an operation health. -type OperationsHealthProperties struct { - // Name - READ-ONLY; Operation name for the service - Name *string `json:"name,omitempty"` - // Health - READ-ONLY; Operation health status of the service. - Health *string `json:"health,omitempty"` - // Description - READ-ONLY; Health status description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationsHealthProperties. -func (ohp OperationsHealthProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - // OutboundFirewallRule an Azure SQL DB Server Outbound Firewall Rule. type OutboundFirewallRule struct { autorest.Response `json:"-"` @@ -22646,7 +24612,7 @@ type ReplicationLinksFailoverAllowDataLossFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) + Result func(ReplicationLinksClient) (ReplicationLink, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. @@ -22661,7 +24627,7 @@ func (future *ReplicationLinksFailoverAllowDataLossFuture) UnmarshalJSON(body [] } // result is the default implementation for ReplicationLinksFailoverAllowDataLossFuture.Result. -func (future *ReplicationLinksFailoverAllowDataLossFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { +func (future *ReplicationLinksFailoverAllowDataLossFuture) result(client ReplicationLinksClient) (rl ReplicationLink, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { @@ -22669,11 +24635,17 @@ func (future *ReplicationLinksFailoverAllowDataLossFuture) result(client Replica return } if !done { - ar.Response = future.Response() + rl.Response.Response = future.Response() err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverAllowDataLossFuture") return } - ar.Response = future.Response() + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rl.Response.Response, err = future.GetResult(sender); err == nil && rl.Response.Response.StatusCode != http.StatusNoContent { + rl, err = client.FailoverAllowDataLossResponder(rl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", rl.Response.Response, "Failure responding to request") + } + } return } @@ -22683,7 +24655,7 @@ type ReplicationLinksFailoverFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) + Result func(ReplicationLinksClient) (ReplicationLink, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. @@ -22698,7 +24670,7 @@ func (future *ReplicationLinksFailoverFuture) UnmarshalJSON(body []byte) error { } // result is the default implementation for ReplicationLinksFailoverFuture.Result. -func (future *ReplicationLinksFailoverFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { +func (future *ReplicationLinksFailoverFuture) result(client ReplicationLinksClient) (rl ReplicationLink, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { @@ -22706,48 +24678,17 @@ func (future *ReplicationLinksFailoverFuture) result(client ReplicationLinksClie return } if !done { - ar.Response = future.Response() + rl.Response.Response = future.Response() err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverFuture") return } - ar.Response = future.Response() - return -} - -// ReplicationLinksUnlinkFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicationLinksUnlinkFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ReplicationLinksClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ReplicationLinksUnlinkFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ReplicationLinksUnlinkFuture.Result. -func (future *ReplicationLinksUnlinkFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksUnlinkFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksUnlinkFuture") - return + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rl.Response.Response, err = future.GetResult(sender); err == nil && rl.Response.Response.StatusCode != http.StatusNoContent { + rl, err = client.FailoverResponder(rl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", rl.Response.Response, "Failure responding to request") + } } - ar.Response = future.Response() return } @@ -22773,7 +24714,7 @@ type ResourceIdentity struct { UserAssignedIdentities map[string]*UserIdentity `json:"userAssignedIdentities"` // PrincipalID - READ-ONLY; The Azure Active Directory principal id. PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // 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: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned' + // 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: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' Type IdentityType `json:"type,omitempty"` // TenantID - READ-ONLY; The Azure Active Directory tenant id. TenantID *uuid.UUID `json:"tenantId,omitempty"` @@ -22791,30 +24732,6 @@ func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ResourceIdentityWithUserAssignedIdentities azure Active Directory identity configuration for a resource. -type ResourceIdentityWithUserAssignedIdentities struct { - // UserAssignedIdentities - The resource ids of the user assigned identities to use - UserAssignedIdentities map[string]*UserIdentity `json:"userAssignedIdentities"` - // PrincipalID - READ-ONLY; The Azure Active Directory principal id. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // 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: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned' - Type IdentityType `json:"type,omitempty"` - // TenantID - READ-ONLY; The Azure Active Directory tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceIdentityWithUserAssignedIdentities. -func (riwuai ResourceIdentityWithUserAssignedIdentities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if riwuai.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = riwuai.UserAssignedIdentities - } - if riwuai.Type != "" { - objectMap["type"] = riwuai.Type - } - return json.Marshal(objectMap) -} - // ResourceMoveDefinition contains the information necessary to perform a resource move (rename). type ResourceMoveDefinition struct { // ID - The target ID for the resource @@ -23127,16 +25044,14 @@ type RestorableDroppedDatabaseProperties struct { DatabaseName *string `json:"databaseName,omitempty"` // MaxSizeBytes - READ-ONLY; The max size of the database expressed in bytes. MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` - // ElasticPoolID - READ-ONLY; DEPRECATED: The resource name of the elastic pool containing this database. This property is deprecated and the value will always be null. - ElasticPoolID *string `json:"elasticPoolId,omitempty"` // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). CreationDate *date.Time `json:"creationDate,omitempty"` // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format). DeletionDate *date.Time `json:"deletionDate,omitempty"` // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format). EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // BackupStorageRedundancy - READ-ONLY; The storage account type used to store backups for this database. Possible values include: 'BackupStorageRedundancy1Geo', 'BackupStorageRedundancy1Local', 'BackupStorageRedundancy1Zone' - BackupStorageRedundancy BackupStorageRedundancy1 `json:"backupStorageRedundancy,omitempty"` + // BackupStorageRedundancy - READ-ONLY; The storage account type used to store backups for this database. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + BackupStorageRedundancy BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty"` } // MarshalJSON is the custom marshaler for RestorableDroppedDatabaseProperties. @@ -25570,14 +27485,57 @@ func (future *ServerCommunicationLinksCreateOrUpdateFuture) result(client Server return } -// ServerConnectionPolicy a server secure connection policy. +// ServerConnectionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ServerConnectionPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServerConnectionPoliciesClient) (ServerConnectionPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServerConnectionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServerConnectionPoliciesCreateOrUpdateFuture.Result. +func (future *ServerConnectionPoliciesCreateOrUpdateFuture) result(client ServerConnectionPoliciesClient) (scp ServerConnectionPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + scp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ServerConnectionPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if scp.Response.Response, err = future.GetResult(sender); err == nil && scp.Response.Response.StatusCode != http.StatusNoContent { + scp, err = client.CreateOrUpdateResponder(scp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesCreateOrUpdateFuture", "Result", scp.Response.Response, "Failure responding to request") + } + } + return +} + +// ServerConnectionPolicy a server connection policy type ServerConnectionPolicy struct { autorest.Response `json:"-"` - // Kind - READ-ONLY; Metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty"` // Location - READ-ONLY; Resource location. Location *string `json:"location,omitempty"` - // ServerConnectionPolicyProperties - The properties of the server secure connection policy. + // Kind - READ-ONLY; Metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // ServerConnectionPolicyProperties - Resource properties. *ServerConnectionPolicyProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` @@ -25605,23 +27563,23 @@ func (scp *ServerConnectionPolicy) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "kind": + case "location": if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) + var location string + err = json.Unmarshal(*v, &location) if err != nil { return err } - scp.Kind = &kind + scp.Location = &location } - case "location": + case "kind": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var kind string + err = json.Unmarshal(*v, &kind) if err != nil { return err } - scp.Location = &location + scp.Kind = &kind } case "properties": if v != nil { @@ -25661,13 +27619,179 @@ func (scp *ServerConnectionPolicy) UnmarshalJSON(body []byte) error { } } } - + + return nil +} + +// ServerConnectionPolicyListResult a list of server connection policy objects. +type ServerConnectionPolicyListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ServerConnectionPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerConnectionPolicyListResult. +func (scplr ServerConnectionPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServerConnectionPolicyListResultIterator provides access to a complete listing of ServerConnectionPolicy +// values. +type ServerConnectionPolicyListResultIterator struct { + i int + page ServerConnectionPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServerConnectionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServerConnectionPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServerConnectionPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServerConnectionPolicyListResultIterator) Response() ServerConnectionPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServerConnectionPolicyListResultIterator) Value() ServerConnectionPolicy { + if !iter.page.NotDone() { + return ServerConnectionPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServerConnectionPolicyListResultIterator type. +func NewServerConnectionPolicyListResultIterator(page ServerConnectionPolicyListResultPage) ServerConnectionPolicyListResultIterator { + return ServerConnectionPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (scplr ServerConnectionPolicyListResult) IsEmpty() bool { + return scplr.Value == nil || len(*scplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (scplr ServerConnectionPolicyListResult) hasNextLink() bool { + return scplr.NextLink != nil && len(*scplr.NextLink) != 0 +} + +// serverConnectionPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (scplr ServerConnectionPolicyListResult) serverConnectionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !scplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(scplr.NextLink))) +} + +// ServerConnectionPolicyListResultPage contains a page of ServerConnectionPolicy values. +type ServerConnectionPolicyListResultPage struct { + fn func(context.Context, ServerConnectionPolicyListResult) (ServerConnectionPolicyListResult, error) + scplr ServerConnectionPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServerConnectionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.scplr) + if err != nil { + return err + } + page.scplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } return nil } -// ServerConnectionPolicyProperties the properties of a server secure connection policy. +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServerConnectionPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServerConnectionPolicyListResultPage) NotDone() bool { + return !page.scplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServerConnectionPolicyListResultPage) Response() ServerConnectionPolicyListResult { + return page.scplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServerConnectionPolicyListResultPage) Values() []ServerConnectionPolicy { + if page.scplr.IsEmpty() { + return nil + } + return *page.scplr.Value +} + +// Creates a new instance of the ServerConnectionPolicyListResultPage type. +func NewServerConnectionPolicyListResultPage(cur ServerConnectionPolicyListResult, getNextPage func(context.Context, ServerConnectionPolicyListResult) (ServerConnectionPolicyListResult, error)) ServerConnectionPolicyListResultPage { + return ServerConnectionPolicyListResultPage{ + fn: getNextPage, + scplr: cur, + } +} + +// ServerConnectionPolicyProperties the properties of a server connection policy. type ServerConnectionPolicyProperties struct { - // ConnectionType - The server connection type. Possible values include: 'ServerConnectionTypeDefault', 'ServerConnectionTypeProxy', 'ServerConnectionTypeRedirect' + // ConnectionType - The server connection type. Possible values include: 'ServerConnectionTypeDefault', 'ServerConnectionTypeRedirect', 'ServerConnectionTypeProxy' ConnectionType ServerConnectionType `json:"connectionType,omitempty"` } @@ -27286,20 +29410,227 @@ func (sp ServerProperties) MarshalJSON() ([]byte, error) { if sp.RestrictOutboundNetworkAccess != "" { objectMap["restrictOutboundNetworkAccess"] = sp.RestrictOutboundNetworkAccess } - return json.Marshal(objectMap) + return json.Marshal(objectMap) +} + +// ServersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServersClient) (Server, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServersCreateOrUpdateFuture.Result. +func (future *ServersCreateOrUpdateFuture) result(client ServersClient) (s Server, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ServersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServersDeleteFuture.Result. +func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ServersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. +func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { + ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") + } + } + return +} + +// ServerSecurityAlertPolicy a server security alert policy. +type ServerSecurityAlertPolicy struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; SystemData of SecurityAlertPolicyResource. + SystemData *SystemData `json:"systemData,omitempty"` + // SecurityAlertsPolicyProperties - Resource properties. + *SecurityAlertsPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. +func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssap.SecurityAlertsPolicyProperties != nil { + objectMap["properties"] = ssap.SecurityAlertsPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. +func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ssap.SystemData = &systemData + } + case "properties": + if v != nil { + var securityAlertsPolicyProperties SecurityAlertsPolicyProperties + err = json.Unmarshal(*v, &securityAlertsPolicyProperties) + if err != nil { + return err + } + ssap.SecurityAlertsPolicyProperties = &securityAlertsPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssap.Type = &typeVar + } + } + } + + return nil } -// ServersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// ServersImportDatabaseFuture an abstraction for monitoring and retrieving the results of a long-running // operation. -type ServersCreateOrUpdateFuture struct { +type ServersImportDatabaseFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) + Result func(ServersClient) (ImportExportOperationResult, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ServersImportDatabaseFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -27309,77 +29640,40 @@ func (future *ServersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { return nil } -// result is the default implementation for ServersCreateOrUpdateFuture.Result. -func (future *ServersCreateOrUpdateFuture) result(client ServersClient) (s Server, err error) { +// result is the default implementation for ServersImportDatabaseFuture.Result. +func (future *ServersImportDatabaseFuture) result(client ServersClient) (ieor ImportExportOperationResult, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ServersImportDatabaseFuture", "Result", future.Response(), "Polling failure") return } if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersCreateOrUpdateFuture") + ieor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ServersImportDatabaseFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateOrUpdateResponder(s.Response.Response) + if ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent { + ieor, err = client.ImportDatabaseResponder(ieor.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ServersImportDatabaseFuture", "Result", ieor.Response.Response, "Failure responding to request") } } return } -// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. -type ServersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersDeleteFuture.Result. -func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { +type ServersUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error) + Result func(ServersClient) (Server, error) } // UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { +func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { var azFuture azure.Future if err := json.Unmarshal(body, &azFuture); err != nil { return err @@ -27389,36 +29683,35 @@ func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(bod return nil } -// result is the default implementation for ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { +// result is the default implementation for ServersUpdateFuture.Result. +func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - ssap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture") + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ServersUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { - ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.UpdateResponder(s.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } } return } -// ServerSecurityAlertPolicy a server security alert policy. -type ServerSecurityAlertPolicy struct { +// ServerTrustCertificate server trust certificate imported from box to enable connection between box and +// Sql Managed Instance. +type ServerTrustCertificate struct { autorest.Response `json:"-"` - // SystemData - READ-ONLY; SystemData of SecurityAlertPolicyResource. - SystemData *SystemData `json:"systemData,omitempty"` - // SecurityAlertsPolicyProperties - Resource properties. - *SecurityAlertsPolicyProperties `json:"properties,omitempty"` + // ServerTrustCertificateProperties - Resource properties. + *ServerTrustCertificateProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name. @@ -27427,17 +29720,17 @@ type ServerSecurityAlertPolicy struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. -func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ServerTrustCertificate. +func (stc ServerTrustCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ssap.SecurityAlertsPolicyProperties != nil { - objectMap["properties"] = ssap.SecurityAlertsPolicyProperties + if stc.ServerTrustCertificateProperties != nil { + objectMap["properties"] = stc.ServerTrustCertificateProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. -func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ServerTrustCertificate struct. +func (stc *ServerTrustCertificate) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -27445,23 +29738,14 @@ func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ssap.SystemData = &systemData - } case "properties": if v != nil { - var securityAlertsPolicyProperties SecurityAlertsPolicyProperties - err = json.Unmarshal(*v, &securityAlertsPolicyProperties) + var serverTrustCertificateProperties ServerTrustCertificateProperties + err = json.Unmarshal(*v, &serverTrustCertificateProperties) if err != nil { return err } - ssap.SecurityAlertsPolicyProperties = &securityAlertsPolicyProperties + stc.ServerTrustCertificateProperties = &serverTrustCertificateProperties } case "id": if v != nil { @@ -27470,7 +29754,7 @@ func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - ssap.ID = &ID + stc.ID = &ID } case "name": if v != nil { @@ -27479,7 +29763,7 @@ func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - ssap.Name = &name + stc.Name = &name } case "type": if v != nil { @@ -27488,7 +29772,7 @@ func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - ssap.Type = &typeVar + stc.Type = &typeVar } } } @@ -27496,90 +29780,269 @@ func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { return nil } -// ServersImportDatabaseFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersImportDatabaseFuture struct { +// ServerTrustCertificateProperties the properties of a server trust certificate. +type ServerTrustCertificateProperties struct { + // PublicBlob - The certificate public blob + PublicBlob *string `json:"publicBlob,omitempty"` + // Thumbprint - READ-ONLY; The certificate thumbprint + Thumbprint *string `json:"thumbprint,omitempty"` + // CertificateName - READ-ONLY; The certificate name + CertificateName *string `json:"certificateName,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerTrustCertificateProperties. +func (stcp ServerTrustCertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if stcp.PublicBlob != nil { + objectMap["publicBlob"] = stcp.PublicBlob + } + return json.Marshal(objectMap) +} + +// ServerTrustCertificatesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ServerTrustCertificatesCreateOrUpdateFuture struct { azure.FutureAPI // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. - Result func(ServersClient) (ImportExportOperationResult, error) + Result func(ServerTrustCertificatesClient) (ServerTrustCertificate, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServerTrustCertificatesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServerTrustCertificatesCreateOrUpdateFuture.Result. +func (future *ServerTrustCertificatesCreateOrUpdateFuture) result(client ServerTrustCertificatesClient) (stc ServerTrustCertificate, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + stc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ServerTrustCertificatesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if stc.Response.Response, err = future.GetResult(sender); err == nil && stc.Response.Response.StatusCode != http.StatusNoContent { + stc, err = client.CreateOrUpdateResponder(stc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesCreateOrUpdateFuture", "Result", stc.Response.Response, "Failure responding to request") + } + } + return +} + +// ServerTrustCertificatesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServerTrustCertificatesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServerTrustCertificatesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServerTrustCertificatesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServerTrustCertificatesDeleteFuture.Result. +func (future *ServerTrustCertificatesDeleteFuture) result(client ServerTrustCertificatesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("sql.ServerTrustCertificatesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServerTrustCertificatesListResult a list of server trust certificates in instance. +type ServerTrustCertificatesListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ServerTrustCertificate `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerTrustCertificatesListResult. +func (stclr ServerTrustCertificatesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServerTrustCertificatesListResultIterator provides access to a complete listing of +// ServerTrustCertificate values. +type ServerTrustCertificatesListResultIterator struct { + i int + page ServerTrustCertificatesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServerTrustCertificatesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustCertificatesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServerTrustCertificatesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServerTrustCertificatesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServerTrustCertificatesListResultIterator) Response() ServerTrustCertificatesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServerTrustCertificatesListResultIterator) Value() ServerTrustCertificate { + if !iter.page.NotDone() { + return ServerTrustCertificate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServerTrustCertificatesListResultIterator type. +func NewServerTrustCertificatesListResultIterator(page ServerTrustCertificatesListResultPage) ServerTrustCertificatesListResultIterator { + return ServerTrustCertificatesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (stclr ServerTrustCertificatesListResult) IsEmpty() bool { + return stclr.Value == nil || len(*stclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (stclr ServerTrustCertificatesListResult) hasNextLink() bool { + return stclr.NextLink != nil && len(*stclr.NextLink) != 0 } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersImportDatabaseFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err +// serverTrustCertificatesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (stclr ServerTrustCertificatesListResult) serverTrustCertificatesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !stclr.hasNextLink() { + return nil, nil } - future.FutureAPI = &azFuture - future.Result = future.result - return nil + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(stclr.NextLink))) } -// result is the default implementation for ServersImportDatabaseFuture.Result. -func (future *ServersImportDatabaseFuture) result(client ServersClient) (ieor ImportExportOperationResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersImportDatabaseFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ieor.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersImportDatabaseFuture") - return +// ServerTrustCertificatesListResultPage contains a page of ServerTrustCertificate values. +type ServerTrustCertificatesListResultPage struct { + fn func(context.Context, ServerTrustCertificatesListResult) (ServerTrustCertificatesListResult, error) + stclr ServerTrustCertificatesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServerTrustCertificatesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustCertificatesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent { - ieor, err = client.ImportDatabaseResponder(ieor.Response.Response) + for { + next, err := page.fn(ctx, page.stclr) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersImportDatabaseFuture", "Result", ieor.Response.Response, "Failure responding to request") + return err + } + page.stclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break } } - return + return nil } -// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServerTrustCertificatesListResultPage) Next() error { + return page.NextWithContext(context.Background()) } -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServerTrustCertificatesListResultPage) NotDone() bool { + return !page.stclr.IsEmpty() } -// result is the default implementation for ServersUpdateFuture.Result. -func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sql.ServersUpdateFuture") - return +// Response returns the raw server response from the last page request. +func (page ServerTrustCertificatesListResultPage) Response() ServerTrustCertificatesListResult { + return page.stclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServerTrustCertificatesListResultPage) Values() []ServerTrustCertificate { + if page.stclr.IsEmpty() { + return nil } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } + return *page.stclr.Value +} + +// Creates a new instance of the ServerTrustCertificatesListResultPage type. +func NewServerTrustCertificatesListResultPage(cur ServerTrustCertificatesListResult, getNextPage func(context.Context, ServerTrustCertificatesListResult) (ServerTrustCertificatesListResult, error)) ServerTrustCertificatesListResultPage { + return ServerTrustCertificatesListResultPage{ + fn: getNextPage, + stclr: cur, } - return } // ServerTrustGroup a server trust group. @@ -28421,6 +30884,27 @@ func (sop ServiceObjectiveProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ServicePrincipal the managed instance's service principal configuration for a resource. +type ServicePrincipal struct { + // PrincipalID - READ-ONLY; The Azure Active Directory application object id. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The Azure Active Directory application client id. + ClientID *string `json:"clientId,omitempty"` + // TenantID - READ-ONLY; The Azure Active Directory tenant id. + TenantID *string `json:"tenantId,omitempty"` + // Type - Service principal type. Possible values include: 'ServicePrincipalTypeNone', 'ServicePrincipalTypeSystemAssigned' + Type ServicePrincipalType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipal. +func (sp ServicePrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.Type != "" { + objectMap["type"] = sp.Type + } + return json.Marshal(objectMap) +} + // Sku an ARM Resource SKU. type Sku struct { // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. @@ -28453,8 +30937,8 @@ func (sum SloUsageMetric) MarshalJSON() ([]byte, error) { // StorageCapability the storage account type capability. type StorageCapability struct { - // StorageAccountType - READ-ONLY; The storage account type for the database's backups. Possible values include: 'StorageAccountType1GRS', 'StorageAccountType1LRS', 'StorageAccountType1ZRS' - StorageAccountType StorageAccountType1 `json:"storageAccountType,omitempty"` + // StorageAccountType - READ-ONLY; The storage account type for the database's backups. Possible values include: 'StorageAccountTypeGRS', 'StorageAccountTypeLRS', 'StorageAccountTypeZRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' Status CapabilityStatus `json:"status,omitempty"` // Reason - The reason for the capability not being available. @@ -31497,206 +33981,10 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// TransparentDataEncryption represents a database transparent data encryption configuration. -type TransparentDataEncryption struct { - autorest.Response `json:"-"` - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // TransparentDataEncryptionProperties - Represents the properties of the resource. - *TransparentDataEncryptionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryption. -func (tde TransparentDataEncryption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tde.TransparentDataEncryptionProperties != nil { - objectMap["properties"] = tde.TransparentDataEncryptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryption struct. -func (tde *TransparentDataEncryption) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tde.Location = &location - } - case "properties": - if v != nil { - var transparentDataEncryptionProperties TransparentDataEncryptionProperties - err = json.Unmarshal(*v, &transparentDataEncryptionProperties) - if err != nil { - return err - } - tde.TransparentDataEncryptionProperties = &transparentDataEncryptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tde.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tde.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tde.Type = &typeVar - } - } - } - - return nil -} - -// TransparentDataEncryptionActivity represents a database transparent data encryption Scan. -type TransparentDataEncryptionActivity struct { - // Location - READ-ONLY; Resource location. - Location *string `json:"location,omitempty"` - // TransparentDataEncryptionActivityProperties - Represents the properties of the resource. - *TransparentDataEncryptionActivityProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryptionActivity. -func (tdea TransparentDataEncryptionActivity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tdea.TransparentDataEncryptionActivityProperties != nil { - objectMap["properties"] = tdea.TransparentDataEncryptionActivityProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryptionActivity struct. -func (tdea *TransparentDataEncryptionActivity) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - tdea.Location = &location - } - case "properties": - if v != nil { - var transparentDataEncryptionActivityProperties TransparentDataEncryptionActivityProperties - err = json.Unmarshal(*v, &transparentDataEncryptionActivityProperties) - if err != nil { - return err - } - tdea.TransparentDataEncryptionActivityProperties = &transparentDataEncryptionActivityProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tdea.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tdea.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tdea.Type = &typeVar - } - } - } - - return nil -} - -// TransparentDataEncryptionActivityListResult represents the response to a list database transparent data -// encryption activity request. -type TransparentDataEncryptionActivityListResult struct { - autorest.Response `json:"-"` - // Value - The list of database transparent data encryption activities. - Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"` -} - -// TransparentDataEncryptionActivityProperties represents the properties of a database transparent data -// encryption Scan. -type TransparentDataEncryptionActivityProperties struct { - // Status - READ-ONLY; The status of the database. Possible values include: 'TransparentDataEncryptionActivityStatusEncrypting', 'TransparentDataEncryptionActivityStatusDecrypting' - Status TransparentDataEncryptionActivityStatus `json:"status,omitempty"` - // PercentComplete - READ-ONLY; The percent complete of the transparent data encryption scan for a database. - PercentComplete *float64 `json:"percentComplete,omitempty"` -} - -// MarshalJSON is the custom marshaler for TransparentDataEncryptionActivityProperties. -func (tdeap TransparentDataEncryptionActivityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TransparentDataEncryptionProperties represents the properties of a database transparent data encryption. +// TransparentDataEncryptionProperties properties of a transparent data encryption. type TransparentDataEncryptionProperties struct { - // Status - The status of the database transparent data encryption. Possible values include: 'TransparentDataEncryptionStatusEnabled', 'TransparentDataEncryptionStatusDisabled' - Status TransparentDataEncryptionStatus `json:"status,omitempty"` -} - -// UnlinkParameters represents the parameters for Unlink Replication Link request. -type UnlinkParameters struct { - // ForcedTermination - Determines whether link will be terminated in a forced or a friendly way. - ForcedTermination *bool `json:"forcedTermination,omitempty"` + // State - Specifies the state of the transparent data encryption. Possible values include: 'TransparentDataEncryptionStateEnabled', 'TransparentDataEncryptionStateDisabled' + State TransparentDataEncryptionState `json:"state,omitempty"` } // UpdateLongTermRetentionBackupParameters contains the information necessary to perform long term @@ -31742,8 +34030,8 @@ func (ultrbp *UpdateLongTermRetentionBackupParameters) UnmarshalJSON(body []byte // UpdateLongTermRetentionBackupParametersProperties contains the properties to perform long term retention // backup copy operation. type UpdateLongTermRetentionBackupParametersProperties struct { - // RequestedBackupStorageRedundancy - The storage redundancy type of the copied backup. Possible values include: 'RequestedBackupStorageRedundancyGeo', 'RequestedBackupStorageRedundancyLocal', 'RequestedBackupStorageRedundancyZone' - RequestedBackupStorageRedundancy RequestedBackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` + // RequestedBackupStorageRedundancy - The storage redundancy type of the copied backup. Possible values include: 'BackupStorageRedundancyGeo', 'BackupStorageRedundancyLocal', 'BackupStorageRedundancyZone', 'BackupStorageRedundancyGeoZone' + RequestedBackupStorageRedundancy BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` } // UpdateManagedInstanceDNSServersOperation a recoverable managed database resource. diff --git a/services/preview/sql/mgmt/v5.0/sql/operationshealth.go b/services/preview/sql/mgmt/v5.0/sql/operationshealth.go deleted file mode 100644 index 336375cc7e29..000000000000 --- a/services/preview/sql/mgmt/v5.0/sql/operationshealth.go +++ /dev/null @@ -1,150 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsHealthClient is the the Azure SQL Database management API provides a RESTful set of web services that -// interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type OperationsHealthClient struct { - BaseClient -} - -// NewOperationsHealthClient creates an instance of the OperationsHealthClient client. -func NewOperationsHealthClient(subscriptionID string) OperationsHealthClient { - return NewOperationsHealthClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsHealthClientWithBaseURI creates an instance of the OperationsHealthClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewOperationsHealthClientWithBaseURI(baseURI string, subscriptionID string) OperationsHealthClient { - return OperationsHealthClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByLocation gets a service operation health status. -// Parameters: -// locationName - the name of the region where the resource is located. -func (client OperationsHealthClient) ListByLocation(ctx context.Context, locationName string) (result OperationsHealthListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsHealthClient.ListByLocation") - defer func() { - sc := -1 - if result.ohlr.Response.Response != nil { - sc = result.ohlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByLocationNextResults - req, err := client.ListByLocationPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.OperationsHealthClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.ohlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.OperationsHealthClient", "ListByLocation", resp, "Failure sending request") - return - } - - result.ohlr, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.OperationsHealthClient", "ListByLocation", resp, "Failure responding to request") - return - } - if result.ohlr.hasNextLink() && result.ohlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client OperationsHealthClient) ListByLocationPreparer(ctx context.Context, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsHealthClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client OperationsHealthClient) ListByLocationResponder(resp *http.Response) (result OperationsHealthListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByLocationNextResults retrieves the next set of results, if any. -func (client OperationsHealthClient) listByLocationNextResults(ctx context.Context, lastResults OperationsHealthListResult) (result OperationsHealthListResult, err error) { - req, err := lastResults.operationsHealthListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sql.OperationsHealthClient", "listByLocationNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sql.OperationsHealthClient", "listByLocationNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.OperationsHealthClient", "listByLocationNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsHealthClient) ListByLocationComplete(ctx context.Context, locationName string) (result OperationsHealthListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsHealthClient.ListByLocation") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByLocation(ctx, locationName) - return -} diff --git a/services/preview/sql/mgmt/v5.0/sql/recommendedsensitivitylabels.go b/services/preview/sql/mgmt/v5.0/sql/recommendedsensitivitylabels.go index 8a9311a7939e..5a28e540c289 100644 --- a/services/preview/sql/mgmt/v5.0/sql/recommendedsensitivitylabels.go +++ b/services/preview/sql/mgmt/v5.0/sql/recommendedsensitivitylabels.go @@ -81,7 +81,7 @@ func (client RecommendedSensitivityLabelsClient) UpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/replicationlinks.go b/services/preview/sql/mgmt/v5.0/sql/replicationlinks.go index 60c0723d451a..efe7f24705e6 100644 --- a/services/preview/sql/mgmt/v5.0/sql/replicationlinks.go +++ b/services/preview/sql/mgmt/v5.0/sql/replicationlinks.go @@ -33,13 +33,12 @@ func NewReplicationLinksClientWithBaseURI(baseURI string, subscriptionID string) return ReplicationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Delete deletes a database replication link. Cannot be done during failover. +// Delete deletes the replication link. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. // serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be dropped. -// linkID - the ID of the replication link to be deleted. +// databaseName - the name of the database. func (client ReplicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Delete") @@ -83,7 +82,7 @@ func (client ReplicationLinksClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2014-04-01" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -107,19 +106,19 @@ func (client ReplicationLinksClient) DeleteSender(req *http.Request) (*http.Resp func (client ReplicationLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.Response = resp return } -// Failover sets which replica database is primary by failing over from the current primary replica database. +// Failover fails over from the current primary server to this server. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. // serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. +// databaseName - the name of the database. +// linkID - the name of the replication link. func (client ReplicationLinksClient) Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLinksFailoverFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Failover") @@ -156,7 +155,7 @@ func (client ReplicationLinksClient) FailoverPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2014-04-01" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -187,23 +186,23 @@ func (client ReplicationLinksClient) FailoverSender(req *http.Request) (future R // FailoverResponder handles the response to the Failover request. The method always // closes the http.Response Body. -func (client ReplicationLinksClient) FailoverResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ReplicationLinksClient) FailoverResponder(resp *http.Response) (result ReplicationLink, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = resp + result.Response = autorest.Response{Response: resp} return } -// FailoverAllowDataLoss sets which replica database is primary by failing over from the current primary replica -// database. This operation might result in data loss. +// FailoverAllowDataLoss fails over from the current primary server to this server allowing data loss. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. // serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. +// databaseName - the name of the database. +// linkID - the name of the replication link. func (client ReplicationLinksClient) FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLinksFailoverAllowDataLossFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.FailoverAllowDataLoss") @@ -240,7 +239,7 @@ func (client ReplicationLinksClient) FailoverAllowDataLossPreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2014-04-01" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -271,12 +270,13 @@ func (client ReplicationLinksClient) FailoverAllowDataLossSender(req *http.Reque // FailoverAllowDataLossResponder handles the response to the FailoverAllowDataLoss request. The method always // closes the http.Response Body. -func (client ReplicationLinksClient) FailoverAllowDataLossResponder(resp *http.Response) (result autorest.Response, err error) { +func (client ReplicationLinksClient) FailoverAllowDataLossResponder(resp *http.Response) (result ReplicationLink, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = resp + result.Response = autorest.Response{Response: resp} return } @@ -330,7 +330,7 @@ func (client ReplicationLinksClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -414,7 +414,7 @@ func (client ReplicationLinksClient) ListByDatabasePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -533,7 +533,7 @@ func (client ReplicationLinksClient) ListByServerPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -600,89 +600,3 @@ func (client ReplicationLinksClient) ListByServerComplete(ctx context.Context, r result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) return } - -// Unlink deletes a database replication link in forced or friendly way. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database that has the replication link to be failed over. -// linkID - the ID of the replication link to be failed over. -// parameters - the required parameters for unlinking replication link. -func (client ReplicationLinksClient) Unlink(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters UnlinkParameters) (result ReplicationLinksUnlinkFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationLinksClient.Unlink") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UnlinkPreparer(ctx, resourceGroupName, serverName, databaseName, linkID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Unlink", nil, "Failure preparing request") - return - } - - result, err = client.UnlinkSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ReplicationLinksClient", "Unlink", result.Response(), "Failure sending request") - return - } - - return -} - -// UnlinkPreparer prepares the Unlink request. -func (client ReplicationLinksClient) UnlinkPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters UnlinkParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UnlinkSender sends the Unlink request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicationLinksClient) UnlinkSender(req *http.Request) (future ReplicationLinksUnlinkFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UnlinkResponder handles the response to the Unlink request. The method always -// closes the http.Response Body. -func (client ReplicationLinksClient) UnlinkResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/services/preview/sql/mgmt/v5.0/sql/restorabledroppeddatabases.go b/services/preview/sql/mgmt/v5.0/sql/restorabledroppeddatabases.go index fba3a6c7ac5b..4e9f1e488849 100644 --- a/services/preview/sql/mgmt/v5.0/sql/restorabledroppeddatabases.go +++ b/services/preview/sql/mgmt/v5.0/sql/restorabledroppeddatabases.go @@ -80,7 +80,7 @@ func (client RestorableDroppedDatabasesClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,7 +162,7 @@ func (client RestorableDroppedDatabasesClient) ListByServerPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/restorabledroppedmanageddatabases.go b/services/preview/sql/mgmt/v5.0/sql/restorabledroppedmanageddatabases.go index 0758769aae6d..2d9de035e999 100644 --- a/services/preview/sql/mgmt/v5.0/sql/restorabledroppedmanageddatabases.go +++ b/services/preview/sql/mgmt/v5.0/sql/restorabledroppedmanageddatabases.go @@ -81,7 +81,7 @@ func (client RestorableDroppedManagedDatabasesClient) GetPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -163,7 +163,7 @@ func (client RestorableDroppedManagedDatabasesClient) ListByInstancePreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-02-01-preview" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/sensitivitylabels.go b/services/preview/sql/mgmt/v5.0/sql/sensitivitylabels.go index 27fff16adf22..6db7897b7be6 100644 --- a/services/preview/sql/mgmt/v5.0/sql/sensitivitylabels.go +++ b/services/preview/sql/mgmt/v5.0/sql/sensitivitylabels.go @@ -89,7 +89,7 @@ func (client SensitivityLabelsClient) CreateOrUpdatePreparer(ctx context.Context "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -178,7 +178,7 @@ func (client SensitivityLabelsClient) DeletePreparer(ctx context.Context, resour "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -263,7 +263,7 @@ func (client SensitivityLabelsClient) DisableRecommendationPreparer(ctx context. "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -349,7 +349,7 @@ func (client SensitivityLabelsClient) EnableRecommendationPreparer(ctx context.C "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -435,7 +435,7 @@ func (client SensitivityLabelsClient) GetPreparer(ctx context.Context, resourceG "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -466,6 +466,131 @@ func (client SensitivityLabelsClient) GetResponder(resp *http.Response) (result return } +// ListByDatabase gets the sensitivity labels of a given database +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the database. +// filter - an OData filter expression that filters elements in the collection. +func (client SensitivityLabelsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result SensitivityLabelListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.ListByDatabase") + defer func() { + sc := -1 + if result.sllr.Response.Response != nil { + sc = result.sllr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDatabaseNextResults + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.sllr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result.sllr, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "ListByDatabase", resp, "Failure responding to request") + return + } + if result.sllr.hasNextLink() && result.sllr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client SensitivityLabelsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client SensitivityLabelsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client SensitivityLabelsClient) ListByDatabaseResponder(resp *http.Response) (result SensitivityLabelListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDatabaseNextResults retrieves the next set of results, if any. +func (client SensitivityLabelsClient) listByDatabaseNextResults(ctx context.Context, lastResults SensitivityLabelListResult) (result SensitivityLabelListResult, err error) { + req, err := lastResults.sensitivityLabelListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.SensitivityLabelsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. +func (client SensitivityLabelsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result SensitivityLabelListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelsClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName, filter) + return +} + // ListCurrentByDatabase gets the sensitivity labels of a given database // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value @@ -520,7 +645,7 @@ func (client SensitivityLabelsClient) ListCurrentByDatabasePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -652,7 +777,7 @@ func (client SensitivityLabelsClient) ListRecommendedByDatabasePreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -777,7 +902,7 @@ func (client SensitivityLabelsClient) UpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-11-01-preview" + const APIVersion = "2021-11-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/sql/mgmt/v5.0/sql/serverconnectionpolicies.go b/services/preview/sql/mgmt/v5.0/sql/serverconnectionpolicies.go index fd714db39b75..416550161475 100644 --- a/services/preview/sql/mgmt/v5.0/sql/serverconnectionpolicies.go +++ b/services/preview/sql/mgmt/v5.0/sql/serverconnectionpolicies.go @@ -33,19 +33,19 @@ func NewServerConnectionPoliciesClientWithBaseURI(baseURI string, subscriptionID return ServerConnectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate creates or updates the server's connection policy. +// CreateOrUpdate updates a server connection policy // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. // serverName - the name of the server. -// parameters - the required parameters for updating a secure connection policy. -func (client ServerConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (result ServerConnectionPolicy, err error) { +// parameters - the required parameters for updating a server connection policy. +func (client ServerConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerConnectionPolicy) (result ServerConnectionPoliciesCreateOrUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.CreateOrUpdate") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -56,16 +56,9 @@ func (client ServerConnectionPoliciesClient) CreateOrUpdate(ctx context.Context, return } - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) + result, err = client.CreateOrUpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } @@ -81,13 +74,13 @@ func (client ServerConnectionPoliciesClient) CreateOrUpdatePreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2014-04-01" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } - parameters.Kind = nil parameters.Location = nil + parameters.Kind = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -100,8 +93,18 @@ func (client ServerConnectionPoliciesClient) CreateOrUpdatePreparer(ctx context. // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client ServerConnectionPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +func (client ServerConnectionPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServerConnectionPoliciesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always @@ -109,14 +112,14 @@ func (client ServerConnectionPoliciesClient) CreateOrUpdateSender(req *http.Requ func (client ServerConnectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerConnectionPolicy, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } -// Get gets the server's secure connection policy. +// Get gets a server connection policy // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. @@ -163,7 +166,7 @@ func (client ServerConnectionPoliciesClient) GetPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2014-04-01" + const APIVersion = "2021-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -193,3 +196,122 @@ func (client ServerConnectionPoliciesClient) GetResponder(resp *http.Response) ( result.Response = autorest.Response{Response: resp} return } + +// ListByServer lists connection policy +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +func (client ServerConnectionPoliciesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerConnectionPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.ListByServer") + defer func() { + sc := -1 + if result.scplr.Response.Response != nil { + sc = result.scplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByServerNextResults + req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.scplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "ListByServer", resp, "Failure sending request") + return + } + + result.scplr, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "ListByServer", resp, "Failure responding to request") + return + } + if result.scplr.hasNextLink() && result.scplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ServerConnectionPoliciesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client ServerConnectionPoliciesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client ServerConnectionPoliciesClient) ListByServerResponder(resp *http.Response) (result ServerConnectionPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByServerNextResults retrieves the next set of results, if any. +func (client ServerConnectionPoliciesClient) listByServerNextResults(ctx context.Context, lastResults ServerConnectionPolicyListResult) (result ServerConnectionPolicyListResult, err error) { + req, err := lastResults.serverConnectionPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "listByServerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "listByServerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerConnectionPoliciesClient", "listByServerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServerConnectionPoliciesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerConnectionPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerConnectionPoliciesClient.ListByServer") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) + return +} diff --git a/services/preview/sql/mgmt/v5.0/sql/servertrustcertificates.go b/services/preview/sql/mgmt/v5.0/sql/servertrustcertificates.go new file mode 100644 index 000000000000..d0f4a1495ae2 --- /dev/null +++ b/services/preview/sql/mgmt/v5.0/sql/servertrustcertificates.go @@ -0,0 +1,399 @@ +package sql + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServerTrustCertificatesClient is the the Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type ServerTrustCertificatesClient struct { + BaseClient +} + +// NewServerTrustCertificatesClient creates an instance of the ServerTrustCertificatesClient client. +func NewServerTrustCertificatesClient(subscriptionID string) ServerTrustCertificatesClient { + return NewServerTrustCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServerTrustCertificatesClientWithBaseURI creates an instance of the ServerTrustCertificatesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewServerTrustCertificatesClientWithBaseURI(baseURI string, subscriptionID string) ServerTrustCertificatesClient { + return ServerTrustCertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate uploads a server trust certificate from box to Sql Managed Instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// certificateName - name of of the certificate to upload. +// parameters - the server trust certificate info. +func (client ServerTrustCertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string, parameters ServerTrustCertificate) (result ServerTrustCertificatesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustCertificatesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, managedInstanceName, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServerTrustCertificatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string, parameters ServerTrustCertificate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServerTrustCertificatesClient) CreateOrUpdateSender(req *http.Request) (future ServerTrustCertificatesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServerTrustCertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerTrustCertificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a server trust certificate that was uploaded from box to Sql Managed Instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// certificateName - name of of the certificate to delete. +func (client ServerTrustCertificatesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string) (result ServerTrustCertificatesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustCertificatesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, managedInstanceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServerTrustCertificatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServerTrustCertificatesClient) DeleteSender(req *http.Request) (future ServerTrustCertificatesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServerTrustCertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a server trust certificate that was uploaded from box to Sql Managed Instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +// certificateName - name of of the certificate to get. +func (client ServerTrustCertificatesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string) (result ServerTrustCertificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustCertificatesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, managedInstanceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServerTrustCertificatesClient) GetPreparer(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServerTrustCertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServerTrustCertificatesClient) GetResponder(resp *http.Response) (result ServerTrustCertificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInstance gets a list of server trust certificates that were uploaded from box to the given Sql Managed +// Instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// managedInstanceName - the name of the managed instance. +func (client ServerTrustCertificatesClient) ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ServerTrustCertificatesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustCertificatesClient.ListByInstance") + defer func() { + sc := -1 + if result.stclr.Response.Response != nil { + sc = result.stclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByInstanceNextResults + req, err := client.ListByInstancePreparer(ctx, resourceGroupName, managedInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "ListByInstance", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.stclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "ListByInstance", resp, "Failure sending request") + return + } + + result.stclr, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "ListByInstance", resp, "Failure responding to request") + return + } + if result.stclr.hasNextLink() && result.stclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByInstancePreparer prepares the ListByInstance request. +func (client ServerTrustCertificatesClient) ListByInstancePreparer(ctx context.Context, resourceGroupName string, managedInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "managedInstanceName": autorest.Encode("path", managedInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInstanceSender sends the ListByInstance request. The method will close the +// http.Response Body if it receives an error. +func (client ServerTrustCertificatesClient) ListByInstanceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByInstanceResponder handles the response to the ListByInstance request. The method always +// closes the http.Response Body. +func (client ServerTrustCertificatesClient) ListByInstanceResponder(resp *http.Response) (result ServerTrustCertificatesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByInstanceNextResults retrieves the next set of results, if any. +func (client ServerTrustCertificatesClient) listByInstanceNextResults(ctx context.Context, lastResults ServerTrustCertificatesListResult) (result ServerTrustCertificatesListResult, err error) { + req, err := lastResults.serverTrustCertificatesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "listByInstanceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByInstanceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "listByInstanceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByInstanceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServerTrustCertificatesClient", "listByInstanceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByInstanceComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServerTrustCertificatesClient) ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result ServerTrustCertificatesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServerTrustCertificatesClient.ListByInstance") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByInstance(ctx, resourceGroupName, managedInstanceName) + return +} diff --git a/services/preview/sql/mgmt/v5.0/sql/sqlapi/interfaces.go b/services/preview/sql/mgmt/v5.0/sql/sqlapi/interfaces.go index c0309960fd04..c5c02dc483c8 100644 --- a/services/preview/sql/mgmt/v5.0/sql/sqlapi/interfaces.go +++ b/services/preview/sql/mgmt/v5.0/sql/sqlapi/interfaces.go @@ -22,14 +22,6 @@ type RecoverableDatabasesClientAPI interface { var _ RecoverableDatabasesClientAPI = (*sql.RecoverableDatabasesClient)(nil) -// ServerConnectionPoliciesClientAPI contains the set of methods on the ServerConnectionPoliciesClient type. -type ServerConnectionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerConnectionPolicy) (result sql.ServerConnectionPolicy, err error) - Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerConnectionPolicy, err error) -} - -var _ ServerConnectionPoliciesClientAPI = (*sql.ServerConnectionPoliciesClient)(nil) - // DataMaskingPoliciesClientAPI contains the set of methods on the DataMaskingPoliciesClient type. type DataMaskingPoliciesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.DataMaskingPolicy) (result sql.DataMaskingPolicy, err error) @@ -86,8 +78,8 @@ type ElasticPoolsClientAPI interface { Delete(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolsDeleteFuture, err error) Failover(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPoolsFailoverFuture, err error) Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.ElasticPool, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result sql.ElasticPoolListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, skip *int32) (result sql.ElasticPoolListResultIterator, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string, skip *int64) (result sql.ElasticPoolListResultPage, err error) + ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, skip *int64) (result sql.ElasticPoolListResultIterator, err error) ListMetricDefinitions(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string) (result sql.MetricDefinitionListResult, err error) ListMetrics(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string) (result sql.MetricListResult, err error) Update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters sql.ElasticPoolUpdate) (result sql.ElasticPoolsUpdateFuture, err error) @@ -95,21 +87,6 @@ type ElasticPoolsClientAPI interface { var _ ElasticPoolsClientAPI = (*sql.ElasticPoolsClient)(nil) -// ReplicationLinksClientAPI contains the set of methods on the ReplicationLinksClient type. -type ReplicationLinksClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) - Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLinksFailoverFuture, err error) - FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLinksFailoverAllowDataLossFuture, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLink, err error) - ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ReplicationLinkListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ReplicationLinkListResultIterator, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ReplicationLinkListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ReplicationLinkListResultIterator, err error) - Unlink(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, parameters sql.UnlinkParameters) (result sql.ReplicationLinksUnlinkFuture, err error) -} - -var _ ReplicationLinksClientAPI = (*sql.ReplicationLinksClient)(nil) - // ServerCommunicationLinksClientAPI contains the set of methods on the ServerCommunicationLinksClient type. type ServerCommunicationLinksClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters sql.ServerCommunicationLink) (result sql.ServerCommunicationLinksCreateOrUpdateFuture, err error) @@ -142,21 +119,6 @@ type ElasticPoolDatabaseActivitiesClientAPI interface { var _ ElasticPoolDatabaseActivitiesClientAPI = (*sql.ElasticPoolDatabaseActivitiesClient)(nil) -// TransparentDataEncryptionsClientAPI contains the set of methods on the TransparentDataEncryptionsClient type. -type TransparentDataEncryptionsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.TransparentDataEncryption) (result sql.TransparentDataEncryption, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.TransparentDataEncryption, err error) -} - -var _ TransparentDataEncryptionsClientAPI = (*sql.TransparentDataEncryptionsClient)(nil) - -// TransparentDataEncryptionActivitiesClientAPI contains the set of methods on the TransparentDataEncryptionActivitiesClient type. -type TransparentDataEncryptionActivitiesClientAPI interface { - ListByConfiguration(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.TransparentDataEncryptionActivityListResult, err error) -} - -var _ TransparentDataEncryptionActivitiesClientAPI = (*sql.TransparentDataEncryptionActivitiesClient)(nil) - // ServerUsagesClientAPI contains the set of methods on the ServerUsagesClient type. type ServerUsagesClientAPI interface { ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerUsageListResult, err error) @@ -503,54 +465,6 @@ type CapabilitiesClientAPI interface { var _ CapabilitiesClientAPI = (*sql.CapabilitiesClient)(nil) -// LongTermRetentionBackupsClientAPI contains the set of methods on the LongTermRetentionBackupsClient type. -type LongTermRetentionBackupsClientAPI interface { - Copy(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.CopyLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsCopyFuture, err error) - CopyByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.CopyLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsCopyByResourceGroupFuture, err error) - Delete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteFuture, err error) - DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteByResourceGroupFuture, err error) - Get(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) - GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) - ListByDatabase(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupServer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByResourceGroupServerComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - ListByServer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) - ListByServerComplete(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) - Update(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.UpdateLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsUpdateFuture, err error) - UpdateByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.UpdateLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsUpdateByResourceGroupFuture, err error) -} - -var _ LongTermRetentionBackupsClientAPI = (*sql.LongTermRetentionBackupsClient)(nil) - -// LongTermRetentionManagedInstanceBackupsClientAPI contains the set of methods on the LongTermRetentionManagedInstanceBackupsClient type. -type LongTermRetentionManagedInstanceBackupsClientAPI interface { - Delete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.LongTermRetentionManagedInstanceBackupsDeleteFuture, err error) - DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture, err error) - Get(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.ManagedInstanceLongTermRetentionBackup, err error) - GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.ManagedInstanceLongTermRetentionBackup, err error) - ListByDatabase(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByDatabaseComplete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByInstance(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByInstanceComplete(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupInstance(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupInstanceComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) - ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) - ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) -} - -var _ LongTermRetentionManagedInstanceBackupsClientAPI = (*sql.LongTermRetentionManagedInstanceBackupsClient)(nil) - // LongTermRetentionPoliciesClientAPI contains the set of methods on the LongTermRetentionPoliciesClient type. type LongTermRetentionPoliciesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.LongTermRetentionPolicy) (result sql.LongTermRetentionPoliciesCreateOrUpdateFuture, err error) @@ -656,29 +570,6 @@ type ManagedDatabaseSecurityEventsClientAPI interface { var _ ManagedDatabaseSecurityEventsClientAPI = (*sql.ManagedDatabaseSecurityEventsClient)(nil) -// ManagedDatabaseSensitivityLabelsClientAPI contains the set of methods on the ManagedDatabaseSensitivityLabelsClient type. -type ManagedDatabaseSensitivityLabelsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, parameters sql.SensitivityLabel) (result sql.SensitivityLabel, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - DisableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - EnableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource sql.SensitivityLabelSource) (result sql.SensitivityLabel, err error) - ListCurrentByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, skipToken string, count *bool, filter string) (result sql.SensitivityLabelListResultPage, err error) - ListCurrentByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, skipToken string, count *bool, filter string) (result sql.SensitivityLabelListResultIterator, err error) - ListRecommendedByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, skipToken string, includeDisabledRecommendations *bool, filter string) (result sql.SensitivityLabelListResultPage, err error) - ListRecommendedByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, skipToken string, includeDisabledRecommendations *bool, filter string) (result sql.SensitivityLabelListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.SensitivityLabelUpdateList) (result autorest.Response, err error) -} - -var _ ManagedDatabaseSensitivityLabelsClientAPI = (*sql.ManagedDatabaseSensitivityLabelsClient)(nil) - -// ManagedDatabaseRecommendedSensitivityLabelsClientAPI contains the set of methods on the ManagedDatabaseRecommendedSensitivityLabelsClient type. -type ManagedDatabaseRecommendedSensitivityLabelsClientAPI interface { - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.RecommendedSensitivityLabelUpdateList) (result autorest.Response, err error) -} - -var _ ManagedDatabaseRecommendedSensitivityLabelsClientAPI = (*sql.ManagedDatabaseRecommendedSensitivityLabelsClient)(nil) - // ManagedDatabaseTablesClientAPI contains the set of methods on the ManagedDatabaseTablesClient type. type ManagedDatabaseTablesClientAPI interface { Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string) (result sql.DatabaseTable, err error) @@ -813,25 +704,6 @@ type ManagedInstancePrivateLinkResourcesClientAPI interface { var _ ManagedInstancePrivateLinkResourcesClientAPI = (*sql.ManagedInstancePrivateLinkResourcesClient)(nil) -// ManagedInstancesClientAPI contains the set of methods on the ManagedInstancesClient type. -type ManagedInstancesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstance) (result sql.ManagedInstancesCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) - Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType sql.ReplicaType) (result sql.ManagedInstancesFailoverFuture, err error) - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, expand string) (result sql.ManagedInstance, err error) - List(ctx context.Context, expand string) (result sql.ManagedInstanceListResultPage, err error) - ListComplete(ctx context.Context, expand string) (result sql.ManagedInstanceListResultIterator, err error) - ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string, expand string) (result sql.ManagedInstanceListResultPage, err error) - ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string, expand string) (result sql.ManagedInstanceListResultIterator, err error) - ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval sql.QueryTimeGrainType, aggregationFunction sql.AggregationFunctionType, observationMetric sql.MetricType) (result sql.TopQueriesListResultPage, err error) - ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval sql.QueryTimeGrainType, aggregationFunction sql.AggregationFunctionType, observationMetric sql.MetricType) (result sql.TopQueriesListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string) (result sql.ManagedInstanceListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string) (result sql.ManagedInstanceListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) -} - -var _ ManagedInstancesClientAPI = (*sql.ManagedInstancesClient)(nil) - // ManagedInstanceTdeCertificatesClientAPI contains the set of methods on the ManagedInstanceTdeCertificatesClient type. type ManagedInstanceTdeCertificatesClientAPI interface { Create(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.TdeCertificate) (result sql.ManagedInstanceTdeCertificatesCreateFuture, err error) @@ -879,14 +751,6 @@ type OperationsClientAPI interface { var _ OperationsClientAPI = (*sql.OperationsClient)(nil) -// OperationsHealthClientAPI contains the set of methods on the OperationsHealthClient type. -type OperationsHealthClientAPI interface { - ListByLocation(ctx context.Context, locationName string) (result sql.OperationsHealthListResultPage, err error) - ListByLocationComplete(ctx context.Context, locationName string) (result sql.OperationsHealthListResultIterator, err error) -} - -var _ OperationsHealthClientAPI = (*sql.OperationsHealthClient)(nil) - // PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. type PrivateEndpointConnectionsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters sql.PrivateEndpointConnection) (result sql.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) @@ -927,29 +791,6 @@ type RestorePointsClientAPI interface { var _ RestorePointsClientAPI = (*sql.RestorePointsClient)(nil) -// SensitivityLabelsClientAPI contains the set of methods on the SensitivityLabelsClient type. -type SensitivityLabelsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters sql.SensitivityLabel) (result sql.SensitivityLabel, err error) - Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - DisableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - EnableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource sql.SensitivityLabelSource) (result sql.SensitivityLabel, err error) - ListCurrentByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, skipToken string, count *bool, filter string) (result sql.SensitivityLabelListResultPage, err error) - ListCurrentByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, skipToken string, count *bool, filter string) (result sql.SensitivityLabelListResultIterator, err error) - ListRecommendedByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, skipToken string, includeDisabledRecommendations *bool, filter string) (result sql.SensitivityLabelListResultPage, err error) - ListRecommendedByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, skipToken string, includeDisabledRecommendations *bool, filter string) (result sql.SensitivityLabelListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.SensitivityLabelUpdateList) (result autorest.Response, err error) -} - -var _ SensitivityLabelsClientAPI = (*sql.SensitivityLabelsClient)(nil) - -// RecommendedSensitivityLabelsClientAPI contains the set of methods on the RecommendedSensitivityLabelsClient type. -type RecommendedSensitivityLabelsClientAPI interface { - Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.RecommendedSensitivityLabelUpdateList) (result autorest.Response, err error) -} - -var _ RecommendedSensitivityLabelsClientAPI = (*sql.RecommendedSensitivityLabelsClient)(nil) - // ServerAdvisorsClientAPI contains the set of methods on the ServerAdvisorsClient type. type ServerAdvisorsClientAPI interface { Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string) (result sql.Advisor, err error) @@ -1105,8 +946,8 @@ type SyncGroupsClientAPI interface { ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.SyncGroupListResultIterator, err error) ListHubSchemas(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncFullSchemaPropertiesListResultPage, err error) ListHubSchemasComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncFullSchemaPropertiesListResultIterator, err error) - ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result sql.SyncGroupLogListResultPage, err error) - ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result sql.SyncGroupLogListResultIterator, err error) + ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter sql.SyncGroupsType, continuationToken string) (result sql.SyncGroupLogListResultPage, err error) + ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter sql.SyncGroupsType, continuationToken string) (result sql.SyncGroupLogListResultIterator, err error) ListSyncDatabaseIds(ctx context.Context, locationName string) (result sql.SyncDatabaseIDListResultPage, err error) ListSyncDatabaseIdsComplete(ctx context.Context, locationName string) (result sql.SyncDatabaseIDListResultIterator, err error) RefreshHubSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string) (result sql.SyncGroupsRefreshHubSchemaFuture, err error) @@ -1194,6 +1035,16 @@ type WorkloadGroupsClientAPI interface { var _ WorkloadGroupsClientAPI = (*sql.WorkloadGroupsClient)(nil) +// TransparentDataEncryptionsClientAPI contains the set of methods on the TransparentDataEncryptionsClient type. +type TransparentDataEncryptionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.LogicalDatabaseTransparentDataEncryption) (result sql.LogicalDatabaseTransparentDataEncryption, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LogicalDatabaseTransparentDataEncryption, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LogicalDatabaseTransparentDataEncryptionListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LogicalDatabaseTransparentDataEncryptionListResultIterator, err error) +} + +var _ TransparentDataEncryptionsClientAPI = (*sql.TransparentDataEncryptionsClient)(nil) + // BackupShortTermRetentionPoliciesClientAPI contains the set of methods on the BackupShortTermRetentionPoliciesClient type. type BackupShortTermRetentionPoliciesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.BackupShortTermRetentionPolicy) (result sql.BackupShortTermRetentionPoliciesCreateOrUpdateFuture, err error) @@ -1234,8 +1085,8 @@ var _ DatabaseUsagesClientAPI = (*sql.DatabaseUsagesClient)(nil) // LedgerDigestUploadsClientAPI contains the set of methods on the LedgerDigestUploadsClient type. type LedgerDigestUploadsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.LedgerDigestUploads) (result sql.LedgerDigestUploads, err error) - Disable(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LedgerDigestUploads, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.LedgerDigestUploads) (result sql.LedgerDigestUploadsCreateOrUpdateFuture, err error) + Disable(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LedgerDigestUploadsDisableFuture, err error) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LedgerDigestUploads, err error) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LedgerDigestUploadsListResultPage, err error) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.LedgerDigestUploadsListResultIterator, err error) @@ -1254,24 +1105,6 @@ type OutboundFirewallRulesClientAPI interface { var _ OutboundFirewallRulesClientAPI = (*sql.OutboundFirewallRulesClient)(nil) -// RestorableDroppedDatabasesClientAPI contains the set of methods on the RestorableDroppedDatabasesClient type. -type RestorableDroppedDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppedDatabaseID string) (result sql.RestorableDroppedDatabase, err error) - ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RestorableDroppedDatabaseListResultPage, err error) - ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.RestorableDroppedDatabaseListResultIterator, err error) -} - -var _ RestorableDroppedDatabasesClientAPI = (*sql.RestorableDroppedDatabasesClient)(nil) - -// RestorableDroppedManagedDatabasesClientAPI contains the set of methods on the RestorableDroppedManagedDatabasesClient type. -type RestorableDroppedManagedDatabasesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result sql.RestorableDroppedManagedDatabase, err error) - ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RestorableDroppedManagedDatabaseListResultPage, err error) - ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RestorableDroppedManagedDatabaseListResultIterator, err error) -} - -var _ RestorableDroppedManagedDatabasesClientAPI = (*sql.RestorableDroppedManagedDatabasesClient)(nil) - // ServersClientAPI contains the set of methods on the ServersClient type. type ServersClientAPI interface { CheckNameAvailability(ctx context.Context, parameters sql.CheckNameAvailabilityRequest) (result sql.CheckNameAvailabilityResponse, err error) @@ -1295,3 +1128,227 @@ type UsagesClientAPI interface { } var _ UsagesClientAPI = (*sql.UsagesClient)(nil) + +// LongTermRetentionBackupsClientAPI contains the set of methods on the LongTermRetentionBackupsClient type. +type LongTermRetentionBackupsClientAPI interface { + Copy(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.CopyLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsCopyFuture, err error) + CopyByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.CopyLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsCopyByResourceGroupFuture, err error) + Delete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteFuture, err error) + DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackupsDeleteByResourceGroupFuture, err error) + Get(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) + GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string) (result sql.LongTermRetentionBackup, err error) + ListByDatabase(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupServer(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByResourceGroupServerComplete(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + ListByServer(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultPage, err error) + ListByServerComplete(ctx context.Context, locationName string, longTermRetentionServerName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.LongTermRetentionBackupListResultIterator, err error) + Update(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.UpdateLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsUpdateFuture, err error) + UpdateByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters sql.UpdateLongTermRetentionBackupParameters) (result sql.LongTermRetentionBackupsUpdateByResourceGroupFuture, err error) +} + +var _ LongTermRetentionBackupsClientAPI = (*sql.LongTermRetentionBackupsClient)(nil) + +// LongTermRetentionManagedInstanceBackupsClientAPI contains the set of methods on the LongTermRetentionManagedInstanceBackupsClient type. +type LongTermRetentionManagedInstanceBackupsClientAPI interface { + Delete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.LongTermRetentionManagedInstanceBackupsDeleteFuture, err error) + DeleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture, err error) + Get(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.ManagedInstanceLongTermRetentionBackup, err error) + GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string) (result sql.ManagedInstanceLongTermRetentionBackup, err error) + ListByDatabase(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByInstance(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByInstanceComplete(ctx context.Context, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByLocation(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByLocationComplete(ctx context.Context, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupDatabase(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByResourceGroupDatabaseComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupInstance(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByResourceGroupInstanceComplete(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) + ListByResourceGroupLocation(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultPage, err error) + ListByResourceGroupLocationComplete(ctx context.Context, resourceGroupName string, locationName string, onlyLatestPerDatabase *bool, databaseState sql.DatabaseState) (result sql.ManagedInstanceLongTermRetentionBackupListResultIterator, err error) +} + +var _ LongTermRetentionManagedInstanceBackupsClientAPI = (*sql.LongTermRetentionManagedInstanceBackupsClient)(nil) + +// ManagedInstancesClientAPI contains the set of methods on the ManagedInstancesClient type. +type ManagedInstancesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstance) (result sql.ManagedInstancesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstancesDeleteFuture, err error) + Failover(ctx context.Context, resourceGroupName string, managedInstanceName string, replicaType sql.ReplicaType) (result sql.ManagedInstancesFailoverFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string, expand string) (result sql.ManagedInstance, err error) + List(ctx context.Context, expand string) (result sql.ManagedInstanceListResultPage, err error) + ListComplete(ctx context.Context, expand string) (result sql.ManagedInstanceListResultIterator, err error) + ListByInstancePool(ctx context.Context, resourceGroupName string, instancePoolName string, expand string) (result sql.ManagedInstanceListResultPage, err error) + ListByInstancePoolComplete(ctx context.Context, resourceGroupName string, instancePoolName string, expand string) (result sql.ManagedInstanceListResultIterator, err error) + ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval sql.QueryTimeGrainType, aggregationFunction sql.AggregationFunctionType, observationMetric sql.MetricType) (result sql.TopQueriesListResultPage, err error) + ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, numberOfQueries *int32, databases string, startTime string, endTime string, interval sql.QueryTimeGrainType, aggregationFunction sql.AggregationFunctionType, observationMetric sql.MetricType) (result sql.TopQueriesListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string) (result sql.ManagedInstanceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string) (result sql.ManagedInstanceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceUpdate) (result sql.ManagedInstancesUpdateFuture, err error) +} + +var _ ManagedInstancesClientAPI = (*sql.ManagedInstancesClient)(nil) + +// RestorableDroppedDatabasesClientAPI contains the set of methods on the RestorableDroppedDatabasesClient type. +type RestorableDroppedDatabasesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppedDatabaseID string) (result sql.RestorableDroppedDatabase, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.RestorableDroppedDatabaseListResultPage, err error) + ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.RestorableDroppedDatabaseListResultIterator, err error) +} + +var _ RestorableDroppedDatabasesClientAPI = (*sql.RestorableDroppedDatabasesClient)(nil) + +// RestorableDroppedManagedDatabasesClientAPI contains the set of methods on the RestorableDroppedManagedDatabasesClient type. +type RestorableDroppedManagedDatabasesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string) (result sql.RestorableDroppedManagedDatabase, err error) + ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RestorableDroppedManagedDatabaseListResultPage, err error) + ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.RestorableDroppedManagedDatabaseListResultIterator, err error) +} + +var _ RestorableDroppedManagedDatabasesClientAPI = (*sql.RestorableDroppedManagedDatabasesClient)(nil) + +// ServerConnectionPoliciesClientAPI contains the set of methods on the ServerConnectionPoliciesClient type. +type ServerConnectionPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters sql.ServerConnectionPolicy) (result sql.ServerConnectionPoliciesCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerConnectionPolicy, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerConnectionPolicyListResultPage, err error) + ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ServerConnectionPolicyListResultIterator, err error) +} + +var _ ServerConnectionPoliciesClientAPI = (*sql.ServerConnectionPoliciesClient)(nil) + +// DistributedAvailabilityGroupsClientAPI contains the set of methods on the DistributedAvailabilityGroupsClient type. +type DistributedAvailabilityGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters sql.DistributedAvailabilityGroup) (result sql.DistributedAvailabilityGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string) (result sql.DistributedAvailabilityGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string) (result sql.DistributedAvailabilityGroup, err error) + ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.DistributedAvailabilityGroupsListResultPage, err error) + ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.DistributedAvailabilityGroupsListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters sql.DistributedAvailabilityGroup) (result sql.DistributedAvailabilityGroupsUpdateFuture, err error) +} + +var _ DistributedAvailabilityGroupsClientAPI = (*sql.DistributedAvailabilityGroupsClient)(nil) + +// ServerTrustCertificatesClientAPI contains the set of methods on the ServerTrustCertificatesClient type. +type ServerTrustCertificatesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string, parameters sql.ServerTrustCertificate) (result sql.ServerTrustCertificatesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string) (result sql.ServerTrustCertificatesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string) (result sql.ServerTrustCertificate, err error) + ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ServerTrustCertificatesListResultPage, err error) + ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ServerTrustCertificatesListResultIterator, err error) +} + +var _ ServerTrustCertificatesClientAPI = (*sql.ServerTrustCertificatesClient)(nil) + +// IPv6FirewallRulesClientAPI contains the set of methods on the IPv6FirewallRulesClient type. +type IPv6FirewallRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters sql.IPv6FirewallRule) (result sql.IPv6FirewallRule, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result sql.IPv6FirewallRule, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.IPv6FirewallRuleListResultPage, err error) + ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.IPv6FirewallRuleListResultIterator, err error) +} + +var _ IPv6FirewallRulesClientAPI = (*sql.IPv6FirewallRulesClient)(nil) + +// ReplicationLinksClientAPI contains the set of methods on the ReplicationLinksClient type. +type ReplicationLinksClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) + Failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLinksFailoverFuture, err error) + FailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLinksFailoverAllowDataLossFuture, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string) (result sql.ReplicationLink, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ReplicationLinkListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result sql.ReplicationLinkListResultIterator, err error) + ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result sql.ReplicationLinkListResultPage, err error) + ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result sql.ReplicationLinkListResultIterator, err error) +} + +var _ ReplicationLinksClientAPI = (*sql.ReplicationLinksClient)(nil) + +// ManagedDatabaseSensitivityLabelsClientAPI contains the set of methods on the ManagedDatabaseSensitivityLabelsClient type. +type ManagedDatabaseSensitivityLabelsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, parameters sql.SensitivityLabel) (result sql.SensitivityLabel, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) + DisableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) + EnableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource sql.SensitivityLabelSource) (result sql.SensitivityLabel, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (result sql.SensitivityLabelListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, filter string) (result sql.SensitivityLabelListResultIterator, err error) + ListCurrentByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, skipToken string, count *bool, filter string) (result sql.SensitivityLabelListResultPage, err error) + ListCurrentByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, skipToken string, count *bool, filter string) (result sql.SensitivityLabelListResultIterator, err error) + ListRecommendedByDatabase(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, skipToken string, includeDisabledRecommendations *bool, filter string) (result sql.SensitivityLabelListResultPage, err error) + ListRecommendedByDatabaseComplete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, skipToken string, includeDisabledRecommendations *bool, filter string) (result sql.SensitivityLabelListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.SensitivityLabelUpdateList) (result autorest.Response, err error) +} + +var _ ManagedDatabaseSensitivityLabelsClientAPI = (*sql.ManagedDatabaseSensitivityLabelsClient)(nil) + +// ManagedDatabaseRecommendedSensitivityLabelsClientAPI contains the set of methods on the ManagedDatabaseRecommendedSensitivityLabelsClient type. +type ManagedDatabaseRecommendedSensitivityLabelsClientAPI interface { + Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters sql.RecommendedSensitivityLabelUpdateList) (result autorest.Response, err error) +} + +var _ ManagedDatabaseRecommendedSensitivityLabelsClientAPI = (*sql.ManagedDatabaseRecommendedSensitivityLabelsClient)(nil) + +// ManagedServerDNSAliasesClientAPI contains the set of methods on the ManagedServerDNSAliasesClient type. +type ManagedServerDNSAliasesClientAPI interface { + Acquire(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string, parameters sql.ManagedServerDNSAliasAcquisition) (result sql.ManagedServerDNSAliasesAcquireFuture, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string, parameters sql.ManagedServerDNSAliasCreation) (result sql.ManagedServerDNSAliasesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string) (result sql.ManagedServerDNSAliasesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string, DNSAliasName string) (result sql.ManagedServerDNSAlias, err error) + ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedServerDNSAliasListResultPage, err error) + ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedServerDNSAliasListResultIterator, err error) +} + +var _ ManagedServerDNSAliasesClientAPI = (*sql.ManagedServerDNSAliasesClient)(nil) + +// SensitivityLabelsClientAPI contains the set of methods on the SensitivityLabelsClient type. +type SensitivityLabelsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters sql.SensitivityLabel) (result sql.SensitivityLabel, err error) + Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) + DisableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) + EnableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource sql.SensitivityLabelSource) (result sql.SensitivityLabel, err error) + ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result sql.SensitivityLabelListResultPage, err error) + ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string) (result sql.SensitivityLabelListResultIterator, err error) + ListCurrentByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, skipToken string, count *bool, filter string) (result sql.SensitivityLabelListResultPage, err error) + ListCurrentByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, skipToken string, count *bool, filter string) (result sql.SensitivityLabelListResultIterator, err error) + ListRecommendedByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, skipToken string, includeDisabledRecommendations *bool, filter string) (result sql.SensitivityLabelListResultPage, err error) + ListRecommendedByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, skipToken string, includeDisabledRecommendations *bool, filter string) (result sql.SensitivityLabelListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.SensitivityLabelUpdateList) (result autorest.Response, err error) +} + +var _ SensitivityLabelsClientAPI = (*sql.SensitivityLabelsClient)(nil) + +// RecommendedSensitivityLabelsClientAPI contains the set of methods on the RecommendedSensitivityLabelsClient type. +type RecommendedSensitivityLabelsClientAPI interface { + Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters sql.RecommendedSensitivityLabelUpdateList) (result autorest.Response, err error) +} + +var _ RecommendedSensitivityLabelsClientAPI = (*sql.RecommendedSensitivityLabelsClient)(nil) + +// EndpointCertificatesClientAPI contains the set of methods on the EndpointCertificatesClient type. +type EndpointCertificatesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, managedInstanceName string, endpointType string) (result sql.EndpointCertificate, err error) + ListByInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.EndpointCertificateListResultPage, err error) + ListByInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.EndpointCertificateListResultIterator, err error) +} + +var _ EndpointCertificatesClientAPI = (*sql.EndpointCertificatesClient)(nil) + +// ManagedInstanceDtcsClientAPI contains the set of methods on the ManagedInstanceDtcsClient type. +type ManagedInstanceDtcsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters sql.ManagedInstanceDtc) (result sql.ManagedInstanceDtcsCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceDtc, err error) + ListByManagedInstance(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceDtcListResultPage, err error) + ListByManagedInstanceComplete(ctx context.Context, resourceGroupName string, managedInstanceName string) (result sql.ManagedInstanceDtcListResultIterator, err error) +} + +var _ ManagedInstanceDtcsClientAPI = (*sql.ManagedInstanceDtcsClient)(nil) diff --git a/services/preview/sql/mgmt/v5.0/sql/syncgroups.go b/services/preview/sql/mgmt/v5.0/sql/syncgroups.go index e8fbad895e04..0d388e00ce91 100644 --- a/services/preview/sql/mgmt/v5.0/sql/syncgroups.go +++ b/services/preview/sql/mgmt/v5.0/sql/syncgroups.go @@ -626,7 +626,7 @@ func (client SyncGroupsClient) ListHubSchemasComplete(ctx context.Context, resou // endTime - get logs generated before this time. // typeParameter - the types of logs to retrieve. // continuationToken - the continuation token for this operation. -func (client SyncGroupsClient) ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultPage, err error) { +func (client SyncGroupsClient) ListLogs(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter SyncGroupsType, continuationToken string) (result SyncGroupLogListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListLogs") defer func() { @@ -665,7 +665,7 @@ func (client SyncGroupsClient) ListLogs(ctx context.Context, resourceGroupName s } // ListLogsPreparer prepares the ListLogs request. -func (client SyncGroupsClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (*http.Request, error) { +func (client SyncGroupsClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter SyncGroupsType, continuationToken string) (*http.Request, error) { pathParameters := map[string]interface{}{ "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -733,7 +733,7 @@ func (client SyncGroupsClient) listLogsNextResults(ctx context.Context, lastResu } // ListLogsComplete enumerates all values, automatically crossing page boundaries as required. -func (client SyncGroupsClient) ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter string, continuationToken string) (result SyncGroupLogListResultIterator, err error) { +func (client SyncGroupsClient) ListLogsComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, startTime string, endTime string, typeParameter SyncGroupsType, continuationToken string) (result SyncGroupLogListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupsClient.ListLogs") defer func() { diff --git a/services/preview/sql/mgmt/v5.0/sql/transparentdataencryptionactivities.go b/services/preview/sql/mgmt/v5.0/sql/transparentdataencryptionactivities.go deleted file mode 100644 index 309e0d47eb0d..000000000000 --- a/services/preview/sql/mgmt/v5.0/sql/transparentdataencryptionactivities.go +++ /dev/null @@ -1,115 +0,0 @@ -package sql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TransparentDataEncryptionActivitiesClient is the the Azure SQL Database management API provides a RESTful set of web -// services that interact with Azure SQL Database services to manage your databases. The API enables you to create, -// retrieve, update, and delete databases. -type TransparentDataEncryptionActivitiesClient struct { - BaseClient -} - -// NewTransparentDataEncryptionActivitiesClient creates an instance of the TransparentDataEncryptionActivitiesClient -// client. -func NewTransparentDataEncryptionActivitiesClient(subscriptionID string) TransparentDataEncryptionActivitiesClient { - return NewTransparentDataEncryptionActivitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTransparentDataEncryptionActivitiesClientWithBaseURI creates an instance of the -// TransparentDataEncryptionActivitiesClient client using a custom endpoint. Use this when interacting with an Azure -// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTransparentDataEncryptionActivitiesClientWithBaseURI(baseURI string, subscriptionID string) TransparentDataEncryptionActivitiesClient { - return TransparentDataEncryptionActivitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByConfiguration returns a database's transparent data encryption operation result. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serverName - the name of the server. -// databaseName - the name of the database for which the transparent data encryption applies. -func (client TransparentDataEncryptionActivitiesClient) ListByConfiguration(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionActivityListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionActivitiesClient.ListByConfiguration") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByConfigurationPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.ListByConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", resp, "Failure sending request") - return - } - - result, err = client.ListByConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionActivitiesClient", "ListByConfiguration", resp, "Failure responding to request") - return - } - - return -} - -// ListByConfigurationPreparer prepares the ListByConfiguration request. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByConfigurationSender sends the ListByConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByConfigurationResponder handles the response to the ListByConfiguration request. The method always -// closes the http.Response Body. -func (client TransparentDataEncryptionActivitiesClient) ListByConfigurationResponder(resp *http.Response) (result TransparentDataEncryptionActivityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/sql/mgmt/v5.0/sql/transparentdataencryptions.go b/services/preview/sql/mgmt/v5.0/sql/transparentdataencryptions.go index 691b41cd1464..79f9d00ca5a6 100644 --- a/services/preview/sql/mgmt/v5.0/sql/transparentdataencryptions.go +++ b/services/preview/sql/mgmt/v5.0/sql/transparentdataencryptions.go @@ -33,14 +33,14 @@ func NewTransparentDataEncryptionsClientWithBaseURI(baseURI string, subscription return TransparentDataEncryptionsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate creates or updates a database's transparent data encryption configuration. +// CreateOrUpdate updates a logical database's transparent data encryption configuration. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. // serverName - the name of the server. -// databaseName - the name of the database for which setting the transparent data encryption applies. -// parameters - the required parameters for creating or updating transparent data encryption. -func (client TransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { +// databaseName - the name of the logical database for which the security alert policy is defined. +// parameters - the database transparent data encryption. +func (client TransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters LogicalDatabaseTransparentDataEncryption) (result LogicalDatabaseTransparentDataEncryption, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionsClient.CreateOrUpdate") defer func() { @@ -74,26 +74,25 @@ func (client TransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Contex } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TransparentDataEncryptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (*http.Request, error) { +func (client TransparentDataEncryptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters LogicalDatabaseTransparentDataEncryption) (*http.Request, error) { pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tdeName": autorest.Encode("path", "current"), } - const APIVersion = "2014-04-01" + const APIVersion = "2021-02-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } - parameters.Location = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}", pathParameters), autorest.WithJSON(parameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -107,23 +106,23 @@ func (client TransparentDataEncryptionsClient) CreateOrUpdateSender(req *http.Re // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client TransparentDataEncryptionsClient) CreateOrUpdateResponder(resp *http.Response) (result TransparentDataEncryption, err error) { +func (client TransparentDataEncryptionsClient) CreateOrUpdateResponder(resp *http.Response) (result LogicalDatabaseTransparentDataEncryption, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } -// Get gets a database's transparent data encryption configuration. +// Get gets a logical database's transparent data encryption. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. // serverName - the name of the server. -// databaseName - the name of the database for which the transparent data encryption applies. -func (client TransparentDataEncryptionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryption, err error) { +// databaseName - the name of the logical database for which the transparent data encryption is defined. +func (client TransparentDataEncryptionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result LogicalDatabaseTransparentDataEncryption, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionsClient.Get") defer func() { @@ -159,14 +158,14 @@ func (client TransparentDataEncryptionsClient) Get(ctx context.Context, resource // GetPreparer prepares the Get request. func (client TransparentDataEncryptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "transparentDataEncryptionName": autorest.Encode("path", "current"), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tdeName": autorest.Encode("path", "current"), } - const APIVersion = "2014-04-01" + const APIVersion = "2021-02-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -174,7 +173,7 @@ func (client TransparentDataEncryptionsClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -187,7 +186,7 @@ func (client TransparentDataEncryptionsClient) GetSender(req *http.Request) (*ht // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client TransparentDataEncryptionsClient) GetResponder(resp *http.Response) (result TransparentDataEncryption, err error) { +func (client TransparentDataEncryptionsClient) GetResponder(resp *http.Response) (result LogicalDatabaseTransparentDataEncryption, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -196,3 +195,124 @@ func (client TransparentDataEncryptionsClient) GetResponder(resp *http.Response) result.Response = autorest.Response{Response: resp} return } + +// ListByDatabase gets a list of the logical database's transparent data encryption. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serverName - the name of the server. +// databaseName - the name of the logical database for which the transparent data encryption is defined. +func (client TransparentDataEncryptionsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result LogicalDatabaseTransparentDataEncryptionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionsClient.ListByDatabase") + defer func() { + sc := -1 + if result.ldtdelr.Response.Response != nil { + sc = result.ldtdelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDatabaseNextResults + req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.ldtdelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "ListByDatabase", resp, "Failure sending request") + return + } + + result.ldtdelr, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "ListByDatabase", resp, "Failure responding to request") + return + } + if result.ldtdelr.hasNextLink() && result.ldtdelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDatabasePreparer prepares the ListByDatabase request. +func (client TransparentDataEncryptionsClient) ListByDatabasePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDatabaseSender sends the ListByDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client TransparentDataEncryptionsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (client TransparentDataEncryptionsClient) ListByDatabaseResponder(resp *http.Response) (result LogicalDatabaseTransparentDataEncryptionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDatabaseNextResults retrieves the next set of results, if any. +func (client TransparentDataEncryptionsClient) listByDatabaseNextResults(ctx context.Context, lastResults LogicalDatabaseTransparentDataEncryptionListResult) (result LogicalDatabaseTransparentDataEncryptionListResult, err error) { + req, err := lastResults.logicalDatabaseTransparentDataEncryptionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "listByDatabaseNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "listByDatabaseNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.TransparentDataEncryptionsClient", "listByDatabaseNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDatabaseComplete enumerates all values, automatically crossing page boundaries as required. +func (client TransparentDataEncryptionsClient) ListByDatabaseComplete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result LogicalDatabaseTransparentDataEncryptionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransparentDataEncryptionsClient.ListByDatabase") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) + return +} diff --git a/services/sql/mgmt/2014-04-01/sql/CHANGELOG.md b/services/sql/mgmt/2014-04-01/sql/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/sql/mgmt/2014-04-01/sql/CHANGELOG.md +++ b/services/sql/mgmt/2014-04-01/sql/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/sql/mgmt/2014-04-01/sql/_meta.json b/services/sql/mgmt/2014-04-01/sql/_meta.json index 062071db058d..18d5027bd077 100644 --- a/services/sql/mgmt/2014-04-01/sql/_meta.json +++ b/services/sql/mgmt/2014-04-01/sql/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "02a2528dc0ceeb13d8042069a07b450fe5353da2", "readme": "/_/azure-rest-api-specs/specification/sql/resource-manager/readme.md", "tag": "package-pure-2014-04", "use": "@microsoft.azure/autorest.go@2.1.187",